Skip to content

Commit 490b37d

Browse files
authored
docs: enhance struct-tag rule description (#1512)
1 parent 4d5fd51 commit 490b37d

File tree

1 file changed

+25
-5
lines changed

1 file changed

+25
-5
lines changed

RULES_DESCRIPTIONS.md

Lines changed: 25 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1228,13 +1228,33 @@ _Configuration_: N/A
12281228

12291229
## struct-tag
12301230

1231-
_Description_: Struct tags are not checked at compile time.
1232-
This rule spots errors in struct tags of the following types:
1233-
asn1, bson, datastore, default, json, mapstructure, properties, protobuf, required, spanner, toml, url, validate, xml, yaml.
1234-
1235-
_Configuration_: (optional) list of user defined options.
1231+
_Description_: The rule spots errors in struct tags.
1232+
This is useful because struct tags are not checked at compile time.
1233+
1234+
The list of [supported tags](https://go.dev/wiki/Well-known-struct-tags):
1235+
1236+
| Tag | Documentation |
1237+
| ------------- | ------------------------------------------------------------------------ |
1238+
| `asn1` | <https://pkg.go.dev/encoding/asn1> |
1239+
| `bson` | <https://pkg.go.dev/go.mongodb.org/mongo-driver/bson> |
1240+
| `datastore` | <https://pkg.go.dev/cloud.google.com/go/datastore> |
1241+
| `default` | The type of "default" must match the type of the field. |
1242+
| `json` | <https://pkg.go.dev/encoding/json> |
1243+
| `mapstructure` | <https://pkg.go.dev/github.com/mitchellh/mapstructure> |
1244+
| `properties` | <https://pkg.go.dev/github.com/magiconair/properties#Properties.Decode> |
1245+
| `protobuf` | <https://github.com/golang/protobuf> |
1246+
| `required` | Should be only "true" or "false". |
1247+
| `spanner` | <https://pkg.go.dev/cloud.google.com/go/spanner> |
1248+
| `toml` | <https://pkg.go.dev/github.com/pelletier/go-toml/v2> |
1249+
| `url` | <https://github.com/google/go-querystring> |
1250+
| `validate` | <https://github.com/go-playground/validator> |
1251+
| `xml` | <https://pkg.go.dev/encoding/xml> |
1252+
| `yaml` | <https://pkg.go.dev/gopkg.in/yaml.v2> |
1253+
1254+
_Configuration_: (optional) The list of struct tags that can be accepted by the rule additionally to the supported tags.
12361255

12371256
Configuration example:
1257+
12381258
To accept the `inline` option in JSON tags (and `outline` and `gnu` in BSON tags) you must provide the following configuration
12391259

12401260
```toml

0 commit comments

Comments
 (0)