This commit is contained in:
ston1th 2021-07-11 23:43:10 +02:00
commit 58caf0527e
3 changed files with 20 additions and 10 deletions

View file

@ -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

View file

@ -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

View file

@ -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 {