Skip to content

Commit b4ff38a

Browse files
committed
review
1 parent a2373df commit b4ff38a

File tree

3 files changed

+32
-5
lines changed

3 files changed

+32
-5
lines changed

.golangci.reference.yml

+1-1
Original file line numberDiff line numberDiff line change
@@ -1211,7 +1211,7 @@ linters-settings:
12111211

12121212
musttag:
12131213
# A set of custom functions to check in addition to the builtin ones.
1214-
# Default: []
1214+
# Default: json, xml, gopkg.in/yaml.v3, BurntSushi/toml, mitchellh/mapstructure
12151215
functions:
12161216
# The full name of the function, including the package.
12171217
- name: github.com/jmoiron/sqlx.Get

test/testdata/musttag.go

+3-4
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,4 @@
11
//golangcitest:args -Emusttag
2-
//golangcitest:config_path testdata/configs/musttag.yml
32
package testdata
43

54
import (
@@ -9,7 +8,7 @@ import (
98

109
// builtin functions:
1110
func musttagJSON() {
12-
var user struct { // want `\Qexported fields should be annotated with the "json" tag`
11+
var user struct { // want `exported fields should be annotated with the "json" tag`
1312
Name string
1413
Email string `json:"email"`
1514
}
@@ -18,8 +17,8 @@ func musttagJSON() {
1817
}
1918

2019
// custom functions from config:
21-
func musttagCustom() {
22-
var user struct { // want `\Qexported fields should be annotated with the "asn1" tag`
20+
func musttagASN1() {
21+
var user struct {
2322
Name string
2423
Email string `asn1:"email"`
2524
}

test/testdata/musttag_custom.go

+28
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,28 @@
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 { // want `exported fields should be annotated with the "json" tag`
13+
Name string
14+
Email string `json:"email"`
15+
}
16+
json.Marshal(user)
17+
json.Unmarshal(nil, &user)
18+
}
19+
20+
// custom functions from config:
21+
func musttagASN1Custom() {
22+
var user struct { // want `exported fields should be annotated with the "asn1" tag`
23+
Name string
24+
Email string `asn1:"email"`
25+
}
26+
asn1.Marshal(user)
27+
asn1.Unmarshal(nil, &user)
28+
}

0 commit comments

Comments
 (0)