go: cmd/go: get -u -t fails to update go.mod when "no non-test Go files in path"
What version of Go are you using (go version
)?
$ go version go version go1.15.3 linux/amd64
Does this issue reproduce with the latest release?
Did not test on the latest version.
What operating system and processor architecture are you using (go env
)?
go env
Output
$ go env GO111MODULE="" GOARCH="amd64" GOBIN="" GOCACHE="/home/kbalk/.cache/go-build" GOENV="/home/kbalk/.config/go/env" GOEXE="" GOFLAGS="" GOHOSTARCH="amd64" GOHOSTOS="linux" GOINSECURE="" GOMODCACHE="/home/kbalk/go/pkg/mod" GONOPROXY="" GONOSUMDB="" GOOS="linux" GOPATH="/home/kbalk/go" GOPRIVATE="" GOPROXY="https://proxy.golang.org,direct" GOROOT="/usr/local/go" GOSUMDB="sum.golang.org" GOTMPDIR="" GOTOOLDIR="/usr/local/go/pkg/tool/linux_amd64" GCCGO="gccgo" AR="ar" CC="gcc" CXX="g++" CGO_ENABLED="1" GOMOD="/home/kbalk/plus3it/terraform-aws-org-new-account-iam-role/tests/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 -m64 -pthread -fmessage-length=0 -fdebug-prefix-map=/tmp/go-build005428471=/tmp/go-build -gno-record-gcc-switches"
What did you do?
I have a Go module (module_test.go
) for testing a Terraform init/plan/apply. All I have and need in terms of programming is this single go
file with a package name of testing
. I have a go.mod
file as shown below. The directory tardigrade-ci/tests
mentioned in go.mod
will contain module_test.go
, go.mod
, go.sum
and some Terraform files.
I ran go get -u -t
to get updated versions in go.mod
. In particular, github.com/stretchr/testify
had released an updated version.
module tardigarde-ci/tests
go 1.15
require (
github.com/gruntwork-io/terratest v0.32.8
github.com/stretchr/testify v1.6.1
golang.org/x/net v0.0.0-20201021035429-f5854403a974 // indirect
golang.org/x/sys v0.0.0-20210119212857-b64e53b001e4 // indirect
)
replace github.com/gruntwork-io/terratest v0.32.8 => github.com/ffernandezcast/terratest v0.28.6-0.20201201084725-13e8a4c156b8
What did you expect to see?
Updated version for github.com/stretchr/testify
; instead of v1.6.1, expected to see v1.7.0.
What did you see instead?
go.mod
file was unchanged. Will updates to go.mod
only occur when there are non-test files?
Note: I also tried running go clean -modcache
, then running go get -u -t
and that had no effect.
About this issue
- Original URL
- State: closed
- Created 3 years ago
- Comments: 15 (9 by maintainers)
This invocation is missing the
-d
flag.go get -u -t
requests that thego
command do all of:This command is failing in step (2), which causes the overall operation to fail. In CL 255970 (for #41315), we decided that we should only update the
go.mod
file if thego get
command overall succeeds.The
-d
flag explicitly requests to skip step (2). If that is done here, the dependencies of the (named or implicit) test-only package should be updated as requested.