Skip to content

cmd/go: get -u -t fails to update go.mod when "no non-test Go files in path" #45112

@kbalk

Description

@kbalk

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.

Metadata

Metadata

Assignees

No one assigned

    Labels

    FrozenDueToAgeNeedsInvestigationSomeone must examine and confirm this is a valid issue and not a duplicate of an existing one.modules

    Type

    No type

    Projects

    No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions