Repository: segmentio/encoding (go)

Issue:
json: Go 1.16 allows for ; in json tags
https://golang.org/doc/go1.16#encoding/json

```
package main

import (
	"encoding/json"
	"fmt"

	sjson "github.com/segmentio/encoding/json"
)

type S struct {
	F string `json:"a;b"`
}

func main() {
	data := []byte(`{"a;b": "hello"}`)

	var s1 S
	err1 := json.Unmarshal(data, &s1)
	fmt.Printf("stdlib: err=%s s=%s\n", err1, s1)

	var s2 S
	err2 := sjson.Unmarshal(data, &s2)
	fmt.Printf("segment: err=%s s=%s\n", err2, s2)

	if err1 != err2 {
		panic("err mismatch")
	}
	if s1 != s2 {
		panic("value mismatch")
	}
}
```
https://play.golang.com/p/l3RoNt3FYnB

```
~/tmp$ go version && go run main.go
go version go1.16.2 linux/amd64
stdlib: err=%!s(<nil>) s={hello}
segment: err=%!s(<nil>) s={}
panic: value mismatch

goroutine 1 [running]:
main.main()
	/home/thomas/tmp/main.go:29 +0x389
exit status 2
~/tmp$ go1.15 version && go1.15 run main.go
go version go1.15.10 linux/amd64
stdlib: err=%!s(<nil>) s={}
segment: err=%!s(<nil>) s={}
```

Pull request description:
json: accept ; in json field tag
Accept ; in `json` field tag to match the behavior of Go 1.16.

https://go-review.googlesource.com/c/go/+/234818/4/src/encoding/json/encode.go

Fixes #86

Patch:
diff --git a/json/codec.go b/json/codec.go
index 5e06a99..22d35fd 100644
--- a/json/codec.go
+++ b/json/codec.go
@@ -844,7 +844,7 @@ func isValidTag(s string) bool {
 	}
 	for _, c := range s {
 		switch {
-		case strings.ContainsRune("!#$%&()*+-./:<=>?@[]^_{|}~ ", c):
+		case strings.ContainsRune("!#$%&()*+-./:;<=>?@[]^_{|}~ ", c):
 			// Backslash and quote chars are reserved, but
 			// otherwise any punctuation chars are allowed
 			// in a tag name.


Test patch:
diff --git a/json/golang_tagkey_test.go b/json/golang_tagkey_test.go
index f77c49c..17d4c03 100644
--- a/json/golang_tagkey_test.go
+++ b/json/golang_tagkey_test.go
@@ -41,7 +41,7 @@ type percentSlashTag struct {
 }
 
 type punctuationTag struct {
-	V string `json:"!#$%&()*+-./:<=>?@[]^_{|}~"` // https://golang.org/issue/3546
+	V string `json:"!#$%&()*+-./:;<=>?@[]^_{|}~"` // https://golang.org/issue/3546
 }
 
 type dashTag struct {
@@ -90,7 +90,7 @@ var structTagObjectKeyTests = []struct {
 	{badFormatTag{"Orfevre"}, "Orfevre", "Y"},
 	{badCodeTag{"Reliable Man"}, "Reliable Man", "Z"},
 	{percentSlashTag{"brut"}, "brut", "text/html%"},
-	{punctuationTag{"Union Rags"}, "Union Rags", "!#$%&()*+-./:<=>?@[]^_{|}~"},
+	{punctuationTag{"Union Rags"}, "Union Rags", "!#$%&()*+-./:;<=>?@[]^_{|}~"},
 	{spaceTag{"Perreddu"}, "Perreddu", "With space"},
 	{unicodeTag{"Loukanikos"}, "Loukanikos", "Ελλάδα"},
 }