chore: migrate to Go modules

This commit is contained in:
fengzhiqiang
2026-07-10 14:17:07 +08:00
parent ecfba6e209
commit 7c49f6d2c6
530 changed files with 247968 additions and 205 deletions
+15 -12
View File
@@ -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