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/vet: go vet incorrectly romalformed struct tags #9784

Closed
davecgh opened this issue Feb 5, 2015 · 1 comment

Comments

Projects
None yet
3 participants
@davecgh
Copy link

commented Feb 5, 2015

The latest version of go vet (go 1.4.1 with latest tools repo commit golang/tools@913f41f) is incorrectly reporting malformed struct tags when one of the tag values contains spaces.

Here is a minimal set of steps to reproduce the issue:

$ mkdir $GOPATH/src/govetissue
$ cd $GOPATH/src/govetissue
$ cat > main.go  <<END
package main

type foo struct {
    A int \`short:"V" description:"Test description"\`
}

func main() {
}
END
$ go vet

Output:

/home/davec/mygo/src/govetissue/main.go:4: struct field tag short:"V" description:"Test description" not compatible with reflect.StructTag.Get: bad syntax for struct tag value
exit status 1

Removing the space inside the quoted value for the description (i.e. TestDescription) does not report the error, but clearly that is not the intended behavior.

I've reproduced this issue with Windows, Linux, and OpenBSD.

@minux

This comment has been minimized.

Copy link
Member

commented Feb 5, 2015

This is #9500 (comment).

At least two fixes are being reviewed.

@minux minux closed this Feb 5, 2015

@golang golang locked and limited conversation to collaborators Jun 25, 2016

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
You can’t perform that action at this time.