cleanup
This commit is contained in:
parent
6fc121c423
commit
1bb92bd581
2 changed files with 25 additions and 16 deletions
23
Makefile
23
Makefile
|
|
@ -1,8 +1,8 @@
|
||||||
CC=go
|
CC=go
|
||||||
BUILD=build -v -trimpath
|
BUILD=build -a -v -trimpath
|
||||||
VERSION=$(shell cat VERSION)
|
VERSION=$(shell cat VERSION)
|
||||||
GCFLAGS=-gcflags 'all=-e'
|
GCFLAGS=-gcflags '-e'
|
||||||
LDFLAGS=-ldflags '-X main.version=$(VERSION) -s -w'
|
LDFLAGS=-ldflags '-buildid= -X main.version=$(VERSION) -s -w'
|
||||||
PROGRAM=docstore
|
PROGRAM=docstore
|
||||||
ENV=CGO_ENABLED=0 GO111MODULE=on
|
ENV=CGO_ENABLED=0 GO111MODULE=on
|
||||||
|
|
||||||
|
|
@ -11,16 +11,16 @@ all: $(PROGRAM)
|
||||||
setup:
|
setup:
|
||||||
$(CC) get github.com/client9/misspell
|
$(CC) get github.com/client9/misspell
|
||||||
|
|
||||||
release: clean gofmt codeqa
|
release: clean gofmt govet codeqa
|
||||||
$(ENV) $(CC) $(BUILD) $(LDFLAGS)
|
$(ENV) $(CC) $(BUILD) $(LDFLAGS)
|
||||||
|
|
||||||
release-vendor: clean gofmt codeqa
|
release-vendor: clean gofmt govet codeqa
|
||||||
$(ENV) $(CC) $(BUILD) -mod=vendor $(LDFLAGS)
|
$(ENV) $(CC) $(BUILD) -mod=vendor $(LDFLAGS)
|
||||||
|
|
||||||
vendor: clean gofmt
|
vendor: clean gofmt govet
|
||||||
$(ENV) $(CC) $(BUILD) -mod=vendor $(LDFLAGS)
|
$(ENV) $(CC) $(BUILD) -mod=vendor $(LDFLAGS)
|
||||||
|
|
||||||
$(PROGRAM): clean gofmt
|
$(PROGRAM): clean gofmt govet
|
||||||
$(ENV) $(CC) $(BUILD) $(GCFLAGS) $(LDFLAGS)
|
$(ENV) $(CC) $(BUILD) $(GCFLAGS) $(LDFLAGS)
|
||||||
|
|
||||||
clean:
|
clean:
|
||||||
|
|
@ -29,13 +29,16 @@ clean:
|
||||||
codeqa: misspell golint test
|
codeqa: misspell golint test
|
||||||
|
|
||||||
gofmt:
|
gofmt:
|
||||||
gofmt -w pkg/ main.go
|
$(CC) fmt ./...
|
||||||
|
|
||||||
|
govet:
|
||||||
|
$(CC) vet ./...
|
||||||
|
|
||||||
golint:
|
golint:
|
||||||
$(GOPATH)/bin/golint .
|
$(GOPATH)/bin/golint .
|
||||||
|
|
||||||
misspell:
|
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:
|
test:
|
||||||
ifeq ($(shell go env GOARCH), $(shell go env GOHOSTARCH))
|
ifeq ($(shell go env GOARCH), $(shell go env GOHOSTARCH))
|
||||||
|
|
@ -48,4 +51,4 @@ else
|
||||||
$(info skipping tests of other platforms)
|
$(info skipping tests of other platforms)
|
||||||
endif
|
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
|
||||||
|
|
|
||||||
|
|
@ -17,10 +17,10 @@ const (
|
||||||
)
|
)
|
||||||
|
|
||||||
var defaultTags = core.Tags{
|
var defaultTags = core.Tags{
|
||||||
{"invoice", `(?i)[^e]rechnung|quittung|beleg|invoice|bill|check`},
|
{Name: "invoice", Regex: `(?i)[^e]rechnung|quittung|beleg|invoice|bill|check`},
|
||||||
{"tax", `(?i)steuer|lohn|tax|salary`},
|
{Name: "tax", Regex: `(?i)steuer|lohn|tax|salary`},
|
||||||
{"contract", `(?i)vertrag|kündigung|vereinbarung|contract|termination|agreement`},
|
{Name: "contract", Regex: `(?i)vertrag|kündigung|vereinbarung|contract|termination|agreement`},
|
||||||
{"insurance", `(?i)versicherung|versichert|insurance|insured`},
|
{Name: "insurance", Regex: `(?i)versicherung|versichert|insurance|insured`},
|
||||||
}
|
}
|
||||||
|
|
||||||
func (db *DB) addDefaultTags() (err error) {
|
func (db *DB) addDefaultTags() (err error) {
|
||||||
|
|
@ -115,7 +115,10 @@ func (db *DB) GetAllRTags() (rtags core.RTags, err error) {
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
for _, v := range tags {
|
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
|
return
|
||||||
}
|
}
|
||||||
|
|
@ -135,7 +138,10 @@ func (db *DB) NewTag(name, regex string) (err error) {
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
name = nameRe.ReplaceAllString(name, "")
|
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
|
return
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue