From 2b1a869aa819f8c97f391ff3742f7deaada26972 Mon Sep 17 00:00:00 2001 From: Igor Nemilentsev Date: Thu, 10 Feb 2022 13:36:03 +0300 Subject: [PATCH] Updated Makefile --- .github/workflows/go.yml | 2 +- Makefile | 12 +++++++++--- 2 files changed, 10 insertions(+), 4 deletions(-) diff --git a/.github/workflows/go.yml b/.github/workflows/go.yml index ebe3aee..4888a38 100644 --- a/.github/workflows/go.yml +++ b/.github/workflows/go.yml @@ -36,7 +36,7 @@ jobs: env: GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} with: - upload_url: ${{ steps.create_release.outputs.upload_url }} # This pulls from the CREATE RELEASE step above, referencing it's ID to get its outputs object, which include a `upload_url`. See this blog post for more info: https://jasonet.co/posts/new-features-of-github-actions/#passing-data-to-future-steps + upload_url: ${{ steps.release.outputs.upload_url }} # This pulls from the CREATE RELEASE step above, referencing it's ID to get its outputs object, which include a `upload_url`. See this blog post for more info: https://jasonet.co/posts/new-features-of-github-actions/#passing-data-to-future-steps asset_path: ./lingualeo asset_name: lingualeo asset_content_type: application/octet-stream diff --git a/Makefile b/Makefile index b641fa8..43e4c18 100644 --- a/Makefile +++ b/Makefile @@ -3,11 +3,13 @@ PWD := $(shell pwd) BASE_DIR := $(shell basename $(PWD)) # Keep an existing GOPATH, make a private one if it is undefined -GOPATH_DEFAULT := $(PWD)/.go +GOPATH_DEFAULT := $(shell go env GOPATH)/.go +OLD_PATH := ${PATH} export GOPATH ?= $(GOPATH_DEFAULT) GOBIN_DEFAULT := $(GOPATH)/bin export GOBIN ?= $(GOBIN_DEFAULT) export GO111MODULE := on +export PATH=${OLD_PATH}:${GOBIN} TESTARGS_DEFAULT := -v -race TESTARGS ?= $(TESTARGS_DEFAULT) PKG := $(shell awk '/^module/ { print $$2 }' go.mod) @@ -38,12 +40,15 @@ $(GOBIN): work: $(GOBIN) -build: clean check test +build: clean cache check test CGO_ENABLED=0 GOOS=$(GOOS) GOARCH=$(GOARCH) go build \ -ldflags $(LDFLAGS) \ -o $(BINARY) \ $(CMD_PACKAGE) +cache: + go clean --cache + install: clean check test CGO_ENABLED=0 GOOS=$(GOOS) GOARCH=$(GOARCH) go install \ -ldflags $(LDFLAGS) \ @@ -63,7 +68,8 @@ ifndef HAS_GOIMPORTS echo "installing goimports" GO111MODULE=off go get golang.org/x/tools/cmd/goimports endif - goimports -d $(shell find . -iname "*.go") + goimports -d $(shell find . -path ./.go -prune -o -type f -iname "*.go") + find . -iname "*.go" vet: go vet ./...