diff --git a/Makefile b/Makefile index 969fe59..6c91863 100644 --- a/Makefile +++ b/Makefile @@ -2,7 +2,7 @@ CC=go BUILD=build -v -trimpath VERSION=$(shell cat VERSION) GCFLAGS=-gcflags '-e' -LDFLAGS=-ldflags '-X main.version=$(VERSION) -s -w' +LDFLAGS=-ldflags '-buildid= -X main.version=$(VERSION) -s -w' PROGRAM=gowiki ENV=CGO_ENABLED=0 GO111MODULE=on @@ -11,16 +11,16 @@ all: $(PROGRAM) setup: $(CC) get -u github.com/client9/misspell -release: clean gofmt codeqa +release: clean gofmt govet codeqa $(ENV) $(CC) $(BUILD) $(GCFLAGS) $(LDFLAGS) -release-vendor: clean gofmt codeqa +release-vendor: clean gofmt govet codeqa $(ENV) $(CC) $(BUILD) -mod=vendor $(GCFLAGS) $(LDFLAGS) -vendor: clean gofmt +vendor: clean gofmt govet $(ENV) $(CC) $(BUILD) -mod=vendor $(GCFLAGS) $(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/page.go b/pkg/db/page.go index d227dea..e642161 100644 --- a/pkg/db/page.go +++ b/pkg/db/page.go @@ -54,7 +54,10 @@ func (db *DB) GetAllSections(username string, admin bool) (sections core.Section if l > 5 { l = 5 } - sections = append(sections, core.SectionPage{s, p[:l]}) + sections = append(sections, core.SectionPage{ + Section: s, + Pages: p[:l], + }) } sort.Sort(sections) return diff --git a/pkg/db/section.go b/pkg/db/section.go index 912fb1e..14e705f 100644 --- a/pkg/db/section.go +++ b/pkg/db/section.go @@ -81,7 +81,11 @@ func (db *DB) UpdateSection(section string, members []string, user bool) error { } } } - return db.store.Set(sectionPrefix+section, &core.Section{section, user, m}) + return db.store.Set(sectionPrefix+section, &core.Section{ + Name: section, + User: user, + Members: m, + }) } func (db *DB) DeleteSection(section string) error {