diff options
author | Martin Czygan <martin.czygan@gmail.com> | 2021-04-16 00:17:58 +0200 |
---|---|---|
committer | Martin Czygan <martin.czygan@gmail.com> | 2021-04-19 20:29:17 +0200 |
commit | 4777c2014f0d770a5c1947f86bf7f8244856a598 (patch) | |
tree | 7d8ce3527a36a6046ddccc0e1a3fa33fe1773418 | |
parent | 50c4efb3c408b98c2fb7a4e40a92a6c34ef226d0 (diff) | |
download | refcat-4777c2014f0d770a5c1947f86bf7f8244856a598.tar.gz refcat-4777c2014f0d770a5c1947f86bf7f8244856a598.zip |
switch to github.com/segmentio/encoding/json
-rw-r--r-- | skate/cluster.go | 3 | ||||
-rw-r--r-- | skate/cmd/skate-bref-id/main.go | 3 | ||||
-rw-r--r-- | skate/cmd/skate-derive-key/main.go | 3 | ||||
-rw-r--r-- | skate/cmd/skate-from-unstructured/main.go | 3 | ||||
-rw-r--r-- | skate/cmd/skate-ref-to-release/main.go | 5 | ||||
-rw-r--r-- | skate/cmd/skate-verify/main.go | 3 | ||||
-rw-r--r-- | skate/cmd/skate-wikipedia-doi/main.go | 3 | ||||
-rw-r--r-- | skate/go.mod | 1 | ||||
-rw-r--r-- | skate/go.sum | 4 | ||||
-rw-r--r-- | skate/verify.go | 1 | ||||
-rw-r--r-- | skate/verify_test.go | 2 |
11 files changed, 15 insertions, 16 deletions
diff --git a/skate/cluster.go b/skate/cluster.go index bec8154..7fc4e1b 100644 --- a/skate/cluster.go +++ b/skate/cluster.go @@ -4,7 +4,7 @@ import ( "regexp" "strings" - jsoniter "github.com/json-iterator/go" + json "github.com/segmentio/encoding/json" "golang.org/x/text/unicode/norm" ) @@ -12,7 +12,6 @@ import ( type IdentifierKeyFunc func([]byte) (string, string, error) var ( - json = jsoniter.ConfigCompatibleWithStandardLibrary wsReplacer = strings.NewReplacer("\t", " ", "\n", " ") repeatedWs = regexp.MustCompile(`[ ]{2,}`) nonWord = regexp.MustCompile(`[\W]+`) diff --git a/skate/cmd/skate-bref-id/main.go b/skate/cmd/skate-bref-id/main.go index 21e1e9e..fd2431d 100644 --- a/skate/cmd/skate-bref-id/main.go +++ b/skate/cmd/skate-bref-id/main.go @@ -11,13 +11,12 @@ import ( "git.archive.org/martin/cgraph/skate" "git.archive.org/martin/cgraph/skate/parallel" - jsoniter "github.com/json-iterator/go" + json "github.com/segmentio/encoding/json" ) var ( numWorkers = flag.Int("w", runtime.NumCPU(), "number of workers") batchSize = flag.Int("b", 100000, "batch size") - json = jsoniter.ConfigCompatibleWithStandardLibrary newlineB = []byte("\n") ) diff --git a/skate/cmd/skate-derive-key/main.go b/skate/cmd/skate-derive-key/main.go index 25f6b8a..df44b70 100644 --- a/skate/cmd/skate-derive-key/main.go +++ b/skate/cmd/skate-derive-key/main.go @@ -30,7 +30,7 @@ import ( "git.archive.org/martin/cgraph/skate" "git.archive.org/martin/cgraph/skate/parallel" - jsoniter "github.com/json-iterator/go" + json "github.com/segmentio/encoding/json" ) var ( @@ -52,7 +52,6 @@ var ( } keyFunc skate.IdentifierKeyFunc ok bool - json = jsoniter.ConfigCompatibleWithStandardLibrary ) func main() { diff --git a/skate/cmd/skate-from-unstructured/main.go b/skate/cmd/skate-from-unstructured/main.go index 8ebc613..2c6e81f 100644 --- a/skate/cmd/skate-from-unstructured/main.go +++ b/skate/cmd/skate-from-unstructured/main.go @@ -12,13 +12,12 @@ import ( "git.archive.org/martin/cgraph/skate" "git.archive.org/martin/cgraph/skate/parallel" - jsoniter "github.com/json-iterator/go" + json "github.com/segmentio/encoding/json" ) var ( numWorkers = flag.Int("w", runtime.NumCPU(), "number of workers") batchSize = flag.Int("b", 100000, "batch size") - json = jsoniter.ConfigCompatibleWithStandardLibrary bytesNewline = []byte("\n") PatDOI = regexp.MustCompile(`10[.][0-9]{1,8}/[^ ]*[\w]`) diff --git a/skate/cmd/skate-ref-to-release/main.go b/skate/cmd/skate-ref-to-release/main.go index 0eec40b..d547e62 100644 --- a/skate/cmd/skate-ref-to-release/main.go +++ b/skate/cmd/skate-ref-to-release/main.go @@ -9,10 +9,10 @@ import ( "runtime" "strings" - "github.com/miku/parallel" "git.archive.org/martin/cgraph/skate" + "github.com/miku/parallel" - jsoniter "github.com/json-iterator/go" + json "github.com/segmentio/encoding/json" ) var ( @@ -20,7 +20,6 @@ var ( batchSize = flag.Int("b", 100000, "batch size") fromFormat = flag.String("f", "ref", "import data shape") - json = jsoniter.ConfigCompatibleWithStandardLibrary bytesNewline = []byte("\n") ) diff --git a/skate/cmd/skate-verify/main.go b/skate/cmd/skate-verify/main.go index 19146c9..3b40488 100644 --- a/skate/cmd/skate-verify/main.go +++ b/skate/cmd/skate-verify/main.go @@ -18,7 +18,6 @@ import ( "git.archive.org/martin/cgraph/skate" "git.archive.org/martin/cgraph/skate/parallel" - jsoniter "github.com/json-iterator/go" ) var ( @@ -33,8 +32,6 @@ var ( cpuProfile = flag.String("cpuprofile", "", "write cpu profile to file") memProfile = flag.String("memprofile", "", "write heap profile to file (go tool pprof -png --alloc_objects program mem.pprof > mem.png)") - json = jsoniter.ConfigCompatibleWithStandardLibrary - // XXX: This should be cleanup up soon. matchResults = map[string]skate.MatchResult{ "doi": skate.MatchResult{skate.StatusExact, skate.ReasonDOI}, diff --git a/skate/cmd/skate-wikipedia-doi/main.go b/skate/cmd/skate-wikipedia-doi/main.go index 15b0d0a..d1a21e9 100644 --- a/skate/cmd/skate-wikipedia-doi/main.go +++ b/skate/cmd/skate-wikipedia-doi/main.go @@ -10,13 +10,12 @@ import ( "git.archive.org/martin/cgraph/skate" "git.archive.org/martin/cgraph/skate/parallel" - jsoniter "github.com/json-iterator/go" + json "github.com/segmentio/encoding/json" ) var ( numWorkers = flag.Int("w", runtime.NumCPU(), "number of workers") batchSize = flag.Int("b", 100000, "batch size") - json = jsoniter.ConfigCompatibleWithStandardLibrary bytesNewline = []byte("\n") ) diff --git a/skate/go.mod b/skate/go.mod index 709ae2f..e8678c0 100644 --- a/skate/go.mod +++ b/skate/go.mod @@ -12,6 +12,7 @@ require ( github.com/miku/parallel v0.0.0-20210205190127-d1fa15dcea0c github.com/modern-go/concurrent v0.0.0-20180306012644-bacd9c7ef1dd // indirect github.com/modern-go/reflect2 v1.0.1 // indirect + github.com/segmentio/encoding v0.2.17 github.com/sethgrid/pester v1.1.0 github.com/stretchr/testify v1.5.1 // indirect golang.org/x/text v0.3.5 diff --git a/skate/go.sum b/skate/go.sum index afd2a17..8690252 100644 --- a/skate/go.sum +++ b/skate/go.sum @@ -18,6 +18,8 @@ github.com/google/go-cmp v0.5.5/go.mod h1:v8dTdLbMG2kIc/vJvl+f65V22dbkXbowE6jgT/ github.com/google/gofuzz v1.0.0/go.mod h1:dBl0BpW6vV/+mYPU4Po3pmUjxk6FQPldtuIdl/M65Eg= github.com/json-iterator/go v1.1.10 h1:Kz6Cvnvv2wGdaG/V8yMvfkmNiXq9Ya2KUv4rouJJr68= github.com/json-iterator/go v1.1.10/go.mod h1:KdQUCv79m/52Kvf8AW2vK1V8akMuk1QjK/uOdHXbAo4= +github.com/klauspost/cpuid/v2 v2.0.5 h1:qnfhwbFriwDIX51QncuNU5mEMf+6KE3t7O8V2KQl3Dg= +github.com/klauspost/cpuid/v2 v2.0.5/go.mod h1:FInQzS24/EEf25PyTYn52gqo7WaD8xa0213Md/qVLRg= github.com/kr/pretty v0.2.1 h1:Fmg33tUaq4/8ym9TJN1x7sLJnHVwhP33CNkpYV/7rwI= github.com/kr/pretty v0.2.1/go.mod h1:ipq/a2n7PKx3OHsz4KJII5eveXtPO4qwEXGdVfWzfnI= github.com/kr/pty v1.1.1/go.mod h1:pFQYn66WHrOpPYNljwOMqo10TkYh1fy3cYio2l3bCsQ= @@ -35,6 +37,8 @@ github.com/modern-go/reflect2 v1.0.1 h1:9f412s+6RmYXLWZSEzVVgPGK7C2PphHj5RJrvfx9 github.com/modern-go/reflect2 v1.0.1/go.mod h1:bx2lNnkwVCuqBIxFjflWJWanXIb3RllmbCylyMrvgv0= github.com/pmezard/go-difflib v1.0.0 h1:4DBwDE0NGyQoBHbLQYPwSUPoCMWR5BEzIk/f1lZbAQM= github.com/pmezard/go-difflib v1.0.0/go.mod h1:iKH77koFhYxTK1pcRnkKkqfTogsbg7gZNVY4sRDYZ/4= +github.com/segmentio/encoding v0.2.17 h1:cgfmPc44u1po1lz5bSgF00gLCROBjDNc7h+H7I20zpc= +github.com/segmentio/encoding v0.2.17/go.mod h1:7E68jTSWMnNoYhHi1JbLd7NBSB6XfE4vzqhR88hDBQc= github.com/sethgrid/pester v1.1.0 h1:IyEAVvwSUPjs2ACFZkBe5N59BBUpSIkQ71Hr6cM5A+w= github.com/sethgrid/pester v1.1.0/go.mod h1:Ad7IjTpvzZO8Fl0vh9AzQ+j/jYZfyp2diGwI8m5q+ns= github.com/spaolacci/murmur3 v0.0.0-20180118202830-f09979ecbc72 h1:qLC7fQah7D6K1B0ujays3HV9gkFtllcxhzImRR7ArPQ= diff --git a/skate/verify.go b/skate/verify.go index c24590e..914f6a4 100644 --- a/skate/verify.go +++ b/skate/verify.go @@ -15,6 +15,7 @@ import ( "git.archive.org/martin/cgraph/skate/set" "git.archive.org/martin/cgraph/skate/zipkey" + json "github.com/segmentio/encoding/json" ) // This file is a port of fuzzycat.verify to Go. diff --git a/skate/verify_test.go b/skate/verify_test.go index 350a0cc..2a88f77 100644 --- a/skate/verify_test.go +++ b/skate/verify_test.go @@ -5,6 +5,8 @@ import ( "io/ioutil" "strings" "testing" + + json "github.com/segmentio/encoding/json" ) func TestSlugifyString(t *testing.T) { |