diff --git a/Makefile b/Makefile index 9c604b9..3018c7a 100644 --- a/Makefile +++ b/Makefile @@ -1,17 +1,23 @@ -P=gowerc -SRC=git.froth.zone -USER?=fishe -GO_VERSION=1.18 +GO ?= go +GOFLAGS ?= -ldflags "-s -w" -docker: $(USER)/$(P) +CGO_ENABLED ?= 0 -$(USER)/$(P): bin/$(P) - docker build -t "$(USER)/$(P):latest" . +all: go2werc -bin/$(P): *.go - docker run --rm -v ${PWD}:/go/src/$(SRC)/$(USER)/$(P) golang:${GO_VERSION} /bin/bash -c "go list -f '{{range .Imports}}{{printf \"%s\n\" .}}{{end}}' $(SRC)/$(USER)/$(P) | xargs go get -d; CGO_ENABLED=0 go build -v -installsuffix cgo -o /go/src/$(SRC)/$(USER)/$(P)/bin/$(P) $(SRC)/$(USER)/$(P)" +go2werc: + $(GO) build $(GOFLAGS) . + +fmt: + gofmt -w -s . + +vet: + $(GO) vet ./... + +lint: fmt vet + -golangci-lint run clean: - docker run --rm -v ${PWD}:/opt busybox rm -f /opt/bin/$(P) - docker rmi -f "$(USER)/$(P):latest" + $(GO) clean +.PHONY: clean lint test fmt vet help \ No newline at end of file diff --git a/README.md b/README.md index 9bd5130..98f934f 100644 --- a/README.md +++ b/README.md @@ -10,11 +10,11 @@ clone of http://werc.cat-v.org/ in go. ## building -### with go +### with go install go install git.froth.zone/sam/go2werc@latest -### in docker + +## License +Werc was originally put into the public domain. Since the public domain isn't a thing +outside of the US, 0BSD is used instead. It's basically the public domain but the EU +actually recognizes it. \ No newline at end of file diff --git a/docker.mk b/docker.mk new file mode 100644 index 0000000..9c604b9 --- /dev/null +++ b/docker.mk @@ -0,0 +1,17 @@ +P=gowerc +SRC=git.froth.zone +USER?=fishe +GO_VERSION=1.18 + +docker: $(USER)/$(P) + +$(USER)/$(P): bin/$(P) + docker build -t "$(USER)/$(P):latest" . + +bin/$(P): *.go + docker run --rm -v ${PWD}:/go/src/$(SRC)/$(USER)/$(P) golang:${GO_VERSION} /bin/bash -c "go list -f '{{range .Imports}}{{printf \"%s\n\" .}}{{end}}' $(SRC)/$(USER)/$(P) | xargs go get -d; CGO_ENABLED=0 go build -v -installsuffix cgo -o /go/src/$(SRC)/$(USER)/$(P)/bin/$(P) $(SRC)/$(USER)/$(P)" + +clean: + docker run --rm -v ${PWD}:/opt busybox rm -f /opt/bin/$(P) + docker rmi -f "$(USER)/$(P):latest" + diff --git a/mkfile b/mkfile new file mode 100644 index 0000000..8c0c272 --- /dev/null +++ b/mkfile @@ -0,0 +1,20 @@ +GO = go + +CGO_ENABLED = 0 + +all: go2werc + +go2werc: + $GO build -ldflags="-s -w" . + +fmt: + gofmt -w -s . + +vet: + $GO vet ./... + +lint: fmt vet + -golangci-lint run + +clean: + $GO clean \ No newline at end of file diff --git a/root/etc/config.json b/root/etc/config.json index d0f0ba0..acc483a 100644 --- a/root/etc/config.json +++ b/root/etc/config.json @@ -1,4 +1,4 @@ { - "mastersite": "example.com" + "mastersite": "dns.froth.zone" } diff --git a/root/lib/topbar.html b/root/lib/topbar.html index 0d35018..7017dce 100644 --- a/root/lib/topbar.html +++ b/root/lib/topbar.html @@ -1,8 +1,8 @@