@@ -3,34 +3,144 @@ package musttag
3
3
// builtins is a set of functions supported out of the box.
4
4
var builtins = []Func {
5
5
// https://pkg.go.dev/encoding/json
6
- {Name : "encoding/json.Marshal" , Tag : "json" , ArgPos : 0 },
7
- {Name : "encoding/json.MarshalIndent" , Tag : "json" , ArgPos : 0 },
8
- {Name : "encoding/json.Unmarshal" , Tag : "json" , ArgPos : 1 },
9
- {Name : "(*encoding/json.Encoder).Encode" , Tag : "json" , ArgPos : 0 },
10
- {Name : "(*encoding/json.Decoder).Decode" , Tag : "json" , ArgPos : 0 },
6
+ {
7
+ Name : "encoding/json.Marshal" ,
8
+ Tag : "json" ,
9
+ ArgPos : 0 ,
10
+ ifaceWhitelist : []string {"encoding/json.Marshaler" , "encoding.TextMarshaler" },
11
+ },
12
+ {
13
+ Name : "encoding/json.MarshalIndent" ,
14
+ Tag : "json" ,
15
+ ArgPos : 0 ,
16
+ ifaceWhitelist : []string {"encoding/json.Marshaler" , "encoding.TextMarshaler" },
17
+ },
18
+ {
19
+ Name : "encoding/json.Unmarshal" ,
20
+ Tag : "json" ,
21
+ ArgPos : 1 ,
22
+ ifaceWhitelist : []string {"encoding/json.Unmarshaler" , "encoding.TextUnmarshaler" },
23
+ },
24
+ {
25
+ Name : "(*encoding/json.Encoder).Encode" ,
26
+ Tag : "json" ,
27
+ ArgPos : 0 ,
28
+ ifaceWhitelist : []string {"encoding/json.Marshaler" , "encoding.TextMarshaler" },
29
+ },
30
+ {
31
+ Name : "(*encoding/json.Decoder).Decode" ,
32
+ Tag : "json" ,
33
+ ArgPos : 0 ,
34
+ ifaceWhitelist : []string {"encoding/json.Unmarshaler" , "encoding.TextUnmarshaler" },
35
+ },
11
36
12
37
// https://pkg.go.dev/encoding/xml
13
- {Name : "encoding/xml.Marshal" , Tag : "xml" , ArgPos : 0 },
14
- {Name : "encoding/xml.MarshalIndent" , Tag : "xml" , ArgPos : 0 },
15
- {Name : "encoding/xml.Unmarshal" , Tag : "xml" , ArgPos : 1 },
16
- {Name : "(*encoding/xml.Encoder).Encode" , Tag : "xml" , ArgPos : 0 },
17
- {Name : "(*encoding/xml.Decoder).Decode" , Tag : "xml" , ArgPos : 0 },
18
- {Name : "(*encoding/xml.Encoder).EncodeElement" , Tag : "xml" , ArgPos : 0 },
19
- {Name : "(*encoding/xml.Decoder).DecodeElement" , Tag : "xml" , ArgPos : 0 },
38
+ {
39
+ Name : "encoding/xml.Marshal" ,
40
+ Tag : "xml" ,
41
+ ArgPos : 0 ,
42
+ ifaceWhitelist : []string {"encoding/xml.Marshaler" , "encoding.TextMarshaler" },
43
+ },
44
+ {
45
+ Name : "encoding/xml.MarshalIndent" ,
46
+ Tag : "xml" ,
47
+ ArgPos : 0 ,
48
+ ifaceWhitelist : []string {"encoding/xml.Marshaler" , "encoding.TextMarshaler" },
49
+ },
50
+ {
51
+ Name : "encoding/xml.Unmarshal" ,
52
+ Tag : "xml" ,
53
+ ArgPos : 1 ,
54
+ ifaceWhitelist : []string {"encoding/xml.Unmarshaler" , "encoding.TextUnmarshaler" },
55
+ },
56
+ {
57
+ Name : "(*encoding/xml.Encoder).Encode" ,
58
+ Tag : "xml" ,
59
+ ArgPos : 0 ,
60
+ ifaceWhitelist : []string {"encoding/xml.Marshaler" , "encoding.TextMarshaler" },
61
+ },
62
+ {
63
+ Name : "(*encoding/xml.Decoder).Decode" ,
64
+ Tag : "xml" ,
65
+ ArgPos : 0 ,
66
+ ifaceWhitelist : []string {"encoding/xml.Unmarshaler" , "encoding.TextUnmarshaler" },
67
+ },
68
+ {
69
+ Name : "(*encoding/xml.Encoder).EncodeElement" ,
70
+ Tag : "xml" ,
71
+ ArgPos : 0 ,
72
+ ifaceWhitelist : []string {"encoding/xml.Marshaler" , "encoding.TextMarshaler" },
73
+ },
74
+ {
75
+ Name : "(*encoding/xml.Decoder).DecodeElement" ,
76
+ Tag : "xml" ,
77
+ ArgPos : 0 ,
78
+ ifaceWhitelist : []string {"encoding/xml.Unmarshaler" , "encoding.TextUnmarshaler" },
79
+ },
20
80
21
81
// https://github.com/go-yaml/yaml
22
- {Name : "gopkg.in/yaml.v3.Marshal" , Tag : "yaml" , ArgPos : 0 },
23
- {Name : "gopkg.in/yaml.v3.Unmarshal" , Tag : "yaml" , ArgPos : 1 },
24
- {Name : "(*gopkg.in/yaml.v3.Encoder).Encode" , Tag : "yaml" , ArgPos : 0 },
25
- {Name : "(*gopkg.in/yaml.v3.Decoder).Decode" , Tag : "yaml" , ArgPos : 0 },
82
+ {
83
+ Name : "gopkg.in/yaml.v3.Marshal" ,
84
+ Tag : "yaml" ,
85
+ ArgPos : 0 ,
86
+ ifaceWhitelist : []string {"gopkg.in/yaml.v3.Marshaler" },
87
+ },
88
+ {
89
+ Name : "gopkg.in/yaml.v3.Unmarshal" ,
90
+ Tag : "yaml" ,
91
+ ArgPos : 1 ,
92
+ ifaceWhitelist : []string {"gopkg.in/yaml.v3.Unmarshaler" },
93
+ },
94
+ {
95
+ Name : "(*gopkg.in/yaml.v3.Encoder).Encode" ,
96
+ Tag : "yaml" ,
97
+ ArgPos : 0 ,
98
+ ifaceWhitelist : []string {"gopkg.in/yaml.v3.Marshaler" },
99
+ },
100
+ {
101
+ Name : "(*gopkg.in/yaml.v3.Decoder).Decode" ,
102
+ Tag : "yaml" ,
103
+ ArgPos : 0 ,
104
+ ifaceWhitelist : []string {"gopkg.in/yaml.v3.Unmarshaler" },
105
+ },
26
106
27
107
// https://github.com/BurntSushi/toml
28
- {Name : "github.com/BurntSushi/toml.Unmarshal" , Tag : "toml" , ArgPos : 1 },
29
- {Name : "github.com/BurntSushi/toml.Decode" , Tag : "toml" , ArgPos : 1 },
30
- {Name : "github.com/BurntSushi/toml.DecodeFS" , Tag : "toml" , ArgPos : 2 },
31
- {Name : "github.com/BurntSushi/toml.DecodeFile" , Tag : "toml" , ArgPos : 1 },
32
- {Name : "(*github.com/BurntSushi/toml.Encoder).Encode" , Tag : "toml" , ArgPos : 0 },
33
- {Name : "(*github.com/BurntSushi/toml.Decoder).Decode" , Tag : "toml" , ArgPos : 0 },
108
+ {
109
+ Name : "github.com/BurntSushi/toml.Unmarshal" ,
110
+ Tag : "toml" ,
111
+ ArgPos : 1 ,
112
+ ifaceWhitelist : []string {"github.com/BurntSushi/toml.Unmarshaler" , "encoding.TextUnmarshaler" },
113
+ },
114
+ {
115
+ Name : "github.com/BurntSushi/toml.Decode" ,
116
+ Tag : "toml" ,
117
+ ArgPos : 1 ,
118
+ ifaceWhitelist : []string {"github.com/BurntSushi/toml.Unmarshaler" , "encoding.TextUnmarshaler" },
119
+ },
120
+ {
121
+ Name : "github.com/BurntSushi/toml.DecodeFS" ,
122
+ Tag : "toml" ,
123
+ ArgPos : 2 ,
124
+ ifaceWhitelist : []string {"github.com/BurntSushi/toml.Unmarshaler" , "encoding.TextUnmarshaler" },
125
+ },
126
+ {
127
+ Name : "github.com/BurntSushi/toml.DecodeFile" ,
128
+ Tag : "toml" ,
129
+ ArgPos : 1 ,
130
+ ifaceWhitelist : []string {"github.com/BurntSushi/toml.Unmarshaler" , "encoding.TextUnmarshaler" },
131
+ },
132
+ {
133
+ Name : "(*github.com/BurntSushi/toml.Encoder).Encode" ,
134
+ Tag : "toml" ,
135
+ ArgPos : 0 ,
136
+ ifaceWhitelist : []string {"encoding.TextMarshaler" },
137
+ },
138
+ {
139
+ Name : "(*github.com/BurntSushi/toml.Decoder).Decode" ,
140
+ Tag : "toml" ,
141
+ ArgPos : 0 ,
142
+ ifaceWhitelist : []string {"github.com/BurntSushi/toml.Unmarshaler" , "encoding.TextUnmarshaler" },
143
+ },
34
144
35
145
// https://github.com/mitchellh/mapstructure
36
146
{Name : "github.com/mitchellh/mapstructure.Decode" , Tag : "mapstructure" , ArgPos : 1 },
0 commit comments