From c7e846e972fc23c6087c3fc143fd4e3a06bc8107 Mon Sep 17 00:00:00 2001 From: Leon Zhang Date: Thu, 25 Feb 2021 17:56:29 +0800 Subject: [PATCH] compatible with go 1.16 Go 1.16 The go command now builds packages in module-aware mode by default, even when no go.mod is present. This is a big step toward using modules in all projects. --- Makefile | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/Makefile b/Makefile index e935b7a..cb821b8 100644 --- a/Makefile +++ b/Makefile @@ -117,7 +117,7 @@ build: fmt @mkdir -p bin @ret=0 && for d in $$(go list -f '{{if (eq .Name "main")}}{{.ImportPath}}{{end}}' ./...); do \ b=$$(basename $${d}) ; \ - go build ${LDFLAGS} ${GCFLAGS} -o bin/$${b} $$d || ret=$$? ; \ + GO111MODULE=auto go build ${LDFLAGS} ${GCFLAGS} -o bin/$${b} $$d || ret=$$? ; \ done ; exit $$ret @echo "build Success!" @@ -182,7 +182,7 @@ release: build for d in $$(go list -f '{{if (eq .Name "main")}}{{.ImportPath}}{{end}}' ./...); do \ b=$$(basename $${d}) ; \ echo "Building $${b}.$${GOOS}-$${GOARCH} ..."; \ - CGO_ENABLED=0 GOOS=$${GOOS} GOARCH=$${GOARCH} go build ${GCFLAGS} ${LDFLAGS} -v -o release/$${b}.$${GOOS}-$${GOARCH} $$d 2>/dev/null ; \ + GO111MODULE=auto CGO_ENABLED=0 GOOS=$${GOOS} GOARCH=$${GOARCH} go build ${GCFLAGS} ${LDFLAGS} -v -o release/$${b}.$${GOOS}-$${GOARCH} $$d 2>/dev/null ; \ done ; \ done ;\ done -- GitLab