cmd/go: provide way to get list of modules without test only modules #28210
Labels
FrozenDueToAge
modules
NeedsInvestigation
Someone must examine and confirm this is a valid issue and not a duplicate of an existing one.
Milestone
What version of Go are you using (
go version
)?go version go1.11.1 linux/amd64
Does this issue reproduce with the latest release?
Yes
What operating system and processor architecture are you using (
go env
)?GOARCH="amd64"
GOBIN="/home/heppu/go/bin"
GOCACHE="/home/heppu/.cache/go-build"
GOEXE=""
GOFLAGS=""
GOHOSTARCH="amd64"
GOHOSTOS="linux"
GOOS="linux"
GOPATH="/home/heppu/go"
GOPROXY=""
GORACE=""
GOROOT="/usr/lib/go"
GOTMPDIR=""
GOTOOLDIR="/usr/lib/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-build661079665=/tmp/go-build -gno-record-gcc-switches"
What did you do?
Tried to list all third party modules with version excluding once that are used only for testing.
What did you expect to see?
Some field that would allow me to exclude modules that are used only for testing like this:
go list -mod=vendor -m -f '{{ if not .TestOnly}}{{.Path}} {{.Version}}{{end}}' ...
What did you see instead?
List of all modules my project uses also including test dependencies for third party modules.
Background
Company I'm working for would like to move from glide to go modules because it allows us to update one dependency at a time and and also define rules like:
Only problem now is that in CI pipe we need to do some checks for these dependencies that end up in final build and with go modules there is currently no easy way to get this information. I did build small tool with using
go/build
to get list of these dependencies and then cross reference that with go.mod but to me it feels like this should be part of tooling it self.The text was updated successfully, but these errors were encountered: