-
Notifications
You must be signed in to change notification settings - Fork 2.2k
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
Bugfix: buildFlags="-C directory" is invalid #3380
Conversation
When set buildFlags="-C dir", go build failure. Because the "-C direcotry" option is filled after "go build -o xxx", for example: go build -o main -C /root/main but the "-C dir" option should be filled after "go build": go build -C /root/main -o main in go version 1.20.
I've tried it both ways ( |
(base) ➜ /tmp cd go-example import "fmt" func main(){ go 1.20 |
sorry, I found the bug in debug mode, I haven't try to run |
Looks like a bug in cmd/go, let's see. |
Yes, this is a bug of golang, if fixed, the pr can be closed. |
According to the release notes for 1.21 it looks like
so we should do something about this. However I don't like the approach in this PR, I think it's too complicated and we should just change goBuildArgs to start the args slice with the buildflags string:
|
The -C argument must come first on the command line of 'go build' so pass the flags specified by build-flags first. Replaces go-delve#3380
The -C argument must come first on the command line of 'go build' so pass the flags specified by build-flags first. Replaces go-delve#3380
The -C argument must come first on the command line of 'go build' if the flags specified by the user via build-flags start with -C pass it first. Replaces go-delve#3380
The -C argument must come first on the command line of 'go build' if the flags specified by the user via build-flags start with -C pass it first. Replaces #3380
When set buildFlags="-C dir", go build failure. Because the "-C direcotry" option is filled after "go build -o xxx", for example:
go build -o main -C /root/main
but the "-C dir" option should be filled after "go build":
go build -C /root/main -o main
in go version 1.20.