github.com/vanstinator/golangci-lint@v0.0.0-20240223191551-cc572f00d9d1/test/testdata/musttag_custom.go (about) 1 //golangcitest:args -Emusttag 2 //golangcitest:config_path testdata/configs/musttag.yml 3 package testdata 4 5 import ( 6 "encoding/asn1" 7 "encoding/json" 8 ) 9 10 // builtin functions: 11 func musttagJSONCustom() { 12 var user struct { 13 Name string 14 Email string `json:"email"` 15 } 16 json.Marshal(user) // want "the given struct should be annotated with the `json` tag" 17 } 18 19 // custom functions from config: 20 func musttagASN1Custom() { 21 var user struct { 22 Name string 23 Email string `asn1:"email"` 24 } 25 asn1.Marshal(user) // want "the given struct should be annotated with the `asn1` tag" 26 }