This repository was archived by the owner on Mar 6, 2020. It is now read-only.
Include $PROJECT/bin in $PATH for gb generate#686
Open
pritambaral wants to merge 1 commit intoconstabulary:masterfrom
Open
Include $PROJECT/bin in $PATH for gb generate#686pritambaral wants to merge 1 commit intoconstabulary:masterfrom
gb generate#686pritambaral wants to merge 1 commit intoconstabulary:masterfrom
Conversation
06c44d8 to
8bb15ce
Compare
davecheney
suggested changes
May 10, 2017
cmd/gb/generate.go
Outdated
| Run: func(ctx *gb.Context, args []string) error { | ||
| env := cmd.MergeEnv(os.Environ(), map[string]string{ | ||
| "GOPATH": fmt.Sprintf("%s%c%s", ctx.Projectdir(), filepath.ListSeparator, filepath.Join(ctx.Projectdir(), "vendor")), | ||
| "PATH": fmt.Sprintf("%s%c%s", filepath.Join(ctx.Projectdir(), "bin"), filepath.ListSeparator, os.Environ["PATH"]), |
Contributor
There was a problem hiding this comment.
os.Environ returns a []string not a map, you should try os.Getenv("PATH") instead.
Please move the $PROJECT/bin to the end of the search path.
Thanks and sorry for the long review delay.
Author
There was a problem hiding this comment.
If $PROJECT/bin is at the end of the path, then a non-project installation (of say, a tool like msgp) would override a project-specific installation. I thought it would go well with the project-centric approach of gb to prefer the latter over the former.
Projects may want to use binaries in $PROJECT/bin in `//go:generate` Closes constabulary#630
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to subscribe to this conversation on GitHub.
Already have an account?
Sign in.
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Projects may want to use binaries in
$PROJECT/binin//go:generateCloses #630