From c72819c7890d7459885b48fd5afc72eabb97e9ad Mon Sep 17 00:00:00 2001 From: Michael McLoughlin Date: Sun, 21 Feb 2021 18:46:28 -0800 Subject: [PATCH 1/5] ci: bump to go 1.16 --- .github/workflows/ci.yml | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 7b732e90..998fd76b 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -11,7 +11,7 @@ jobs: test: strategy: matrix: - go-version: [1.14.x, 1.15.x] + go-version: [1.15.x, 1.16.x] platform: [ubuntu-latest] runs-on: ${{ matrix.platform }} steps: @@ -53,7 +53,7 @@ jobs: lint: strategy: matrix: - go-version: [1.15.x] + go-version: [1.16.x] platform: [ubuntu-latest] runs-on: ${{ matrix.platform }} steps: @@ -77,7 +77,7 @@ jobs: thirdparty: strategy: matrix: - go-version: [1.14.x, 1.15.x] + go-version: [1.15.x, 1.16.x] platform: [ubuntu-latest] runs-on: ${{ matrix.platform }} steps: From a8137d88e82342a3907117121e9fce577ef5a7f7 Mon Sep 17 00:00:00 2001 From: Michael McLoughlin Date: Wed, 7 Apr 2021 22:54:04 -0700 Subject: [PATCH 2/5] tests/thirdparty: wip --- go.sum | 6 ++++++ tests/thirdparty/packages_test.go | 21 ++++++++++++++++++--- 2 files changed, 24 insertions(+), 3 deletions(-) diff --git a/go.sum b/go.sum index a39ca5c2..ed5363ac 100644 --- a/go.sum +++ b/go.sum @@ -1,23 +1,29 @@ +github.com/yuin/goldmark v1.2.1 h1:ruQGxdhGHe7FWOJPT0mKs5+pD2Xs1Bm/kdGlHO04FmM= github.com/yuin/goldmark v1.2.1/go.mod h1:3hX8gzYuyVAZsxl0MRgGTJEmQBFcNTphYh9decYSb74= golang.org/x/arch v0.0.0-20210405154355-08b684f594a5 h1:nC014MsyPv4PvUtz1bc2vD7b5wRCKlb3j0EVb4cMBuA= golang.org/x/arch v0.0.0-20210405154355-08b684f594a5/go.mod h1:flIaEI6LNU6xOCD5PaJvn9wGP0agmIOqjrtsKGRguv4= golang.org/x/crypto v0.0.0-20190308221718-c2843e01d9a2/go.mod h1:djNgcEr1/C05ACkg1iLfiJU5Ep61QUkGW8qpdssI0+w= golang.org/x/crypto v0.0.0-20191011191535-87dc89f01550/go.mod h1:yigFU9vqHzYiE8UmvKecakEJjdnWj3jj499lnFckfCI= +golang.org/x/crypto v0.0.0-20200622213623-75b288015ac9 h1:psW17arqaxU48Z5kZ0CQnkZWQJsqcURM6tKiBApRjXI= golang.org/x/crypto v0.0.0-20200622213623-75b288015ac9/go.mod h1:LzIPMQfyMNhhGPhUkYOs5KpL4U8rLKemX1yGLhDgUto= golang.org/x/mod v0.3.0 h1:RM4zey1++hCTbCVQfnWeKs9/IEsaBLA8vTkd0WVtmH4= golang.org/x/mod v0.3.0/go.mod h1:s0Qsj1ACt9ePp/hMypM3fl4fZqREWJwdYDEqhRiZZUA= golang.org/x/net v0.0.0-20190404232315-eb5bcb51f2a3/go.mod h1:t9HGtf8HONx5eT2rtn7q6eTqICYqUVnKs3thJo3Qplg= golang.org/x/net v0.0.0-20190620200207-3b0461eec859/go.mod h1:z5CRVTTTmAJ677TzLLGU+0bjPO0LkuOLi4/5GtJWs/s= +golang.org/x/net v0.0.0-20201021035429-f5854403a974 h1:IX6qOQeG5uLjB/hjjwjedwfjND0hgjPMMyO1RoIXQNI= golang.org/x/net v0.0.0-20201021035429-f5854403a974/go.mod h1:sp8m0HH+o8qH0wwXwYZr8TS3Oi6o0r6Gce1SSxlDquU= golang.org/x/sync v0.0.0-20190423024810-112230192c58/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= +golang.org/x/sync v0.0.0-20201020160332-67f06af15bc9 h1:SQFwaSi55rU7vdNs9Yr0Z324VNlrF+0wMqRXT4St8ck= golang.org/x/sync v0.0.0-20201020160332-67f06af15bc9/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= golang.org/x/sys v0.0.0-20190215142949-d0b11bdaac8a/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY= golang.org/x/sys v0.0.0-20190412213103-97732733099d/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= +golang.org/x/sys v0.0.0-20200930185726-fdedc70b468f h1:+Nyd8tzPX9R7BWHguqsrbFdRx3WQ/1ib8I44HXV5yTA= golang.org/x/sys v0.0.0-20200930185726-fdedc70b468f/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= golang.org/x/sys v0.0.0-20210119212857-b64e53b001e4/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= golang.org/x/sys v0.0.0-20210403161142-5e06dd20ab57 h1:F5Gozwx4I1xtr/sr/8CFbb57iKi3297KFs0QDbGN60A= golang.org/x/sys v0.0.0-20210403161142-5e06dd20ab57/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= golang.org/x/text v0.3.0/go.mod h1:NqM8EUOU14njkJ3fqMW+pc6Ldnwhi/IjpwHt7yyuwOQ= +golang.org/x/text v0.3.3 h1:cokOdA+Jmi5PJGXLlLllQSgYigAEfHXJAERHVMaCc2k= golang.org/x/text v0.3.3/go.mod h1:5Zoc/QRtKVWzQhOtBMvqHzDpF6irO9z98xDceosuGiQ= golang.org/x/tools v0.0.0-20180917221912-90fa682c2a6e/go.mod h1:n7NCudcB/nEzxVGmLbDWY5pfWTLqBcC2KZ6jyYvM4mQ= golang.org/x/tools v0.0.0-20191119224855-298f0cb1881e/go.mod h1:b+2E5dAYhXwXZwtnZ6UAqBI28+e2cm9otk0dWdXHAEo= diff --git a/tests/thirdparty/packages_test.go b/tests/thirdparty/packages_test.go index 5a1c97d2..1aec8f0e 100644 --- a/tests/thirdparty/packages_test.go +++ b/tests/thirdparty/packages_test.go @@ -60,6 +60,7 @@ type PackageTest struct { Latest bool // use latest version of the package repopath string // path the repo is cloned to + cwd string // working directory to execute commands in } // Run the test. @@ -79,6 +80,7 @@ func (t *PackageTest) checkout() { dst := filepath.Join(t.WorkDir, t.Name()) t.git("clone", "--quiet", t.CloneURL(), dst) t.repopath = dst + t.cd(t.repopath) // Checkout specific version. if t.Latest { @@ -103,6 +105,7 @@ func (t *PackageTest) modinit() { // replaceavo points all avo dependencies to the local version. func (t *PackageTest) replaceavo() { + // Determine the path to avo. _, self, _, ok := runtime.Caller(1) if !ok { @@ -115,15 +118,22 @@ func (t *PackageTest) replaceavo() { if err != nil { return err } - if filepath.Base(path) != "go.mod" { + dir, base := filepath.Split(path) + if base != "go.mod" { return nil } - t.gotool("mod", "edit", "-replace=github.com/mmcloughlin/avo="+avodir, path) + t.cd(dir) + t.gotool("mod", "tidy") + t.gotool("get", "github.com/mmcloughlin/avo") + t.gotool("mod", "edit", "-replace=github.com/mmcloughlin/avo="+avodir) + t.gotool("mod", "download") return nil }) if err != nil { t.Fatal(err) } + + t.cd(t.repopath) } // generate runs generate commands. @@ -156,6 +166,11 @@ func (t *PackageTest) git(arg ...string) { // gotool runs a go command. func (t *PackageTest) gotool(arg ...string) { cmd := exec.Command(test.GoTool(), arg...) - cmd.Dir = t.repopath + cmd.Dir = t.cwd test.ExecCommand(t.T, cmd) } + +// cd sets the working directory. +func (t *PackageTest) cd(dir string) { + t.cwd = dir +} From 1c443fecfc3ba74022d37f572163f03210576d10 Mon Sep 17 00:00:00 2001 From: Michael McLoughlin Date: Mon, 19 Apr 2021 14:22:19 -0700 Subject: [PATCH 3/5] test/thirdparty: revert changes to packages_test --- tests/thirdparty/packages_test.go | 21 +++------------------ 1 file changed, 3 insertions(+), 18 deletions(-) diff --git a/tests/thirdparty/packages_test.go b/tests/thirdparty/packages_test.go index 1aec8f0e..5a1c97d2 100644 --- a/tests/thirdparty/packages_test.go +++ b/tests/thirdparty/packages_test.go @@ -60,7 +60,6 @@ type PackageTest struct { Latest bool // use latest version of the package repopath string // path the repo is cloned to - cwd string // working directory to execute commands in } // Run the test. @@ -80,7 +79,6 @@ func (t *PackageTest) checkout() { dst := filepath.Join(t.WorkDir, t.Name()) t.git("clone", "--quiet", t.CloneURL(), dst) t.repopath = dst - t.cd(t.repopath) // Checkout specific version. if t.Latest { @@ -105,7 +103,6 @@ func (t *PackageTest) modinit() { // replaceavo points all avo dependencies to the local version. func (t *PackageTest) replaceavo() { - // Determine the path to avo. _, self, _, ok := runtime.Caller(1) if !ok { @@ -118,22 +115,15 @@ func (t *PackageTest) replaceavo() { if err != nil { return err } - dir, base := filepath.Split(path) - if base != "go.mod" { + if filepath.Base(path) != "go.mod" { return nil } - t.cd(dir) - t.gotool("mod", "tidy") - t.gotool("get", "github.com/mmcloughlin/avo") - t.gotool("mod", "edit", "-replace=github.com/mmcloughlin/avo="+avodir) - t.gotool("mod", "download") + t.gotool("mod", "edit", "-replace=github.com/mmcloughlin/avo="+avodir, path) return nil }) if err != nil { t.Fatal(err) } - - t.cd(t.repopath) } // generate runs generate commands. @@ -166,11 +156,6 @@ func (t *PackageTest) git(arg ...string) { // gotool runs a go command. func (t *PackageTest) gotool(arg ...string) { cmd := exec.Command(test.GoTool(), arg...) - cmd.Dir = t.cwd + cmd.Dir = t.repopath test.ExecCommand(t.T, cmd) } - -// cd sets the working directory. -func (t *PackageTest) cd(dir string) { - t.cwd = dir -} From d5111471fb5ed07e61494b9c47526b241c29b91b Mon Sep 17 00:00:00 2001 From: Michael McLoughlin Date: Mon, 19 Apr 2021 14:28:10 -0700 Subject: [PATCH 4/5] Revert "test/thirdparty: revert changes to packages_test" This reverts commit 1c443fecfc3ba74022d37f572163f03210576d10. --- tests/thirdparty/packages_test.go | 21 ++++++++++++++++++--- 1 file changed, 18 insertions(+), 3 deletions(-) diff --git a/tests/thirdparty/packages_test.go b/tests/thirdparty/packages_test.go index 5a1c97d2..1aec8f0e 100644 --- a/tests/thirdparty/packages_test.go +++ b/tests/thirdparty/packages_test.go @@ -60,6 +60,7 @@ type PackageTest struct { Latest bool // use latest version of the package repopath string // path the repo is cloned to + cwd string // working directory to execute commands in } // Run the test. @@ -79,6 +80,7 @@ func (t *PackageTest) checkout() { dst := filepath.Join(t.WorkDir, t.Name()) t.git("clone", "--quiet", t.CloneURL(), dst) t.repopath = dst + t.cd(t.repopath) // Checkout specific version. if t.Latest { @@ -103,6 +105,7 @@ func (t *PackageTest) modinit() { // replaceavo points all avo dependencies to the local version. func (t *PackageTest) replaceavo() { + // Determine the path to avo. _, self, _, ok := runtime.Caller(1) if !ok { @@ -115,15 +118,22 @@ func (t *PackageTest) replaceavo() { if err != nil { return err } - if filepath.Base(path) != "go.mod" { + dir, base := filepath.Split(path) + if base != "go.mod" { return nil } - t.gotool("mod", "edit", "-replace=github.com/mmcloughlin/avo="+avodir, path) + t.cd(dir) + t.gotool("mod", "tidy") + t.gotool("get", "github.com/mmcloughlin/avo") + t.gotool("mod", "edit", "-replace=github.com/mmcloughlin/avo="+avodir) + t.gotool("mod", "download") return nil }) if err != nil { t.Fatal(err) } + + t.cd(t.repopath) } // generate runs generate commands. @@ -156,6 +166,11 @@ func (t *PackageTest) git(arg ...string) { // gotool runs a go command. func (t *PackageTest) gotool(arg ...string) { cmd := exec.Command(test.GoTool(), arg...) - cmd.Dir = t.repopath + cmd.Dir = t.cwd test.ExecCommand(t.T, cmd) } + +// cd sets the working directory. +func (t *PackageTest) cd(dir string) { + t.cwd = dir +} From fbb5e7bf36c16811615a88166b18e4b633ba1e46 Mon Sep 17 00:00:00 2001 From: Michael McLoughlin Date: Mon, 19 Apr 2021 14:29:20 -0700 Subject: [PATCH 5/5] fmt --- tests/thirdparty/packages_test.go | 1 - 1 file changed, 1 deletion(-) diff --git a/tests/thirdparty/packages_test.go b/tests/thirdparty/packages_test.go index 1aec8f0e..25dabb32 100644 --- a/tests/thirdparty/packages_test.go +++ b/tests/thirdparty/packages_test.go @@ -105,7 +105,6 @@ func (t *PackageTest) modinit() { // replaceavo points all avo dependencies to the local version. func (t *PackageTest) replaceavo() { - // Determine the path to avo. _, self, _, ok := runtime.Caller(1) if !ok {