diff --git a/Makefile b/Makefile index a08ca6d..f8b8096 100644 --- a/Makefile +++ b/Makefile @@ -1,8 +1,8 @@ CC=go -BUILD=build -v -trimpath +BUILD=build -a -v -trimpath VERSION=$(shell cat VERSION) -GCFLAGS=-gcflags 'all=-e' -LDFLAGS=-ldflags '-X main.version=$(VERSION) -s -w' +GCFLAGS=-gcflags '-e' +LDFLAGS=-ldflags '-buildid= -X main.version=$(VERSION) -s -w' PROGRAM=docstore ENV=CGO_ENABLED=0 GO111MODULE=on @@ -11,16 +11,16 @@ all: $(PROGRAM) setup: $(CC) get github.com/client9/misspell -release: clean gofmt codeqa +release: clean gofmt govet codeqa $(ENV) $(CC) $(BUILD) $(LDFLAGS) -release-vendor: clean gofmt codeqa +release-vendor: clean gofmt govet codeqa $(ENV) $(CC) $(BUILD) -mod=vendor $(LDFLAGS) -vendor: clean gofmt +vendor: clean gofmt govet $(ENV) $(CC) $(BUILD) -mod=vendor $(LDFLAGS) -$(PROGRAM): clean gofmt +$(PROGRAM): clean gofmt govet $(ENV) $(CC) $(BUILD) $(GCFLAGS) $(LDFLAGS) clean: @@ -29,13 +29,16 @@ clean: codeqa: misspell golint test gofmt: - gofmt -w pkg/ main.go + $(CC) fmt ./... + +govet: + $(CC) vet ./... golint: $(GOPATH)/bin/golint . misspell: - $(GOPATH)/bin/misspell pkg/* templates/* main.go Makefile README.md sri.sh templates.sh + $(GOPATH)/bin/misspell pkg/* main.go Makefile README.md sri.sh test: ifeq ($(shell go env GOARCH), $(shell go env GOHOSTARCH)) @@ -48,4 +51,4 @@ else $(info skipping tests of other platforms) endif -.PHONY: setup release release-vendor vendor build clean codeqa gofmt golint misspell test +.PHONY: setup release release-vendor vendor build clean codeqa gofmt govet golint misspell test diff --git a/pkg/db/tags.go b/pkg/db/tags.go index bc11d24..2d7c54a 100644 --- a/pkg/db/tags.go +++ b/pkg/db/tags.go @@ -17,10 +17,10 @@ const ( ) var defaultTags = core.Tags{ - {"invoice", `(?i)[^e]rechnung|quittung|beleg|invoice|bill|check`}, - {"tax", `(?i)steuer|lohn|tax|salary`}, - {"contract", `(?i)vertrag|kündigung|vereinbarung|contract|termination|agreement`}, - {"insurance", `(?i)versicherung|versichert|insurance|insured`}, + {Name: "invoice", Regex: `(?i)[^e]rechnung|quittung|beleg|invoice|bill|check`}, + {Name: "tax", Regex: `(?i)steuer|lohn|tax|salary`}, + {Name: "contract", Regex: `(?i)vertrag|kündigung|vereinbarung|contract|termination|agreement`}, + {Name: "insurance", Regex: `(?i)versicherung|versichert|insurance|insured`}, } func (db *DB) addDefaultTags() (err error) { @@ -115,7 +115,10 @@ func (db *DB) GetAllRTags() (rtags core.RTags, err error) { return } for _, v := range tags { - rtags = append(rtags, core.RTag{v.Name, regexp.MustCompile(v.Regex)}) + rtags = append(rtags, core.RTag{ + Name: v.Name, + Regex: regexp.MustCompile(v.Regex), + }) } return } @@ -135,7 +138,10 @@ func (db *DB) NewTag(name, regex string) (err error) { return } name = nameRe.ReplaceAllString(name, "") - err = db.store.Set(tagsPrefix+name, core.Tag{name, regex}) + err = db.store.Set(tagsPrefix+name, core.Tag{ + Name: name, + Regex: regex, + }) return }