From 5485133f1531f773549209d43d410a9921c7f45a Mon Sep 17 00:00:00 2001 From: Leigh McCulloch <351529+leighmcculloch@users.noreply.github.com> Date: Fri, 20 Aug 2021 08:41:38 -0700 Subject: [PATCH] all: update supported go versions to 1.17 and 1.16 (#3827) Update supported Go versions to 1.17 and 1.16. Go 1.15 is no longer supported. Go 1.17 has been released. --- .circleci/config.yml | 42 +++++++++---------- .github/workflows/go.yml | 6 +-- go.mod | 3 +- go.sum | 3 -- golist.sh | 2 +- .../stellar_core_runner_posix.go | 1 + .../stellar_core_runner_windows.go | 1 + .../internal/ingest/sample_changes_test.go | 1 + .../internal/test/integration/integration.go | 2 +- services/keystore/cmd/keystored/dev.go | 1 + support/render/problem/default_test.go | 10 ++--- support/render/problem/problem_test.go | 10 ++--- xdr/fuzz/jsonclaimpredicate/fuzz.go | 1 + 13 files changed, 42 insertions(+), 41 deletions(-) diff --git a/.circleci/config.yml b/.circleci/config.yml index b83d6522a1..dea4ff5d90 100644 --- a/.circleci/config.yml +++ b/.circleci/config.yml @@ -115,8 +115,8 @@ commands: name: Download and install golang command: | sudo rm -rf /usr/local/go - wget https://dl.google.com/go/go1.16.5.linux-amd64.tar.gz - sudo tar -C /usr/local -xzf go1.16.5.linux-amd64.tar.gz + wget https://dl.google.com/go/go1.17.linux-amd64.tar.gz + sudo tar -C /usr/local -xzf go1.17.linux-amd64.tar.gz # install_go_deps installs the go dependencies of the project. install_go_deps: @@ -223,11 +223,11 @@ commands: #-----------------------------------------------------------------------------# jobs: - # check_code_1_16 performs code checks using Go 1.16. - check_code_1_16: + # check_code_1_17 performs code checks using Go 1.17. + check_code_1_17: working_directory: /go/src/github.com/stellar/go docker: - - image: golang:1.16 + - image: golang:1.17 steps: - install_go_deps - check_go_deps @@ -237,11 +237,11 @@ jobs: - staticcheck - build_packages - # test_code_1_15 performs all package tests using Go 1.15. - test_code_1_15: + # test_code_1_16 performs all package tests using Go 1.16. + test_code_1_16: working_directory: /go/src/github.com/stellar/go docker: - - image: golang:1.15 + - image: golang:1.16 environment: GO111MODULE: "on" PGHOST: localhost @@ -257,11 +257,11 @@ jobs: - install_go_deps - test_packages - # test_code_1_15 performs all package tests using Go 1.15 and Postgres 10. - test_code_1_15_postgres10: + # test_code_1_16 performs all package tests using Go 1.16 and Postgres 10. + test_code_1_16_postgres10: working_directory: /go/src/github.com/stellar/go docker: - - image: golang:1.15 + - image: golang:1.16 environment: GO111MODULE: "on" PGHOST: localhost @@ -278,11 +278,11 @@ jobs: - install_go_deps - test_packages - # test_code_1_16 performs all package tests using Go 1.16. - test_code_1_16: + # test_code_1_17 performs all package tests using Go 1.17. + test_code_1_17: working_directory: /go/src/github.com/stellar/go docker: - - image: golang:1.16 + - image: golang:1.17 environment: GO111MODULE: "on" PGHOST: localhost @@ -298,11 +298,11 @@ jobs: - install_go_deps - test_packages - # test_code_1_16 performs all package tests using Go 1.16 and Postgres 10. - test_code_1_16_postgres10: + # test_code_1_17 performs all package tests using Go 1.17 and Postgres 10. + test_code_1_17_postgres10: working_directory: /go/src/github.com/stellar/go docker: - - image: golang:1.16 + - image: golang:1.17 environment: GO111MODULE: "on" PGHOST: localhost @@ -325,7 +325,7 @@ jobs: publish_artifacts: working_directory: /go/src/github.com/stellar/go docker: - - image: golang:1.16 + - image: golang:1.17 steps: - check_deprecations - install_go_deps @@ -468,11 +468,11 @@ workflows: check_code_and_test: jobs: - - check_code_1_16 - - test_code_1_15 - - test_code_1_15_postgres10 + - check_code_1_17 - test_code_1_16 - test_code_1_16_postgres10 + - test_code_1_17 + - test_code_1_17_postgres10 # run the integration tests ... # ... without captive core - test_horizon_integration diff --git a/.github/workflows/go.yml b/.github/workflows/go.yml index 1564254d48..1fda24d2d2 100644 --- a/.github/workflows/go.yml +++ b/.github/workflows/go.yml @@ -11,7 +11,7 @@ jobs: strategy: matrix: os: [ubuntu-latest] - go: [1.16.5] + go: [1.17] runs-on: ${{ matrix.os }} steps: - uses: actions/checkout@v2 @@ -29,7 +29,7 @@ jobs: strategy: matrix: os: [ubuntu-latest] - go: [1.16.5, 1.15.13] + go: [1.17, 1.16.7] runs-on: ${{ matrix.os }} steps: - uses: actions/checkout@v2 @@ -43,7 +43,7 @@ jobs: strategy: matrix: os: [ubuntu-latest] - go: [1.16.5, 1.15.13] + go: [1.17, 1.16.7] pg: [9.6.5, 10] runs-on: ${{ matrix.os }} services: diff --git a/go.mod b/go.mod index 67af427b04..9d9084f1be 100644 --- a/go.mod +++ b/go.mod @@ -1,6 +1,6 @@ module github.com/stellar/go -go 1.15 +go 1.16 require ( cloud.google.com/go/firestore v1.5.0 // indirect @@ -30,7 +30,6 @@ require ( github.com/inconshreveable/mousetrap v1.0.0 // indirect github.com/jarcoal/httpmock v0.0.0-20161210151336-4442edb3db31 github.com/jmoiron/sqlx v1.2.0 - github.com/k0kubun/colorstring v0.0.0-20150214042306-9440f1994b88 // indirect github.com/klauspost/compress v0.0.0-20161106143436-e3b7981a12dd // indirect github.com/klauspost/cpuid v0.0.0-20160302075316-09cded8978dc // indirect github.com/klauspost/crc32 v0.0.0-20161016154125-cb6bfca970f6 // indirect diff --git a/go.sum b/go.sum index 4eb215c10b..abc984b5da 100644 --- a/go.sum +++ b/go.sum @@ -140,7 +140,6 @@ github.com/golang/protobuf v1.5.0/go.mod h1:FsONVRAS9T7sI+LIUmWTfcYkHO4aIWwzhcaS github.com/golang/protobuf v1.5.1/go.mod h1:DopwsBzvsk0Fs44TXzsVbJyPhcCPeIwnvohx4u74HPM= github.com/golang/protobuf v1.5.2 h1:ROPKBNFfQgOUMifHyP+KYbvpjbdoFNs+aK7DXlji0Tw= github.com/golang/protobuf v1.5.2/go.mod h1:XVQd3VNwM+JqD3oG2Ue2ip4fOMUkwXdXDdiuN0vRsmY= -github.com/golang/snappy v0.0.3 h1:fHPg5GQYlCeLIPB9BZqMVR5nR9A+IM5zcgeTdjMYmLA= github.com/golang/snappy v0.0.3/go.mod h1:/XxbfmMg8lxefKM7IXC3fBNl/7bRcc72aCRzEWrmP2Q= github.com/google/btree v0.0.0-20180813153112-4030bb1f1f0c/go.mod h1:lNA+9X1NB3Zf8V7Ke586lFgjr2dZNuvo3lPJSGZ5JPQ= github.com/google/btree v1.0.0/go.mod h1:lNA+9X1NB3Zf8V7Ke586lFgjr2dZNuvo3lPJSGZ5JPQ= @@ -220,8 +219,6 @@ github.com/jstemmer/go-junit-report v0.9.1/go.mod h1:Brl9GWCQeLvo8nXZwPNNblvFj/X github.com/jtolds/gls v4.20.0+incompatible h1:xdiiI2gbIgH/gLH7ADydsJ1uDOEzR8yvV7C0MuV77Wo= github.com/jtolds/gls v4.20.0+incompatible/go.mod h1:QJZ7F/aHp+rZTRtaJ1ow/lLfFfVYBRgL+9YlvaHOwJU= github.com/julienschmidt/httprouter v1.2.0/go.mod h1:SYymIcj16QtmaHHD7aYtjjsJG7VTCxuUUipMqKk8s4w= -github.com/k0kubun/colorstring v0.0.0-20150214042306-9440f1994b88 h1:uC1QfSlInpQF+M0ao65imhwqKnz3Q2z/d8PWZRMQvDM= -github.com/k0kubun/colorstring v0.0.0-20150214042306-9440f1994b88/go.mod h1:3w7q1U84EfirKl04SVQ/s7nPm1ZPhiXd34z40TNz36k= github.com/kisielk/gotool v1.0.0/go.mod h1:XhKaO+MFFWcvkIS/tQcRk01m1F5IRFswLeQ+oQHNcck= github.com/klauspost/compress v0.0.0-20161106143436-e3b7981a12dd h1:vQ0EEfHpdFUtNRj1ri25MUq5jb3Vma+kKhLyjeUTVow= github.com/klauspost/compress v0.0.0-20161106143436-e3b7981a12dd/go.mod h1:RyIbtBH6LamlWaDj8nUwkbUhJ87Yi3uG0guNDohfE1A= diff --git a/golist.sh b/golist.sh index 46a251b119..740b390ab4 100755 --- a/golist.sh +++ b/golist.sh @@ -1,3 +1,3 @@ #!/usr/bin/env bash -go list -deps -test -f '{{with .Module}}{{.Path}} {{.Version}}{{end}}' ./... | LC_ALL=C sort -u +go list -f '{{with .Module}}{{.Path}} {{.Version}}{{end}}' all | LC_ALL=C sort -u diff --git a/ingest/ledgerbackend/stellar_core_runner_posix.go b/ingest/ledgerbackend/stellar_core_runner_posix.go index 8daa80b60a..2b0f2b4115 100644 --- a/ingest/ledgerbackend/stellar_core_runner_posix.go +++ b/ingest/ledgerbackend/stellar_core_runner_posix.go @@ -1,3 +1,4 @@ +//go:build !windows // +build !windows package ledgerbackend diff --git a/ingest/ledgerbackend/stellar_core_runner_windows.go b/ingest/ledgerbackend/stellar_core_runner_windows.go index 47d87be5c9..80932aaf50 100644 --- a/ingest/ledgerbackend/stellar_core_runner_windows.go +++ b/ingest/ledgerbackend/stellar_core_runner_windows.go @@ -1,3 +1,4 @@ +//go:build windows // +build windows package ledgerbackend diff --git a/services/horizon/internal/ingest/sample_changes_test.go b/services/horizon/internal/ingest/sample_changes_test.go index a2dee63c7a..6553e7b7b5 100644 --- a/services/horizon/internal/ingest/sample_changes_test.go +++ b/services/horizon/internal/ingest/sample_changes_test.go @@ -1,3 +1,4 @@ +//go:build update // +build update package ingest diff --git a/services/horizon/internal/test/integration/integration.go b/services/horizon/internal/test/integration/integration.go index d3c6d10b28..54361c5847 100644 --- a/services/horizon/internal/test/integration/integration.go +++ b/services/horizon/internal/test/integration/integration.go @@ -213,7 +213,7 @@ func (i *Test) prepareShutdownHandlers() { // stopped even if ingestion or testing fails. i.t.Cleanup(i.Shutdown) - c := make(chan os.Signal) + c := make(chan os.Signal, 1) signal.Notify(c, os.Interrupt, syscall.SIGTERM) go func() { <-c diff --git a/services/keystore/cmd/keystored/dev.go b/services/keystore/cmd/keystored/dev.go index f4ec55e336..1d87de9ff1 100644 --- a/services/keystore/cmd/keystored/dev.go +++ b/services/keystore/cmd/keystored/dev.go @@ -1,3 +1,4 @@ +//go:build !aws // +build !aws package main diff --git a/support/render/problem/default_test.go b/support/render/problem/default_test.go index b6b1c1c90d..f99e90a5a5 100644 --- a/support/render/problem/default_test.go +++ b/support/render/problem/default_test.go @@ -29,9 +29,9 @@ func TestRender(t *testing.T) { 500, }, { "renders the type correctly", - P{Type: "foo"}, + P{Type: "foo", Status: 500}, []string{"foo"}, - 0, + 500, }, { "renders the status correctly", P{Status: 201}, @@ -39,9 +39,9 @@ func TestRender(t *testing.T) { 201, }, { "renders the extras correctly", - P{Extras: map[string]interface{}{"hello": "stellar"}}, + P{Extras: map[string]interface{}{"hello": "stellar"}, Status: 500}, []string{"hello", "stellar"}, - 0, + 500, }, } @@ -105,7 +105,7 @@ func TestInflate(t *testing.T) { want string }{ "renders the type correctly", - P{Type: "https://stellar.org/horizon-errors/not_found"}, + P{Type: "https://stellar.org/horizon-errors/not_found", Status: 404}, "https://stellar.org/horizon-errors/not_found", } diff --git a/support/render/problem/problem_test.go b/support/render/problem/problem_test.go index ea584cda71..2b142b3deb 100644 --- a/support/render/problem/problem_test.go +++ b/support/render/problem/problem_test.go @@ -32,9 +32,9 @@ func TestProblemRender(t *testing.T) { 500, }, { "renders the type correctly", - P{Type: "foo"}, + P{Type: "foo", Status: 500}, []string{"foo"}, - 0, + 500, }, { "renders the status correctly", P{Status: 201}, @@ -42,9 +42,9 @@ func TestProblemRender(t *testing.T) { 201, }, { "renders the extras correctly", - P{Extras: map[string]interface{}{"hello": "stellar"}}, + P{Extras: map[string]interface{}{"hello": "stellar"}, Status: 500}, []string{"hello", "stellar"}, - 0, + 500, }, } @@ -112,7 +112,7 @@ func TestProblemInflate(t *testing.T) { want string }{ "renders the type correctly", - P{Type: "https://stellar.org/horizon-errors/not_found"}, + P{Type: "https://stellar.org/horizon-errors/not_found", Status: 404}, "https://stellar.org/horizon-errors/not_found", } diff --git a/xdr/fuzz/jsonclaimpredicate/fuzz.go b/xdr/fuzz/jsonclaimpredicate/fuzz.go index 3052e8996c..4f861d7954 100644 --- a/xdr/fuzz/jsonclaimpredicate/fuzz.go +++ b/xdr/fuzz/jsonclaimpredicate/fuzz.go @@ -1,3 +1,4 @@ +//go:build gofuzz // +build gofuzz package jsonclaimpredicate