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: build fails parsing flags values #22943

Closed
tophj-ibm opened this issue Nov 30, 2017 · 3 comments
Closed

cmd/go: build fails parsing flags values #22943

tophj-ibm opened this issue Nov 30, 2017 · 3 comments
Labels
FrozenDueToAge NeedsInvestigation Someone must examine and confirm this is a valid issue and not a duplicate of an existing one. release-blocker
Milestone

Comments

@tophj-ibm
Copy link

Hi. There seems to be a regression where flag values aren't being parsed correctly, leading to the build failing if you have any extra characters other than the flag. See below

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

Latest master

Does this issue reproduce with the latest release?

No (1.9.2)

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

GOARCH="amd64"
GOBIN=""
GOEXE=""
GOHOSTARCH="amd64"
GOHOSTOS="linux"
GOOS="linux"
GOPATH="/go"
GORACE=""
GOROOT="/usr/local/go"
GOTOOLDIR="/usr/local/go/pkg/tool/linux_amd64"
GCCGO="gccgo"
CC="gcc"
GOGCCFLAGS="-fPIC -m64 -pthread -fmessage-length=0 -fdebug-prefix-map=/tmp/go-build258921016=/tmp/go-build -gno-record-gcc-switches"
CXX="g++"
CGO_ENABLED="1"
CGO_CFLAGS="-g -O2"
CGO_CPPFLAGS=""
CGO_CXXFLAGS="-g -O2"
CGO_FFLAGS="-g -O2"
CGO_LDFLAGS="-g -O2"
PKG_CONFIG="pkg-config"

What did you do?

build.sh

go build \
	-gcflags "
		-v" \
	test.go

test.go

package main

import "fmt"

func main() {
	fmt.Println("vim-go")
}

What did you expect to see?

Successful build.

$ ./build.sh 
$ 

What did you see instead?

$ ./build.sh 
invalid value "\n\t\t-v" for flag -gcflags: missing =<value> in <pattern>=<value>
usage: build [-o output] [-i] [build flags] [packages]
Run 'go help build' for details.

Looks like the new implementation doesn't trim/ ignore tabs, spaces, newlines, etc.

I've narrowed the commit down to the flag changes in 5993251

@ianlancetaylor ianlancetaylor added this to the Go1.10 milestone Nov 30, 2017
@ianlancetaylor ianlancetaylor added NeedsInvestigation Someone must examine and confirm this is a valid issue and not a duplicate of an existing one. release-blocker labels Nov 30, 2017
@ianlancetaylor
Copy link
Contributor

CC @rsc

@gopherbot
Copy link

Change https://golang.org/cl/81498 mentions this issue: cmd/go: accept more spaces in -gcflags arguments

@tophj-ibm
Copy link
Author

thanks, all!

@golang golang locked and limited conversation to collaborators Dec 1, 2018
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. release-blocker
Projects
None yet
Development

No branches or pull requests

3 participants