Tom 3cc6373117
feat: add musttag linter (#3386)
Co-authored-by: Fernandez Ludovic <ldez@users.noreply.github.com>
2023-01-21 12:36:35 +00:00

28 lines
492 B
Go

//golangcitest:args -Emusttag
package testdata
import (
"encoding/asn1"
"encoding/json"
)
// builtin functions:
func musttagJSON() {
var user struct { // want `exported fields should be annotated with the "json" tag`
Name string
Email string `json:"email"`
}
json.Marshal(user)
json.Unmarshal(nil, &user)
}
// custom functions from config:
func musttagASN1() {
var user struct {
Name string
Email string `asn1:"email"`
}
asn1.Marshal(user)
asn1.Unmarshal(nil, &user)
}