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 doesn't detect duplicate struct tags anymore #17599

Closed
erikdubbelboer opened this issue Oct 26, 2016 · 5 comments
Closed

cmd/vet: go vet doesn't detect duplicate struct tags anymore #17599

erikdubbelboer opened this issue Oct 26, 2016 · 5 comments

Comments

@erikdubbelboer
Copy link
Contributor

Running go vet on the following file:

package main

type A struct {
    A int64 `json:"foo"`
    B int64 `json:"foo"`
}

func test(x int) {
    x = x // Only here to test if go vet is run correctly.
}

Only returns:

test.go:9: self-assignment of x to x

Using:

$ go version
go version go1.7.3 linux/amd64
@erikdubbelboer
Copy link
Contributor Author

Expected:

f.Badf(field.Pos(), "struct field %s repeats %s tag %q also at %s", field.Names[0].Name, key, val, f.loc(pos))

@0xmohit
Copy link
Contributor

0xmohit commented Oct 26, 2016

This is fixed at tip. The change was committed recently.

@erikdubbelboer
Copy link
Contributor Author

@0xmohit I wouldn't call 8 Nov 2015 recently. It used to work but apparently it broke at some point.

@0xmohit
Copy link
Contributor

0xmohit commented Oct 26, 2016

s/committed/merged in #17599 (comment)

The change was merged on Oct 13, 2016. This is the original issue. Doubt if it worked earlier; doesn't work with go 1.6, 1.5, 1.4.

@erikdubbelboer
Copy link
Contributor Author

I had no idea, I thought go vet was already checking this for a while. My mistake.

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

No branches or pull requests

3 participants