Navigation Menu

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: -o option to go build not accepted at end #40402

Closed
kjk opened this issue Jul 25, 2020 · 7 comments
Closed

cmd/go: -o option to go build not accepted at end #40402

kjk opened this issue Jul 25, 2020 · 7 comments
Labels
FrozenDueToAge NeedsInvestigation Someone must examine and confirm this is a valid issue and not a duplicate of an existing one. OS-Windows WaitingForInfo Issue is not actionable because of missing required information, which needs to be provided.
Milestone

Comments

@kjk
Copy link

kjk commented Jul 25, 2020

What version of Go are you using (go version)?

$ go version
go version go1.14.4 windows/amd64

Does this issue reproduce with the latest release?

Yes.

What operating system and processor architecture are you using (go env)?

go env Output
$ go env
set GO111MODULE=
set GOARCH=amd64
set GOBIN=
set GOCACHE=C:\Users\kjk\AppData\Local\go-build
set GOENV=C:\Users\kjk\AppData\Roaming\go\env
set GOEXE=.exe
set GOFLAGS=
set GOHOSTARCH=amd64
set GOHOSTOS=windows
set GOINSECURE=
set GONOPROXY=
set GONOSUMDB=
set GOOS=windows
set GOPATH=C:\Users\kjk\go
set GOPRIVATE=
set GOPROXY=direct
set GOROOT=c:\go
set GOSUMDB=sum.golang.org
set GOTMPDIR=
set GOTOOLDIR=c:\go\pkg\tool\windows_amd64
set GCCGO=gccgo
set AR=ar
set CC=gcc
set CXX=g++
set CGO_ENABLED=1
set GOMOD=
set CGO_CFLAGS=-g -O2
set CGO_CPPFLAGS=
set CGO_CXXFLAGS=-g -O2
set CGO_FFLAGS=-g -O2
set CGO_LDFLAGS=-g -O2
set PKG_CONFIG=pkg-config
set GOGCCFLAGS=-m64 -mthreads -fno-caret-diagnostics -Qunused-arguments -fmessage-length=0 -fdebug-prefix-map=C:\Users\kjk\AppData\Local\Temp\go-build301216802=/tmp/go-build -gno-record-gcc-switches

What did you do?

This used to work (in 1.13, I think) but fails in 1.14.4:

> go.exe build -tags api -trimpath  -o ..\presstige_api.exe .
can't load package: package -o is not in GOROOT (c:\go\src\-o)
can't load package: package ../presstige_api.exe: cannot find package "." in:
        C:\Users\kjk\src\presstige\presstige_api.exe

Note: If I do go build -o ... it works.

Maybe putting -o option at end was never supposed to work but it is a regression.

@seankhliao

This comment has been minimized.

@jtarchie
Copy link

@seankhliao it looks like the report does have packages, the last . there.

@seankhliao
Copy link
Member

ahh, in that case 🤷 The same command still works on linux

@cagedmantis cagedmantis changed the title -o option to go build not accepted at end cmd/go: -o option to go build not accepted at end Jul 27, 2020
@cagedmantis cagedmantis added this to the Backlog milestone Jul 27, 2020
@cagedmantis cagedmantis added the NeedsInvestigation Someone must examine and confirm this is a valid issue and not a duplicate of an existing one. label Jul 27, 2020
@cagedmantis
Copy link
Contributor

/cc @bcmills @jayconrod @matloob

@bcmills
Copy link
Contributor

bcmills commented Jul 30, 2020

I can only reproduce this on Linux if I add an explicit empty-string argument to the -trimpath flag.

example.com$ go build -tags api -trimpath  -o ..\whatever.exe .

example.com$ go build -tags api -trimpath '' -o ..\whatever.exe .
go: finding module for package ..whatever.exe
package -o is not in GOROOT (/usr/local/google/home/bcmills/sdk/gotip/src/-o)
malformed module path "..whatever.exe": leading dot in path element

@bcmills
Copy link
Contributor

bcmills commented Jul 30, 2020

@kjk, does this still reproduce for you if you remove the doubled space after the -trimpath flag?

@jayconrod jayconrod added the WaitingForInfo Issue is not actionable because of missing required information, which needs to be provided. label Aug 3, 2020
@gopherbot
Copy link

Timed out in state WaitingForInfo. Closing.

(I am just a bot, though. Please speak up if this is a mistake or you have the requested information.)

@golang golang locked and limited conversation to collaborators Sep 3, 2021
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
FrozenDueToAge NeedsInvestigation Someone must examine and confirm this is a valid issue and not a duplicate of an existing one. OS-Windows WaitingForInfo Issue is not actionable because of missing required information, which needs to be provided.
Projects
None yet
Development

No branches or pull requests

7 participants