Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

build: respect GOBIN when using make targets #12077

Merged
merged 1 commit into from
Feb 16, 2022
Merged

Conversation

shoenig
Copy link
Member

@shoenig shoenig commented Feb 16, 2022

This PR updates GNUMakefile to respect $GOBIN if it is set in the
environment or via an $GOENV file. Previously we hard-coded the output
to $GOPATH/bin, which is not necessarily the desired behavior.

https://pkg.go.dev/cmd/go#hdr-Environment_variables

This PR updates GNUMakefile to respect $GOBIN if it is set in the
environment or via an $GOENV file. Previously we hard-coded the output
to $GOPATH/bin, which is not necessarily the desired behavior.
@@ -12,7 +12,13 @@ ifneq (MSYS_NT,$(THIS_OS))
# GOPATH supports PATH style multi-paths; assume the first entry is favorable.
# Necessary because new Circle images override GOPATH with multiple values.
# See: https://discuss.circleci.com/t/gopath-is-set-to-multiple-directories/7174
GOPATH=$(shell go env GOPATH | cut -d: -f1)
GOPATH := $(shell go env GOPATH | cut -d: -f1)
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

drive by improvement (= vs :=)

https://stackoverflow.com/a/6283363

@shoenig shoenig marked this pull request as ready for review February 16, 2022 18:20
@shoenig shoenig requested review from schmichael and lgfa29 February 16, 2022 18:20
Copy link
Contributor

@lgfa29 lgfa29 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

TIL about GOBIN (and all those other env vars)

@shoenig shoenig merged commit 3ebfd7b into main Feb 16, 2022
@shoenig shoenig deleted the b-makefile-use-gobin branch February 16, 2022 19:25
@github-actions
Copy link

I'm going to lock this pull request because it has been closed for 120 days ⏳. This helps our maintainers find and focus on the active contributions.
If you have found a problem that seems related to this change, please open a new issue and complete the issue template so we can capture all the details necessary to investigate further.

@github-actions github-actions bot locked as resolved and limited conversation to collaborators Oct 29, 2022
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants