diff --git a/Makefile b/Makefile index b0d6e5d62a0..2007b33c4d7 100644 --- a/Makefile +++ b/Makefile @@ -78,7 +78,7 @@ METADATA_VAR += CommitSHA=$(EXTRA_VERSION) METADATA_VAR += BaseDockerLabel=$(BASE_DOCKER_LABEL) METADATA_VAR += DockerNamespace=$(DOCKER_NS) -GO_VER = 1.17.5 +GO_VER = 1.18.2 GO_TAGS ?= RELEASE_EXES = orderer $(TOOLS_EXES) diff --git a/ci/azure-pipelines-merge.yml b/ci/azure-pipelines-merge.yml index 40312a06b90..9ee815e0886 100644 --- a/ci/azure-pipelines-merge.yml +++ b/ci/azure-pipelines-merge.yml @@ -11,7 +11,7 @@ pr: none variables: GOPATH: $(Agent.BuildDirectory)/go PATH: $(Agent.BuildDirectory)/go/bin:/usr/local/go/bin:/bin:/usr/bin:/sbin:/usr/sbin:/usr/local/bin:/usr/local/sbin - GOVER: 1.17.5 + GOVER: 1.18.2 jobs: - job: UnitTests diff --git a/ci/azure-pipelines-release.yml b/ci/azure-pipelines-release.yml index eafe4e0fad9..7ad4317876a 100644 --- a/ci/azure-pipelines-release.yml +++ b/ci/azure-pipelines-release.yml @@ -11,7 +11,7 @@ variables: - name: GOPATH value: $(Agent.BuildDirectory)/go - name: GOVER - value: 1.17.5 + value: 1.18.2 stages: - stage: BuildBinaries diff --git a/ci/azure-pipelines.yml b/ci/azure-pipelines.yml index 1c9fce18248..8fde3889d77 100644 --- a/ci/azure-pipelines.yml +++ b/ci/azure-pipelines.yml @@ -11,7 +11,7 @@ pr: variables: GOPATH: $(Agent.BuildDirectory)/go PATH: $(Agent.BuildDirectory)/go/bin:/bin:/usr/bin:/sbin:/usr/sbin:/usr/local/bin:/usr/local/sbin - GOVER: 1.17.5 + GOVER: 1.18.2 stages: - stage: VerifyBuild diff --git a/common/fabhttp/server_test.go b/common/fabhttp/server_test.go index b8dcac1cc8d..7d8a853d04f 100644 --- a/common/fabhttp/server_test.go +++ b/common/fabhttp/server_test.go @@ -85,7 +85,7 @@ var _ = Describe("Server", func() { addApiURL := fmt.Sprintf("https://%s%s", server.Addr(), AdditionalTestApiPath) _, err = client.Get(addApiURL) - Expect(err.Error()).To(ContainSubstring("tls: protocol version not supported")) + Expect(err.Error()).To(ContainSubstring("tls: no supported versions satisfy MinVersion and MaxVersion")) }) }) diff --git a/common/grpclogging/fields_test.go b/common/grpclogging/fields_test.go index d2794754c09..6216304059c 100644 --- a/common/grpclogging/fields_test.go +++ b/common/grpclogging/fields_test.go @@ -87,7 +87,9 @@ var _ = Describe("Fields", func() { field := grpclogging.Error(err) Expect(field.Key).To(Equal("error")) Expect(field.Type).To(Equal(zapcore.ErrorType)) - Expect(field.Interface).To(Equal(struct{ error }{err})) + // assert that field Interface is of type error + _, ok := field.Interface.(error) + Expect(ok).To(BeTrue()) }) Context("when the error is nil", func() { diff --git a/common/ledger/testutil/test_helper.go b/common/ledger/testutil/test_helper.go index dd2126f0164..1ba659c40b3 100644 --- a/common/ledger/testutil/test_helper.go +++ b/common/ledger/testutil/test_helper.go @@ -30,7 +30,7 @@ var signer msp.SigningIdentity func init() { // setup the MSP manager so that we can sign/verify - var err error = msptesttools.LoadMSPSetupForTesting() + err := msptesttools.LoadMSPSetupForTesting() if err != nil { panic(fmt.Errorf("Could not load msp config, err %s", err)) } diff --git a/common/policydsl/policyparser.go b/common/policydsl/policyparser.go index 33ee70d5bd6..2e540f61a86 100644 --- a/common/policydsl/policyparser.go +++ b/common/policydsl/policyparser.go @@ -141,7 +141,7 @@ func secondPass(args ...interface{}) (interface{}, error) { } /* get the n in the t out of n */ - var n int = len(args) - 2 + n := len(args) - 2 /* sanity check - t should be positive, permit equal to n+1, but disallow over n+1 */ if t < 0 || t > n+1 { diff --git a/common/viperutil/config_util.go b/common/viperutil/config_util.go index 3986fb533be..23130b42856 100644 --- a/common/viperutil/config_util.go +++ b/common/viperutil/config_util.go @@ -81,7 +81,7 @@ func (c *ConfigParser) ConfigFileUsed() string { // Search for the existence of filename for all supported extensions func (c *ConfigParser) searchInPath(in string) (filename string) { - var supportedExts []string = []string{"yaml", "yml"} + supportedExts := []string{"yaml", "yml"} for _, ext := range supportedExts { fullPath := filepath.Join(in, c.configName+"."+ext) _, err := os.Stat(fullPath) diff --git a/core/ledger/kvledger/txmgmt/statedb/statecouchdb/couchdb.go b/core/ledger/kvledger/txmgmt/statedb/statecouchdb/couchdb.go index 7d9da662cd5..99493b81ea4 100644 --- a/core/ledger/kvledger/txmgmt/statedb/statecouchdb/couchdb.go +++ b/core/ledger/kvledger/txmgmt/statedb/statecouchdb/couchdb.go @@ -1131,7 +1131,7 @@ func (dbclient *couchDatabase) listIndex() ([]*indexResult, error) { designDoc = s[1] // Add the index definition to the results - addIndexResult := &indexResult{DesignDocument: designDoc, Name: row.Name, Definition: fmt.Sprintf("%s", row.Definition)} + addIndexResult := &indexResult{DesignDocument: designDoc, Name: row.Name, Definition: string(row.Definition)} results = append(results, addIndexResult) } diff --git a/docs/source/prereqs.md b/docs/source/prereqs.md index cdf91ba967c..640a866ad11 100644 --- a/docs/source/prereqs.md +++ b/docs/source/prereqs.md @@ -82,9 +82,9 @@ Optional: Install the latest Fabric supported version of [Go](https://golang.org installed (only required if you will be writing Go chaincode or SDK applications). ```shell -$ brew install go@1.17.5 +$ brew install go@1.18.2 $ go version -go1.17.5 darwin/amd64 +go1.18.2 darwin/amd64 ``` ### JQ diff --git a/gotools.mk b/gotools.mk index ed9cbf53015..b1a95301cea 100644 --- a/gotools.mk +++ b/gotools.mk @@ -18,7 +18,7 @@ go.fqp.golint := golang.org/x/lint/golint go.fqp.misspell := github.com/client9/misspell/cmd/misspell go.fqp.mockery := github.com/vektra/mockery/cmd/mockery go.fqp.protoc-gen-go := github.com/golang/protobuf/protoc-gen-go -go.fqp.staticcheck := honnef.co/go/tools/cmd/staticcheck +go.fqp.staticcheck := honnef.co/go/tools/cmd/staticcheck@2022.1.1 # 2022.1.1 fixes the staticcheck issue with Go 1.18 "export data is newer version - update tool" go.fqp.swagger := github.com/go-swagger/go-swagger/cmd/swagger .PHONY: gotools-install diff --git a/integration/nwo/components.go b/integration/nwo/components.go index 4e903811281..a21171653d7 100644 --- a/integration/nwo/components.go +++ b/integration/nwo/components.go @@ -62,7 +62,7 @@ func (c *Components) Build(path string) string { Expect(err).NotTo(HaveOccurred()) if resp.StatusCode != http.StatusOK { - Expect(resp.StatusCode).To(Equal(http.StatusOK), fmt.Sprintf("%s", body)) + Expect(resp.StatusCode).To(Equal(http.StatusOK), string(body)) } return string(body) diff --git a/internal/pkg/comm/creds_test.go b/internal/pkg/comm/creds_test.go index 48496f5b753..9027318eda2 100644 --- a/internal/pkg/comm/creds_test.go +++ b/internal/pkg/comm/creds_test.go @@ -94,7 +94,7 @@ func TestCreds(t *testing.T) { MaxVersion: tls.VersionTLS10, }) wg.Wait() - require.Contains(t, err.Error(), "protocol version not supported") + require.Contains(t, err.Error(), "tls: no supported versions satisfy MinVersion and MaxVersion") require.Contains(t, recorder.Messages()[1], "TLS handshake failed") } diff --git a/orderer/common/cluster/replication.go b/orderer/common/cluster/replication.go index 0938cf6d977..d70add54c11 100644 --- a/orderer/common/cluster/replication.go +++ b/orderer/common/cluster/replication.go @@ -551,7 +551,7 @@ func (ci *ChainInspector) Channels() []ChannelGenesisBlock { } ci.validateHashPointer(block, prevHash) // Set the previous hash for the next iteration - prevHash = protoutil.BlockHeaderHash(block.Header) //lint:ignore SA5011 logs and panics above + prevHash = protoutil.BlockHeaderHash(block.Header) channel, gb, err := ExtractGenesisBlock(ci.Logger, block) if err != nil { diff --git a/orderer/common/multichannel/registrar.go b/orderer/common/multichannel/registrar.go index 88e52da37bb..7bdd2213737 100644 --- a/orderer/common/multichannel/registrar.go +++ b/orderer/common/multichannel/registrar.go @@ -263,7 +263,7 @@ func (r *Registrar) initSystemChannel(existingChannels []string) { logger.Infof( "Starting system channel '%s' with genesis block hash %x and orderer type %s", channelID, - protoutil.BlockHeaderHash(genesisBlock.Header), //lint:ignore SA5011 logs and panics above + protoutil.BlockHeaderHash(genesisBlock.Header), chain.SharedConfig().ConsensusType(), ) diff --git a/vagrant/golang.sh b/vagrant/golang.sh index 1423133f0f6..29885831177 100644 --- a/vagrant/golang.sh +++ b/vagrant/golang.sh @@ -5,7 +5,7 @@ # SPDX-License-Identifier: Apache-2.0 GOROOT='/opt/go' -GO_VERSION=1.17.5 +GO_VERSION=1.18.2 # ---------------------------------------------------------------- # Install Golang