chore: migrate to Go modules
This commit is contained in:
@@ -3,25 +3,24 @@ SHELL := /bin/zsh
|
||||
PLATFORM=linux
|
||||
# ARCH := $(shell go env GOARCH)
|
||||
ARCH := amd64
|
||||
GOPATH := $(shell go env GOPATH)
|
||||
GOBIN := $(GOPATH)/bin
|
||||
TARGET := websocket-proxy
|
||||
# Go related variables.
|
||||
GO_PATH := $(PWD):$(PWD)/vendor:$(GOPATH)
|
||||
VERSION := 0.0.1
|
||||
ifeq (run,$(firstword $(MAKECMDGOALS)))
|
||||
# use the rest as arguments for "run"
|
||||
RUN_ARGS := $(wordlist 2,$(words $(MAKECMDGOALS)),$(MAKECMDGOALS))
|
||||
# ...and turn them into do-nothing targets
|
||||
# $(eval $(RUN_ARGS):;@:)
|
||||
# Allow the remaining goals to be passed through as bootstrap servers.
|
||||
%:
|
||||
@:
|
||||
endif
|
||||
|
||||
.PHONY: all build docker run vendor update-deps
|
||||
|
||||
all: build docker
|
||||
|
||||
build:
|
||||
@echo ".:: buiding binary for $(PLATFORM) ::."
|
||||
@echo ".:: building binary for $(PLATFORM) ::."
|
||||
@rm -f $(TARGET)
|
||||
@GOPATH=$(GO_PATH) GOOS=$(PLATFORM) GOARCH=$(ARCH) go build -o $(TARGET) .
|
||||
@GOOS=$(PLATFORM) GOARCH=$(ARCH) go build -o $(TARGET) .
|
||||
|
||||
docker:
|
||||
@echo ".:: building docker image ::."
|
||||
@@ -33,7 +32,11 @@ run:
|
||||
@go run serv.go -addr :9000 --bootstrap-servers $(RUN_ARGS)
|
||||
|
||||
vendor:
|
||||
@echo ".:: update submodule ::."
|
||||
@git submodule init
|
||||
@git submodule update
|
||||
@dep update
|
||||
@echo ".:: synchronizing vendored Go modules ::."
|
||||
@go mod vendor
|
||||
|
||||
update-deps:
|
||||
@echo ".:: updating Go dependencies ::."
|
||||
@go get -u ./...
|
||||
@go mod tidy
|
||||
@go mod vendor
|
||||
|
||||
Reference in New Issue
Block a user