go version)?$ go version go version go1.11.5 linux/amd64
go env)?go env Output
$ go env
gitlab-runner@it-Z97X-Gaming-3:~/go/bin$ go env
GOARCH="amd64"
GOBIN=""
GOCACHE="/home/gitlab-runner/.cache/go-build"
GOEXE=""
GOFLAGS=""
GOHOSTARCH="amd64"
GOHOSTOS="linux"
GOOS="linux"
GOPATH="/home/gitlab-runner/go"
GOPROXY=""
GORACE=""
GOROOT="/usr/local/go"
GOTMPDIR=""
GOTOOLDIR="/usr/local/go/pkg/tool/linux_amd64"
GCCGO="gccgo"
CC="gcc"
CXX="g++"
CGO_ENABLED="1"
GOMOD=""
CGO_CFLAGS="-g -O2"
CGO_CPPFLAGS=""
CGO_CXXFLAGS="-g -O2"
CGO_FFLAGS="-g -O2"
CGO_LDFLAGS="-g -O2"
PKG_CONFIG="pkg-config"
GOGCCFLAGS="-fPIC -m64 -pthread -fmessage-length=0 -fdebug-prefix-map=/tmp/go-build735453683=/tmp/go-build -gno-record-gcc-switches"
go test -race $(go list ./... | grep -v /vendor/ | grep -v /examples/)
Don't change the version in go.mod
gitlab-runner@it-Z97X-Gaming-3:~/go/src/git.hezi.com/golang/tfy$ go test -race $(go list ./... | grep -v /vendor/ | grep -v /examples/)
go: finding github.com/petermattis/goid latest
go: finding github.com/petermattis/goid latest
go: finding github.com/micro/go-micro/registry/mock latest
go: finding github.com/micro/go-micro/registry latest
.........
```
gitlab-runner@it-Z97X-Gaming-3:~/go/src/git.hezi.com/golang/tfy$ git diff go.mod
module git.hezi.com/golang/tfy
important:
this version of github.com/micro/go-micro change 0.12.0 -> v0.24.0 !
how to fix it?
i find in project https://github.com/micro/examples/blob/master/go.mod
the version of go-micro set under:
github.com/micro/go-micro v0.24.0
I run go mod download the version in ../pkg/mod/.. is v0.12.0 .
next I run go test -race the version in ../pkg/mod/.. is v0.24.0 .
or
I run go mod vendor the version in vendor is v0.24.0,too .
It's very likely that a module you require (either directly, transitively, or implicitly) depends on v0.24.0. This could be due to a package that is only imported in race mode (something imported from a file with // +build race. In general, it is expected that go test will update go.mod if a required module is missing or a newer version is needed.
You can use go mod why github.com/micro/go-micro to understand what package imports something in this module.
You can also use go mod graph to understand the relationships between modules.
You can build / test / list with go test -mod=readonly to prevent go.mod from being written (but it may print an error if the requirements are incomplete or out of date).
If none of those solve the issue, feel free to reopen this issue.
@jayconrod thanks!
i check the code。
the developers use github.com/micro/[email protected] for function s, and use github.com/micro/[email protected] for unit test.
but github.com/micro/[email protected] Depends on the github.com/micro/[email protected]。
when i go test, update the version of github.com/micro/go-micro. so the functions has error!
I have reminded them to revise!
Most helpful comment
It's very likely that a module you require (either directly, transitively, or implicitly) depends on
v0.24.0. This could be due to a package that is only imported in race mode (something imported from a file with// +build race. In general, it is expected thatgo testwill updatego.modif a required module is missing or a newer version is needed.You can use
go mod why github.com/micro/go-microto understand what package imports something in this module.You can also use
go mod graphto understand the relationships between modules.You can build / test / list with
go test -mod=readonlyto preventgo.modfrom being written (but it may print an error if the requirements are incomplete or out of date).If none of those solve the issue, feel free to reopen this issue.