Dumb server that helps you serve files from a path via HTTP.
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 

34 lines
1.3 KiB

PKGS := $(shell go list ./... | grep -v /vendor)
GO_FILES := $(shell find . -iname '*.go' -type f | grep -v /vendor/) # All the .go files, excluding vendor/
BINARY := dumb-http
PLATFORMS := windows linux darwin
VERSION ?= latest
os = $(word 1, $@)
bootstrap:
@mkdir -p release
go install honnef.co/go/tools/cmd/staticcheck@latest # Badass static analyzer/linter
go install github.com/fzipp/gocyclo/cmd/gocyclo@latest # Cyclomatic complexity check
test:
go test -v -race $(PKGS) # Normal Test
go vet ./... # go vet is the official Go static analyzer
staticcheck ./... # "go vet on steroids" + linter
gocyclo -over 19 $(GO_FILES) # forbid code with huge functions
golint -set_exit_status $(PKGS) # one last linter
$(PLATFORMS):
GOOS=$(os) GOARCH=amd64 go build -ldflags '-s -w -X main.version=$(VERSION)' -o release/$(BINARY) cmd/dumb-http/main.go
GOOS=$(os) GOARCH=amd64 go build -ldflags '-s -w -X main.version=$(VERSION)' -o release/$(BINARY)-s3 cmd/dumb-http-s3/main.go
tar -czf release/$(BINARY)-$(VERSION)-$(os)-amd64.tar.gz README.md -C release/ $(BINARY)
tar -czf release/$(BINARY)-s3-$(VERSION)-$(os)-amd64.tar.gz README.md -C release/ $(BINARY)-s3
rm release/$(BINARY)
rm release/$(BINARY)-s3
.PHONY: release
release: windows linux darwin
clean:
rm -rf release/*