3
0
corteza/Makefile.inc
Denis Arh 8e3e3fdf76 Rework how tools (gin, gotest..) are installed, refactor watch command
Support newer version of gin, and add ability to use customize params, use different .env file
2022-01-21 15:30:58 +01:00

66 lines
1.7 KiB
Makefile

GO = go
GOINSTALL = $(GO) install
GOFLAGS ?= -trimpath
GOPATH ?= $(HOME)/go
CGO_ENABLED = 1
export GOFLAGS
export CGO_ENABLED
########################################################################################################################
# Tool bins
GOCRITIC = $(GOPATH)/bin/gocritic
MOCKGEN = $(GOPATH)/bin/mockgen
GOTEST = $(GOPATH)/bin/gotest
STATICCHECK = $(GOPATH)/bin/staticcheck
PROTOGEN = $(GOPATH)/bin/protoc-gen-go
PROTOGEN_GRPC = $(GOPATH)/bin/protoc-gen-go-grpc
GIN = $(GOPATH)/bin/gin
STATIK = $(GOPATH)/bin/statik
MODOUTDATED = $(GOPATH)/bin/go-mod-outdated
CODEGEN = build/codegen
PROTOC = /usr/local/bin/protoc
FSWATCH = /usr/local/bin/fswatch
# fswatch is intentionally left out...
BINS = $(GOCRITIC) $(MOCKGEN) $(GOTEST) $(STATICCHECK) $(PROTOGEN) $(GIN) $(STATIK) $(CODEGEN)
########################################################################################################################
# Go Toolset
$(GOCRITIC):
$(GOINSTALL) github.com/go-critic/go-critic@latest
$(MOCKGEN):
$(GOINSTALL) github.com/golang/mock/mockgen@latest
$(STATICCHECK):
$(GOINSTALL) honnef.co/go/tools/cmd/staticcheck@latest
$(PROTOGEN):
$(GOINSTALL) github.com/golang/protobuf/protoc-gen-go@latest
$(PROTOGEN_GRPC):
$(GOINSTALL) google.golang.org/grpc/cmd/protoc-gen-go-grpc@latest
$(GIN):
$(GOINSTALL) github.com/codegangsta/gin@latest
$(GOTEST):
$(GOINSTALL) github.com/rakyll/gotest@latest
$(STATIK):
$(GOINSTALL) github.com/goware/statik@latest
$(MODOUTDATED):
$(GOINSTALL) github.com/psampaz/go-mod-outdated@latest
$(CODEGEN):
$(GO) build -o $@ cmd/codegen/main.go
clean-tools:
rm -f $(BINS)