diff --git a/.gitignore b/.gitignore index 3d40f72..d07ac06 100644 --- a/.gitignore +++ b/.gitignore @@ -8,9 +8,11 @@ prof 200k-lines.txt test_data.new.txt .idea +coverage.txt gnparser/gnparser bench*.txt binding/libgnparser.h binding/*.so build/** .DS_Store +gndiff diff --git a/CHANGELOG.md b/CHANGELOG.md index ac6b3a2..bd767c4 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -2,7 +2,11 @@ ## Unreleased +## [v0.2.2] - 2023-09-06 Wed + +- Add: refactor to more standard file structure. - Add: update modules to most recent. +- Fix [#25]: CSV and TSV files have correct number of fields. - Fix [#19]: duplication of results of fuzzy matching. ## [v0.2.1] - 2022-05-11 Wed diff --git a/Dockerfile b/Dockerfile index 3fc36de..a934ed9 100644 --- a/Dockerfile +++ b/Dockerfile @@ -6,6 +6,6 @@ ENV LAST_FULL_REBUILD 2021-12-27 WORKDIR /bin -COPY ./gndiff/gndiff /bin +COPY ./gndiff /bin ENTRYPOINT [ "gndiff" ] diff --git a/LICENSE b/LICENSE index b0545c4..f796f3b 100644 --- a/LICENSE +++ b/LICENSE @@ -1,6 +1,6 @@ -MIT License +The MIT License (MIT) -Copyright (c) 2021-2022 gnames +Copyright © 2021-2023 Dmitry Mozzherin Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal @@ -9,13 +9,13 @@ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: -The above copyright notice and this permission notice shall be included in all -copies or substantial portions of the Software. +The above copyright notice and this permission notice shall be included in +all copies or substantial portions of the Software. THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, -OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE -SOFTWARE. +OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN +THE SOFTWARE. diff --git a/Makefile b/Makefile index 5916c93..72307d0 100644 --- a/Makefile +++ b/Makefile @@ -1,73 +1,81 @@ +PROJ_NAME = gndiff + VERSION = $(shell git describe --tags) VER = $(shell git describe --tags --abbrev=0) DATE = $(shell date -u '+%Y-%m-%d_%H:%M:%S%Z') FLAGS_INTEL64 = GOARCH=amd64 NO_C = CGO_ENABLED=0 -FLAGS_LINUX = $(FLAGS_INTEL) GOOS=linux -FLAGS_MAC = $(FLAGS_INTEL) GOOS=darwin +FLAGS_LINUX = $(FLAGS_INTEL64) GOOS=linux +FLAGS_MAC = $(FLAGS_INTEL64) GOOS=darwin FLAGS_MAC_ARM = $GOARCH=arm64 GOOS=darwin FLAGS_WIN = $(FLAGS_INTEL64) GOOS=windows -FLAGS_LD=-ldflags "-s -w -X github.com/gnames/gndiff.Build=${DATE} \ - -X github.com/gnames/gndiff.Version=${VERSION}" +FLAGS_LD = -ldflags "-X github.com/gnames/$(PROJ_NAME)/pkg.Build=$(DATE) \ + -X github.com/gnames/$(PROJ_NAME)/pkg.Version=$(VERSION)" +FLAGS_REL = -trimpath -ldflags "-s -w \ + -X github.com/gnames/$(PROJ_NAME)/pkg.Build=$(DATE)" GOCMD = go GOBUILD = $(GOCMD) build $(FLAGS_LD) +GORELEASE = $(GOCMD) build $(FLAGS_REL) GOINSTALL = $(GOCMD) install $(FLAGS_LD) GOCLEAN = $(GOCMD) clean GOGET = $(GOCMD) get RELEASE_DIR ?= "/tmp" BUILD_DIR ?= "." -CLIB_DIR ?= "." all: install test: deps install - $(FLAG_INTEL) go test -race ./... + @echo Run tests + $(GOCMD) test -shuffle=on -count=1 -race -coverprofile=coverage.txt ./... test-build: deps build deps: + @echo Download go.mod dependencies $(GOCMD) mod download; tools: deps @echo Installing tools from tools.go - @cat gndiff/tools.go | grep _ | awk -F'"' '{print $$2}' | xargs -tI % go install % + @cat tools.go | grep _ | awk -F'"' '{print $$2}' | xargs -tI % go install % build: - cd gndiff; \ + @echo Building $(GOCLEAN); \ $(FLAGS_SHARED) $(NO_C) $(GOBUILD) -o $(BUILD_DIR) +buildrel: + @echo Building release binary + $(GOCLEAN); \ + $(NO_C) $(GORELEASE) -o $(BUILD_DIR); + install: - cd gndiff; \ $(GOCLEAN); \ $(FLAGS_SHARED) $(NO_C) $(GOINSTALL) release: dockerhub - cd gndiff; \ + @echo Make release $(GOCLEAN); \ $(FLAGS_LINUX) $(NO_C) $(GOBUILD); \ - tar zcf $(RELEASE_DIR)/gndiff-$(VER)-linux.tar.gz gndiff; \ + tar zcf $(RELEASE_DIR)/$(PROJ_NAME)-$(VER)-linux.tar.gz $(PROJ_NAME); \ $(GOCLEAN); \ $(FLAGS_MAC) $(NO_C) $(GOBUILD); \ - tar zcf $(RELEASE_DIR)/gndiff-$(VER)-mac.tar.gz gndiff; \ + tar zcf $(RELEASE_DIR)/$(PROJ_NAME)-$(VER)-mac.tar.gz $(PROJ_NAME); \ $(GOCLEAN); \ $(FLAGS_MAC_ARM) $(NO_C) $(GOBUILD); \ - tar zcf $(RELEASE_DIR)/gndiff-$(VER)-mac-arm64.tar.gz gndiff; \ + tar zcf $(RELEASE_DIR)/$(PROJ_NAME)-$(VER)-mac-arm64.tar.gz $(PROJ_NAME); \ $(GOCLEAN); \ $(FLAGS_WIN) $(NO_C) $(GOBUILD); \ - zip -9 $(RELEASE_DIR)/gndiff-$(VER)-win-64.zip gndiff.exe; \ + zip -9 $(RELEASE_DIR)/$(PROJ_NAME)-$(VER)-win-64.zip $(PROJ_NAME).exe; \ $(GOCLEAN); -dc: build - docker-compose build; - -docker: build - docker build -t gnames/gndiff:latest -t gnames/gndiff:$(VERSION) .; \ - cd gndiff; \ +docker: buildrel + @echo Build Docker images + docker buildx build -t gnames/$(PROJ_NAME):latest -t gnames/$(PROJ_NAME):$(VERSION) .; \ $(GOCLEAN); dockerhub: docker - docker push gnames/gndiff; \ - docker push gnames/gndiff:$(VERSION) + @echo Push Docker images to DockerHub + docker push gnames/$(PROJ_NAME); \ + docker push gnames/$(PROJ_NAME):$(VERSION) diff --git a/gndiff/cmd/root.go b/cmd/root.go similarity index 95% rename from gndiff/cmd/root.go rename to cmd/root.go index 5d4e975..239b1b1 100644 --- a/gndiff/cmd/root.go +++ b/cmd/root.go @@ -26,11 +26,11 @@ import ( "os" "path/filepath" - "github.com/gnames/gndiff" - "github.com/gnames/gndiff/config" - "github.com/gnames/gndiff/ent/output" - "github.com/gnames/gndiff/ent/record" - "github.com/gnames/gndiff/io/ingestio" + "github.com/gnames/gndiff/internal/io/ingestio" + gndiff "github.com/gnames/gndiff/pkg" + "github.com/gnames/gndiff/pkg/config" + "github.com/gnames/gndiff/pkg/ent/output" + "github.com/gnames/gndiff/pkg/ent/record" "github.com/gnames/gnfmt" log "github.com/sirupsen/logrus" "github.com/spf13/cobra" diff --git a/gndiff/LICENSE b/gndiff/LICENSE deleted file mode 100644 index 8bec52f..0000000 --- a/gndiff/LICENSE +++ /dev/null @@ -1,21 +0,0 @@ -The MIT License (MIT) - -Copyright © 2021 Dmitry Mozzherin - -Permission is hereby granted, free of charge, to any person obtaining a copy -of this software and associated documentation files (the "Software"), to deal -in the Software without restriction, including without limitation the rights -to use, copy, modify, merge, publish, distribute, sublicense, and/or sell -copies of the Software, and to permit persons to whom the Software is -furnished to do so, subject to the following conditions: - -The above copyright notice and this permission notice shall be included in -all copies or substantial portions of the Software. - -THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE -AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER -LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, -OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN -THE SOFTWARE. diff --git a/io/ingestio/ingestio.go b/internal/io/ingestio/ingestio.go similarity index 96% rename from io/ingestio/ingestio.go rename to internal/io/ingestio/ingestio.go index 4f0de90..1dc47f4 100644 --- a/io/ingestio/ingestio.go +++ b/internal/io/ingestio/ingestio.go @@ -11,9 +11,9 @@ import ( "strconv" "strings" - "github.com/gnames/gndiff/config" - "github.com/gnames/gndiff/ent/ingester" - "github.com/gnames/gndiff/ent/record" + "github.com/gnames/gndiff/pkg/config" + "github.com/gnames/gndiff/pkg/ent/ingester" + "github.com/gnames/gndiff/pkg/ent/record" "github.com/gnames/gnparser" "github.com/gnames/gnsys" ) diff --git a/io/ingestio/ingestio_test.go b/internal/io/ingestio/ingestio_test.go similarity index 92% rename from io/ingestio/ingestio_test.go rename to internal/io/ingestio/ingestio_test.go index 771b08d..74393fa 100644 --- a/io/ingestio/ingestio_test.go +++ b/internal/io/ingestio/ingestio_test.go @@ -4,12 +4,12 @@ import ( "path/filepath" "testing" - "github.com/gnames/gndiff/config" - "github.com/gnames/gndiff/io/ingestio" + "github.com/gnames/gndiff/internal/io/ingestio" + "github.com/gnames/gndiff/pkg/config" "github.com/stretchr/testify/assert" ) -var path = "../../testdata/" +var path = "../../../pkg/testdata/" func TestRecordsBad(t *testing.T) { cfg := config.New() diff --git a/gndiff/main.go b/main.go similarity index 96% rename from gndiff/main.go rename to main.go index 300beb5..fbe011f 100644 --- a/gndiff/main.go +++ b/main.go @@ -21,7 +21,7 @@ THE SOFTWARE. */ package main -import "github.com/gnames/gndiff/gndiff/cmd" +import "github.com/gnames/gndiff/cmd" func main() { cmd.Execute() diff --git a/config/config.go b/pkg/config/config.go similarity index 100% rename from config/config.go rename to pkg/config/config.go diff --git a/ent/dbase/dbase.go b/pkg/ent/dbase/dbase.go similarity index 95% rename from ent/dbase/dbase.go rename to pkg/ent/dbase/dbase.go index f91e695..39a3702 100644 --- a/ent/dbase/dbase.go +++ b/pkg/ent/dbase/dbase.go @@ -4,7 +4,7 @@ import ( "log" badger "github.com/dgraph-io/badger/v2" - "github.com/gnames/gndiff/ent/record" + "github.com/gnames/gndiff/pkg/ent/record" "github.com/gnames/gnfmt" ) diff --git a/ent/dbase/dbase_test.go b/pkg/ent/dbase/dbase_test.go similarity index 76% rename from ent/dbase/dbase_test.go rename to pkg/ent/dbase/dbase_test.go index 38a0619..86f6a65 100644 --- a/ent/dbase/dbase_test.go +++ b/pkg/ent/dbase/dbase_test.go @@ -4,10 +4,10 @@ import ( "path/filepath" "testing" - "github.com/gnames/gndiff/config" - "github.com/gnames/gndiff/ent/dbase" - "github.com/gnames/gndiff/ent/record" - "github.com/gnames/gndiff/io/ingestio" + "github.com/gnames/gndiff/internal/io/ingestio" + "github.com/gnames/gndiff/pkg/config" + "github.com/gnames/gndiff/pkg/ent/dbase" + "github.com/gnames/gndiff/pkg/ent/record" "github.com/stretchr/testify/assert" ) diff --git a/ent/dbase/init.go b/pkg/ent/dbase/init.go similarity index 94% rename from ent/dbase/init.go rename to pkg/ent/dbase/init.go index 5294fa3..42367c5 100644 --- a/ent/dbase/init.go +++ b/pkg/ent/dbase/init.go @@ -2,7 +2,7 @@ package dbase import ( badger "github.com/dgraph-io/badger/v2" - "github.com/gnames/gndiff/ent/record" + "github.com/gnames/gndiff/pkg/ent/record" ) func (db *dbase) Init(recs []record.Record) error { diff --git a/ent/dbase/interface.go b/pkg/ent/dbase/interface.go similarity index 69% rename from ent/dbase/interface.go rename to pkg/ent/dbase/interface.go index af5e141..9e89f9f 100644 --- a/ent/dbase/interface.go +++ b/pkg/ent/dbase/interface.go @@ -1,6 +1,6 @@ package dbase -import "github.com/gnames/gndiff/ent/record" +import "github.com/gnames/gndiff/pkg/ent/record" type DBase interface { Init([]record.Record) error diff --git a/ent/exact/exact.go b/pkg/ent/exact/exact.go similarity index 94% rename from ent/exact/exact.go rename to pkg/ent/exact/exact.go index b0ff151..a1e59a8 100644 --- a/ent/exact/exact.go +++ b/pkg/ent/exact/exact.go @@ -5,7 +5,7 @@ import ( "github.com/devopsfaith/bloomfilter" baseBloomfilter "github.com/devopsfaith/bloomfilter/bloomfilter" - "github.com/gnames/gndiff/ent/record" + "github.com/gnames/gndiff/pkg/ent/record" ) type exact struct { diff --git a/ent/exact/exact_test.go b/pkg/ent/exact/exact_test.go similarity index 73% rename from ent/exact/exact_test.go rename to pkg/ent/exact/exact_test.go index 4e5dd02..2a51c36 100644 --- a/ent/exact/exact_test.go +++ b/pkg/ent/exact/exact_test.go @@ -4,10 +4,10 @@ import ( "path/filepath" "testing" - "github.com/gnames/gndiff/config" - "github.com/gnames/gndiff/ent/exact" - "github.com/gnames/gndiff/ent/record" - "github.com/gnames/gndiff/io/ingestio" + "github.com/gnames/gndiff/internal/io/ingestio" + "github.com/gnames/gndiff/pkg/config" + "github.com/gnames/gndiff/pkg/ent/exact" + "github.com/gnames/gndiff/pkg/ent/record" "github.com/stretchr/testify/assert" ) diff --git a/ent/exact/interface.go b/pkg/ent/exact/interface.go similarity index 62% rename from ent/exact/interface.go rename to pkg/ent/exact/interface.go index 6a12b25..3dfa502 100644 --- a/ent/exact/interface.go +++ b/pkg/ent/exact/interface.go @@ -1,6 +1,6 @@ package exact -import "github.com/gnames/gndiff/ent/record" +import "github.com/gnames/gndiff/pkg/ent/record" type Exact interface { Init([]record.Record) diff --git a/ent/fuzzy/edit_distance.go b/pkg/ent/fuzzy/edit_distance.go similarity index 100% rename from ent/fuzzy/edit_distance.go rename to pkg/ent/fuzzy/edit_distance.go diff --git a/ent/fuzzy/fuzzy.go b/pkg/ent/fuzzy/fuzzy.go similarity index 96% rename from ent/fuzzy/fuzzy.go rename to pkg/ent/fuzzy/fuzzy.go index 1b6b315..b0a3fa9 100644 --- a/ent/fuzzy/fuzzy.go +++ b/pkg/ent/fuzzy/fuzzy.go @@ -4,7 +4,7 @@ import ( "sort" "github.com/dvirsky/levenshtein" - "github.com/gnames/gndiff/ent/record" + "github.com/gnames/gndiff/pkg/ent/record" ) type fuzzy struct { diff --git a/ent/fuzzy/fuzzy_test.go b/pkg/ent/fuzzy/fuzzy_test.go similarity index 89% rename from ent/fuzzy/fuzzy_test.go rename to pkg/ent/fuzzy/fuzzy_test.go index 459061e..ccf4db6 100644 --- a/ent/fuzzy/fuzzy_test.go +++ b/pkg/ent/fuzzy/fuzzy_test.go @@ -5,10 +5,10 @@ import ( "path/filepath" "testing" - "github.com/gnames/gndiff/config" - "github.com/gnames/gndiff/ent/fuzzy" - "github.com/gnames/gndiff/ent/record" - "github.com/gnames/gndiff/io/ingestio" + "github.com/gnames/gndiff/internal/io/ingestio" + "github.com/gnames/gndiff/pkg/config" + "github.com/gnames/gndiff/pkg/ent/fuzzy" + "github.com/gnames/gndiff/pkg/ent/record" "github.com/stretchr/testify/assert" ) diff --git a/ent/fuzzy/interface.go b/pkg/ent/fuzzy/interface.go similarity index 72% rename from ent/fuzzy/interface.go rename to pkg/ent/fuzzy/interface.go index 627616a..dc93837 100644 --- a/ent/fuzzy/interface.go +++ b/pkg/ent/fuzzy/interface.go @@ -1,6 +1,6 @@ package fuzzy -import "github.com/gnames/gndiff/ent/record" +import "github.com/gnames/gndiff/pkg/ent/record" type Fuzzy interface { Init([]record.Record) error diff --git a/ent/ingester/interface.go b/pkg/ent/ingester/interface.go similarity index 65% rename from ent/ingester/interface.go rename to pkg/ent/ingester/interface.go index 5439294..4151c77 100644 --- a/ent/ingester/interface.go +++ b/pkg/ent/ingester/interface.go @@ -1,6 +1,6 @@ package ingester -import "github.com/gnames/gndiff/ent/record" +import "github.com/gnames/gndiff/pkg/ent/record" type Ingester interface { Records(path string) ([]record.Record, error) diff --git a/ent/matcher/interface.go b/pkg/ent/matcher/interface.go similarity index 81% rename from ent/matcher/interface.go rename to pkg/ent/matcher/interface.go index 2307f1c..08fc074 100644 --- a/ent/matcher/interface.go +++ b/pkg/ent/matcher/interface.go @@ -1,6 +1,6 @@ package matcher -import "github.com/gnames/gndiff/ent/record" +import "github.com/gnames/gndiff/pkg/ent/record" type Matcher interface { Init([]record.Record) error diff --git a/ent/matcher/match.go b/pkg/ent/matcher/match.go similarity index 98% rename from ent/matcher/match.go rename to pkg/ent/matcher/match.go index 6aba0b0..8dd5c22 100644 --- a/ent/matcher/match.go +++ b/pkg/ent/matcher/match.go @@ -3,7 +3,7 @@ package matcher import ( "strings" - "github.com/gnames/gndiff/ent/record" + "github.com/gnames/gndiff/pkg/ent/record" "github.com/gnames/gnlib/ent/verifier" ) diff --git a/ent/matcher/matcher.go b/pkg/ent/matcher/matcher.go similarity index 90% rename from ent/matcher/matcher.go rename to pkg/ent/matcher/matcher.go index 32b8eb9..bfeeae9 100644 --- a/ent/matcher/matcher.go +++ b/pkg/ent/matcher/matcher.go @@ -1,10 +1,10 @@ package matcher import ( - "github.com/gnames/gndiff/ent/dbase" - "github.com/gnames/gndiff/ent/exact" - "github.com/gnames/gndiff/ent/fuzzy" - "github.com/gnames/gndiff/ent/record" + "github.com/gnames/gndiff/pkg/ent/dbase" + "github.com/gnames/gndiff/pkg/ent/exact" + "github.com/gnames/gndiff/pkg/ent/fuzzy" + "github.com/gnames/gndiff/pkg/ent/record" "github.com/gnames/gnlib/ent/verifier" ) diff --git a/ent/matcher/matcher_test.go b/pkg/ent/matcher/matcher_test.go similarity index 92% rename from ent/matcher/matcher_test.go rename to pkg/ent/matcher/matcher_test.go index db984df..d4927e2 100644 --- a/ent/matcher/matcher_test.go +++ b/pkg/ent/matcher/matcher_test.go @@ -4,10 +4,10 @@ import ( "path/filepath" "testing" - "github.com/gnames/gndiff/config" - "github.com/gnames/gndiff/ent/matcher" - "github.com/gnames/gndiff/ent/record" - "github.com/gnames/gndiff/io/ingestio" + "github.com/gnames/gndiff/internal/io/ingestio" + "github.com/gnames/gndiff/pkg/config" + "github.com/gnames/gndiff/pkg/ent/matcher" + "github.com/gnames/gndiff/pkg/ent/record" "github.com/gnames/gnlib/ent/verifier" "github.com/gnames/gnparser" "github.com/stretchr/testify/assert" diff --git a/ent/output/output.go b/pkg/ent/output/output.go similarity index 89% rename from ent/output/output.go rename to pkg/ent/output/output.go index 3d3dd36..a624cb2 100644 --- a/ent/output/output.go +++ b/pkg/ent/output/output.go @@ -5,7 +5,7 @@ import ( "strconv" "strings" - "github.com/gnames/gndiff/ent/record" + "github.com/gnames/gndiff/pkg/ent/record" "github.com/gnames/gnfmt" "github.com/gnames/gnlib/ent/verifier" ) @@ -42,8 +42,9 @@ func MatchOutput(o Output, f gnfmt.Format) string { // CSVHeader returns the header string for CSV output format. func CSVHeader(f gnfmt.Format) string { header := []string{ - "Source", "SourceRow", "TaxonId", "Name", "CanonicalFull", "Reference", - "MatchType", "ReferenceRow", "TaxonId", "Name", "EditDistance", "Score", + "SourceFile", "SrcRowNum", "SrcTaxonId", "SrcName", "SrcCanonical", + "ReferenceFile", "RefRowNum", "RefTaxonId", "RefName", "RefCanonical", + "Score", "MatchType", "EditDistance", } switch f { case gnfmt.CSV: @@ -78,13 +79,13 @@ func csvRow(m Match, sep rune) []string { s.Name, s.CanonicalFull, r[i].DataSet, - r[i].MatchType.String(), strconv.Itoa(r[i].Index), r[i].ID, r[i].Name, r[i].CanonicalFull, - strconv.Itoa(r[i].EditDistance), strconv.FormatFloat(r[i].Score, 'f', 5, 64), + r[i].MatchType.String(), + strconv.Itoa(r[i].EditDistance), } res = append(res, gnfmt.ToCSV(row, sep)) } @@ -94,12 +95,15 @@ func csvRow(m Match, sep rune) []string { strconv.Itoa(s.Index), s.ID, s.Name, + s.CanonicalFull, + "", "", - verifier.NoMatch.String(), "", "", "", "", + verifier.NoMatch.String(), + "", } res = append(res, gnfmt.ToCSV(row, sep)) } diff --git a/ent/record/record.go b/pkg/ent/record/record.go similarity index 100% rename from ent/record/record.go rename to pkg/ent/record/record.go diff --git a/gndiff.go b/pkg/gndiff.go similarity index 84% rename from gndiff.go rename to pkg/gndiff.go index e053e48..d8545e7 100644 --- a/gndiff.go +++ b/pkg/gndiff.go @@ -1,10 +1,10 @@ package gndiff import ( - "github.com/gnames/gndiff/config" - "github.com/gnames/gndiff/ent/matcher" - "github.com/gnames/gndiff/ent/output" - "github.com/gnames/gndiff/ent/record" + "github.com/gnames/gndiff/pkg/config" + "github.com/gnames/gndiff/pkg/ent/matcher" + "github.com/gnames/gndiff/pkg/ent/output" + "github.com/gnames/gndiff/pkg/ent/record" "github.com/gnames/gnlib/ent/gnvers" ) diff --git a/gndiff_test.go b/pkg/gndiff_test.go similarity index 95% rename from gndiff_test.go rename to pkg/gndiff_test.go index 30b21ff..24ac460 100644 --- a/gndiff_test.go +++ b/pkg/gndiff_test.go @@ -4,9 +4,9 @@ import ( "path/filepath" "testing" - "github.com/gnames/gndiff" - "github.com/gnames/gndiff/config" - "github.com/gnames/gndiff/io/ingestio" + "github.com/gnames/gndiff/internal/io/ingestio" + gndiff "github.com/gnames/gndiff/pkg" + "github.com/gnames/gndiff/pkg/config" "github.com/stretchr/testify/assert" ) diff --git a/interface.go b/pkg/interface.go similarity index 81% rename from interface.go rename to pkg/interface.go index 90c5e5a..61b810b 100644 --- a/interface.go +++ b/pkg/interface.go @@ -1,8 +1,8 @@ package gndiff import ( - "github.com/gnames/gndiff/ent/output" - "github.com/gnames/gndiff/ent/record" + "github.com/gnames/gndiff/pkg/ent/output" + "github.com/gnames/gndiff/pkg/ent/record" "github.com/gnames/gnlib/ent/gnvers" ) diff --git a/sort.go b/pkg/sort.go similarity index 96% rename from sort.go rename to pkg/sort.go index 174ae42..4cd9892 100644 --- a/sort.go +++ b/pkg/sort.go @@ -5,8 +5,8 @@ import ( "github.com/gnames/gnames/pkg/ent/score" "github.com/gnames/gnames/pkg/ent/verifier" - "github.com/gnames/gndiff/ent/output" - "github.com/gnames/gndiff/ent/record" + "github.com/gnames/gndiff/pkg/ent/output" + "github.com/gnames/gndiff/pkg/ent/record" vlib "github.com/gnames/gnlib/ent/verifier" ) diff --git a/testdata/bad-header.csv b/pkg/testdata/bad-header.csv similarity index 100% rename from testdata/bad-header.csv rename to pkg/testdata/bad-header.csv diff --git a/testdata/ebird.csv b/pkg/testdata/ebird.csv similarity index 100% rename from testdata/ebird.csv rename to pkg/testdata/ebird.csv diff --git a/testdata/ioc-bird.csv b/pkg/testdata/ioc-bird.csv similarity index 100% rename from testdata/ioc-bird.csv rename to pkg/testdata/ioc-bird.csv diff --git a/testdata/ioc-bird.tsv b/pkg/testdata/ioc-bird.tsv similarity index 100% rename from testdata/ioc-bird.tsv rename to pkg/testdata/ioc-bird.tsv diff --git a/testdata/issue-16.csv b/pkg/testdata/issue-16.csv similarity index 100% rename from testdata/issue-16.csv rename to pkg/testdata/issue-16.csv diff --git a/testdata/issue-17-ref.txt b/pkg/testdata/issue-17-ref.txt similarity index 100% rename from testdata/issue-17-ref.txt rename to pkg/testdata/issue-17-ref.txt diff --git a/testdata/issue-17-src.txt b/pkg/testdata/issue-17-src.txt similarity index 100% rename from testdata/issue-17-src.txt rename to pkg/testdata/issue-17-src.txt diff --git a/testdata/issue-19-ref.csv b/pkg/testdata/issue-19-ref.csv similarity index 100% rename from testdata/issue-19-ref.csv rename to pkg/testdata/issue-19-ref.csv diff --git a/testdata/issue-19-src.csv b/pkg/testdata/issue-19-src.csv similarity index 100% rename from testdata/issue-19-src.csv rename to pkg/testdata/issue-19-src.csv diff --git a/testdata/names.txt b/pkg/testdata/names.txt similarity index 100% rename from testdata/names.txt rename to pkg/testdata/names.txt diff --git a/version.go b/pkg/version.go similarity index 79% rename from version.go rename to pkg/version.go index 7e0ce42..837319b 100644 --- a/version.go +++ b/pkg/version.go @@ -2,7 +2,7 @@ package gndiff var ( // Version of gndiff - Version = "v0.2.1+" + Version = "v0.2.1" // Build timestamp Build = "n/a" ) diff --git a/gndiff/tools.go b/tools.go similarity index 100% rename from gndiff/tools.go rename to tools.go