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: tab symbol silently breaks go tags #15193

Closed
aka-rider opened this issue Apr 8, 2016 · 3 comments
Closed

cmd/vet: tab symbol silently breaks go tags #15193

aka-rider opened this issue Apr 8, 2016 · 3 comments
Labels
FrozenDueToAge Suggested Issues that may be good for new contributors looking for work to do.

Comments

@aka-rider
Copy link

Please answer these questions before submitting your issue. Thanks!

  1. What version of Go are you using (go version)?
    1.6
  2. What operating system and processor architecture are you using (go env)?
    All platforms
  3. What did you do?
    Suppose we have a struct with a tags.
    type Foo struct {
        Bar string    `db:"bar" json:"bar"`
    }

If there is a TAB symbol before the json, it makes the json tag unreadable (we get ^Ijson instead).

  1. What did you expect to see?
    • It would be nice to have a warning during go vet run or
    • It might be automatically corrected by the go fmt or
    • go can treat TAB in tags as a whitespace
  2. What did you see instead?
    json tag is silently ignored
@bradfitz bradfitz changed the title Tab symbol silently breaks go tags reflect, cmd/vet: tab symbol silently breaks go tags Apr 8, 2016
@bradfitz bradfitz added this to the Go1.7 milestone Apr 8, 2016
@bradfitz
Copy link
Contributor

bradfitz commented Apr 8, 2016

https://golang.org/pkg/reflect/#StructTag is pretty clear that only space (U+0020 ' ') is valid whitespace, so this is probably a job for cmd/vet.

@bradfitz bradfitz added the Suggested Issues that may be good for new contributors looking for work to do. label Apr 8, 2016
@bradfitz bradfitz changed the title reflect, cmd/vet: tab symbol silently breaks go tags cmd/vet: tab symbol silently breaks go tags Apr 8, 2016
@sergeylanzman
Copy link

It already alerts on tab tags

type Foo struct {
    Bar string `db:"bar"    json:"bar"`
}
go vet
main.go:9: struct field tag `db:"bar"   json:"bar"` not compatible with reflect.StructTag.Get: bad syntax for struct tag key
exit status 1
go version
go version devel +c3b3e7b Fri Apr 8 21:06:39 2016 +0000 darwin/amd64

@bradfitz
Copy link
Contributor

bradfitz commented Apr 8, 2016

Okay, so nothing to do here, then.

@bradfitz bradfitz closed this as completed Apr 8, 2016
@bradfitz bradfitz removed this from the Go1.7 milestone Apr 8, 2016
@golang golang locked and limited conversation to collaborators Apr 9, 2017
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
FrozenDueToAge Suggested Issues that may be good for new contributors looking for work to do.
Projects
None yet
Development

No branches or pull requests

4 participants