Reputation: 869
Using a MacBook Pro, Big Sur OS, I followed the hyperledger fabric documentation, I installed all the required files and tools. However, when I reached to the final step, the code generated a goimports error that I am not able to repair. The Error was the following:
johnny@JohnnyMBP fabric % make basic-checks integration-test-prereqs
All files are excluded from having license headers
Building github.com/client9/misspell/cmd/misspell -> misspell
Checking changed go files for spelling errors ...
spell checker passed
Checking for go:generate parent path references
Checking trailing spaces ...
DEP: Checking for dependency issues..
./scripts/check_deps.sh
Building golang.org/x/tools/cmd/goimports -> goimports
Building mvdan.cc/gofumpt -> gofumpt
Building honnef.co/go/tools/cmd/staticcheck -> staticcheck
LINT: Running code checks..
./scripts/golinter.sh
Checking with goimports
The following files contain goimports errors
bccsp/factory/nopkcs11.go
bccsp/factory/nopkcs11_test.go
bccsp/factory/pkcs11.go
bccsp/factory/pkcs11_test.go
bccsp/factory/pkcs11factory.go
bccsp/factory/pkcs11factory_test.go
bccsp/pkcs11/pkcs11_test.go
core/handlers/library/noplugin_test.go
core/handlers/library/plugin.go
core/handlers/library/plugin_stub.go
core/handlers/library/race_test.go
integration/ledger/ledger_generate_test.go
internal/fileutil/syncdir.go
internal/peer/node/signals.go
internal/peer/node/signals_windows.go
orderer/common/server/signals.go
orderer/common/server/signals_windows.go
The goimports command 'goimports -l -w' must be run for these files
make: *** [linter] Error 1
johnny@JohnnyMBP fabric %
This was my go environment results:
johnny@JohnnyMBP fabric % go env
GO111MODULE=""
GOARCH="amd64"
GOBIN=""
GOCACHE="/Users/johnny/Library/Caches/go-build"
GOENV="/Users/johnny/Library/Application Support/go/env"
GOEXE=""
GOEXPERIMENT=""
GOFLAGS=""
GOHOSTARCH="amd64"
GOHOSTOS="darwin"
GOINSECURE=""
GOMODCACHE="/Users/johnny/go/pkg/mod"
GONOPROXY=""
GONOSUMDB=""
GOOS="darwin"
GOPATH="/Users/johnny/go"
GOPRIVATE=""
GOPROXY="https://proxy.golang.org,direct"
GOROOT="/usr/local/Cellar/go/1.17.2/libexec"
GOSUMDB="sum.golang.org"
GOTMPDIR=""
GOTOOLDIR="/usr/local/Cellar/go/1.17.2/libexec/pkg/tool/darwin_amd64"
GOVCS=""
GOVERSION="go1.17.2"
GCCGO="gccgo"
AR="ar"
CC="clang"
CXX="clang++"
CGO_ENABLED="1"
GOMOD="/Users/johnny/github.com/webzest/fabric/go.mod"
CGO_CFLAGS="-g -O2"
CGO_CPPFLAGS=""
CGO_CXXFLAGS="-g -O2"
CGO_FFLAGS="-g -O2"
CGO_LDFLAGS="-g -O2"
PKG_CONFIG="pkg-config"
GOGCCFLAGS="-fPIC -arch x86_64 -m64 -pthread -fno-caret-diagnostics -Qunused-arguments -fmessage-length=0 -fdebug-prefix-map=/var/folders/vs/8twtz6352nb26pnpyqfk11j80000gn/T/go-build698966046=/tmp/go-build -gno-record-gcc-switches -fno-common"
Please provide some guidance that I can follow to complete the development environment for hyperledger fabric.
UPDATED:
I ran goimports -l -w on all the .go files and reran a make basic-check. Now, I am getting a vendor error:
johnny@JohnnyMBP fabric % make basic-checks
All files have SPDX-License-Identifier headers
Building github.com/client9/misspell/cmd/misspell -> misspell
Checking changed go files for spelling errors ...
spell checker passed
Checking for go:generate parent path references
Checking trailing spaces ...
DEP: Checking for dependency issues..
./scripts/check_deps.sh
Building golang.org/x/tools/cmd/goimports -> goimports
Building mvdan.cc/gofumpt -> gofumpt
Building honnef.co/go/tools/cmd/staticcheck -> staticcheck
LINT: Running code checks..
./scripts/golinter.sh
Checking with goimports
Checking with gofumpt
Checking for golang.org/x/net/context
Checking for github.com/gogo/protobuf
Checking with go vet
Checking with staticcheck
The following staticcheck issues were flagged
vendor/github.com/dustin/go-humanize/number.go:76:9: constant overflow (compile)
vendor/github.com/onsi/ginkgo/internal/leafnodes/benchmarker.go:82:25: constant overflow (compile)
make: *** [linter] Error 1
johnny@JohnnyMBP fabric %
Has anyone successfully setup the development environment with the latest version of GO and the latest build on GIT for Fabric? I need help, please?
Upvotes: 0
Views: 156
Reputation: 1649
Two things to try:
If there really is something wrong with the imports in those files, which there shouldn't be unless they have been modified locally, use the goimports -l -w
command for each of the files listed to correct them.
For reference, I am also using a Macbook Pro, running MacOS Monterey but previously with Big Sur, and make basic-checks
runs cleanly for me with Go 1.16.9 on the latest main branch code.
Upvotes: 1