Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

cmd/go: go test -c does not accept -o $dir #58162

Closed
bcmills opened this issue Jan 31, 2023 · 4 comments
Closed

cmd/go: go test -c does not accept -o $dir #58162

bcmills opened this issue Jan 31, 2023 · 4 comments
Labels
FrozenDueToAge GoCommand cmd/go help wanted NeedsFix The path to resolution is known, but the work has not been done.
Milestone

Comments

@bcmills
Copy link
Contributor

bcmills commented Jan 31, 2023

Since Go 1.14 (#14295), go build -o $dir ./... has allowed one to build multiple packages and write their executables to a directory.

Since go test -c is closely analogous to go build, I expected it to be able to do the same. However, it does not:

~/src/golang.org/x/mod$ go build -o "$(mktemp -d)/" ./...

~/src/golang.org/x/mod$ go test -c -o "$(mktemp -d)/" ./...
cannot use -c flag with multiple packages
~/src/golang.org/x/mod$ go version
go version devel go1.21-a106defdda Fri Jan 27 15:28:30 2023 +0000 linux/amd64

~/src/golang.org/x/mod$ go env
GO111MODULE=""
GOARCH="amd64"
GOBIN=""
GOCACHE="/usr/local/google/home/bcmills/.cache/go-build"
GOENV="/usr/local/google/home/bcmills/.config/go/env"
GOEXE=""
GOEXPERIMENT=""
GOFLAGS=""
GOHOSTARCH="amd64"
GOHOSTOS="linux"
GOINSECURE=""
GOMODCACHE="/usr/local/google/home/bcmills/pkg/mod"
GONOPROXY=""
GONOSUMDB=""
GOOS="linux"
GOPATH="/usr/local/google/home/bcmills"
GOPRIVATE=""
GOPROXY="https://proxy.golang.org,direct"
GOROOT="/usr/local/google/home/bcmills/go"
GOSUMDB="sum.golang.org"
GOTMPDIR=""
GOTOOLDIR="/usr/local/google/home/bcmills/go/pkg/tool/linux_amd64"
GOVCS=""
GOVERSION="devel go1.21-a106defdda Fri Jan 27 15:28:30 2023 +0000"
GCCGO="/usr/local/google/home/bcmills/bin/gccgo"
GOAMD64="v1"
AR="ar"
CC="gcc"
CXX="c++"
CGO_ENABLED="1"
GOMOD="/usr/local/google/home/bcmills/src/golang.org/x/mod/go.mod"
GOWORK=""
CGO_CFLAGS="-O2 -g"
CGO_CPPFLAGS=""
CGO_CXXFLAGS="-O2 -g"
CGO_FFLAGS="-O2 -g"
CGO_LDFLAGS="-O2 -g"
PKG_CONFIG="pkg-config"
GOGCCFLAGS="-fPIC -m64 -pthread -Wl,--no-gc-sections -fmessage-length=0 -fdebug-prefix-map=/tmp/go-build2157072955=/tmp/go-build -gno-record-gcc-switches"
@bcmills
Copy link
Contributor Author

bcmills commented Jan 31, 2023

The same holds for os.DevNull:

~/src/golang.org/x/mod$ go build -o /dev/null ./...

~/src/golang.org/x/mod$ go test -c -o /dev/null ./...
cannot use -c flag with multiple packages

@bcmills bcmills added help wanted NeedsFix The path to resolution is known, but the work has not been done. GoCommand cmd/go labels Jan 31, 2023
@bcmills bcmills added this to the Backlog milestone Jan 31, 2023
@maksadbek
Copy link
Contributor

@bcmills
Should the -o $dir flag generate one executable file for all packages or multiple executables for each package ?

@seankhliao
Copy link
Member

dup of #15513 ?

@bcmills
Copy link
Contributor Author

bcmills commented Feb 2, 2023

Duplicate of #15513

@bcmills bcmills marked this as a duplicate of #15513 Feb 2, 2023
@bcmills bcmills closed this as not planned Won't fix, can't repro, duplicate, stale Feb 2, 2023
@golang golang locked and limited conversation to collaborators Feb 2, 2024
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
FrozenDueToAge GoCommand cmd/go help wanted NeedsFix The path to resolution is known, but the work has not been done.
Projects
None yet
Development

No branches or pull requests

4 participants