diff --git a/Makefile b/Makefile index 4c00444..5fe1612 100644 --- a/Makefile +++ b/Makefile @@ -4,6 +4,6 @@ update\:data: wget https://github.com/BYVoid/OpenCC/archive/refs/heads/master.zip -O tmp/opencc.zip unzip tmp/opencc.zip -d tmp/ sh ./merge-data.sh + test: - sh ./merge-data.sh - go test ./... \ No newline at end of file + GO111MODULE=auto go test -cover ./... diff --git a/dictionary/HKPhrasesFinance.txt b/dictionary/HKPhrasesFinance.txt index e9f2508..3018d8a 100644 --- a/dictionary/HKPhrasesFinance.txt +++ b/dictionary/HKPhrasesFinance.txt @@ -84,5 +84,4 @@ 被迫倉 被挾倉 高峰 高峰 開户 開戶 -開户 開戶 户 戶 diff --git a/opencc.go b/opencc.go index 7f3b3fd..840f4e2 100644 --- a/opencc.go +++ b/opencc.go @@ -4,12 +4,9 @@ package opencc import ( "embed" "encoding/json" - "flag" "fmt" - "os" "path" "reflect" - "runtime" "strings" "github.com/liuzl/da" @@ -21,22 +18,6 @@ var cf embed.FS //go:embed dictionary var df embed.FS -var ( - // Dir is the parent dir for config and dictionary - Dir = flag.String("dir", defaultDir(), "dict dir") -) - -func defaultDir() string { - if runtime.GOOS == "windows" { - return `C:\gocc\` - } - if goPath, ok := os.LookupEnv("GOPATH"); ok { - return goPath + "/src/github.com/longbridgeapp/opencc/" - } else { - return `/usr/local/share/gocc/` - } -} - // Group holds a sequence of dicts type Group struct { Files []string