initial commit

This commit is contained in:
ston1th 2022-03-13 18:49:27 +01:00
commit 3053f89410
39 changed files with 4567 additions and 0 deletions

56
Makefile Normal file
View file

@ -0,0 +1,56 @@
CC=go
BUILD=build -v -trimpath
VERSION=$(shell cat VERSION)
GCFLAGS=-gcflags '-e'
LDFLAGS=-ldflags '-buildid=$(VERSION) -X main.version=$(VERSION) -s -w'
PROGRAM=cachefs
CMD=-o $(PROGRAM) cmd/$(PROGRAM)/main.go
ENV=CGO_ENABLED=0 GO111MODULE=on
all: $(PROGRAM)
setup:
$(CC) install github.com/client9/misspell/cmd/misspell@latest
$(CC) install honnef.co/go/tools/cmd/staticcheck@latest
release: clean gofmt codeqa
$(ENV) $(CC) $(BUILD) $(GCFLAGS) $(LDFLAGS) $(CMD)
release-vendor: clean gofmt codeqa
$(ENV) $(CC) $(BUILD) -mod=vendor $(GCFLAGS) $(LDFLAGS) $(CMD)
vendor: clean gofmt
$(ENV) $(CC) $(BUILD) -mod=vendor $(GCFLAGS) $(LDFLAGS) $(CMD)
$(PROGRAM): clean gofmt
$(ENV) $(CC) $(BUILD) $(GCFLAGS) $(LDFLAGS) $(CMD)
clean:
$(CC) clean -x
gofmt:
$(CC) fmt ./...
codeqa: govet misspell staticcheck test
govet:
$(CC) vet ./...
misspell:
$(GOPATH)/bin/misspell cmd/* pkg/* Makefile README.md sri.sh
staticcheck:
$(GOPATH)/bin/staticcheck ./...
test:
ifeq ($(shell go env GOARCH), $(shell go env GOHOSTARCH))
ifeq ($(shell go env GOOS), $(shell go env GOHOSTOS))
$(CC) test ./...
else
$(info skipping tests of other platforms)
endif
else
$(info skipping tests of other platforms)
endif
.PHONY: setup release release-vendor vendor build clean codeqa gofmt govet misspell staticcheck test