From b03535d87f228b49f8e95227e12dd32b833da42b Mon Sep 17 00:00:00 2001 From: liut Date: Thu, 28 Dec 2023 14:36:59 +0800 Subject: [PATCH 1/2] Remove unused variables and private func. --- opencc.go | 19 ------------------- 1 file changed, 19 deletions(-) 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 From 4bed54a8bb4c13da176b3d963067bc1f04f1b150 Mon Sep 17 00:00:00 2001 From: liut Date: Thu, 28 Dec 2023 14:38:57 +0800 Subject: [PATCH 2/2] fix test target and duplicated line --- Makefile | 4 ++-- dictionary/HKPhrasesFinance.txt | 1 - 2 files changed, 2 insertions(+), 3 deletions(-) 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 @@ 被迫倉 被挾倉 高峰 高峰 開户 開戶 -開户 開戶 户 戶