~poldi1405/gomod-recter

355f70a7e3e4256f48d04408b513378d9ad696d3 — Moritz Poldrack 2 years ago daa9b38
deletes socket after shutdown
2 files changed, 6 insertions(+), 3 deletions(-)

M Makefile
M main.go
M Makefile => Makefile +3 -2
@@ 1,9 1,10 @@
VERSION:=$(shell git describe)
GOEXE:=$(shell go env GOEXE)
OUTFILE?=recter$(GOEXE)
CGO_ENABLED?=0 

build:
	CGO_ENABLED=0 go build $(GOTAGS) -o "$(OUTFILE)" -v -trimpath -modcacherw -mod=readonly -ldflags="-s -w -extldflags=-static"
	go build $(GOTAGS) -o "$(OUTFILE)" -v -trimpath -modcacherw -mod=readonly -ldflags="-s -w -extldflags=-static"

IMAGENAME=recter
REPO=mpldr


@@ 16,7 17,7 @@ docker:

push:
	docker tag ${IMAGEFULLNAME} ${REPO}/${IMAGENAME}:latest
	docker push ${IMAGEFULLNAME}
	docker push ${IMAGEFULLNAME} ${REPO}/${IMAGENAME}:latest

clean:
	rm recter

M main.go => main.go +3 -1
@@ 4,10 4,11 @@ import (
	"net"
	"os"

	"internal/handler"

	"git.sr.ht/~poldi1405/glog"
	"github.com/spf13/viper"
	"github.com/valyala/fasthttp"
	"internal/handler"
)

var Version = "devel"


@@ 27,6 28,7 @@ func main() {
		address = viper.GetString("Network.ListenAddr")
	case "unix":
		address = viper.GetString("Network.SocketPath")
		defer os.Remove(address)
	default:
		glog.Fatalf("invalid network type '%s'. Allowed types are tcp{,4,6} and unix", viper.GetString("Network.Type"))
		os.Exit(1)