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

gocsi.sh assumes GOPATH is a single value #148

Open
cornfeedhobo opened this issue Sep 26, 2021 · 1 comment · May be fixed by #151
Open

gocsi.sh assumes GOPATH is a single value #148

cornfeedhobo opened this issue Sep 26, 2021 · 1 comment · May be fixed by #151

Comments

@cornfeedhobo
Copy link

Summary

gocsi.sh assumes GOPATH is a single value

Bug Reports

the generator script doesn't handle GOPATH gracefully when multiple entries are present, which is the default:

$ go help gopath
[snip]
The GOPATH environment variable lists places to look for Go code.
On Unix, the value is a colon-separated string.
On Windows, the value is a semicolon-separated string.
On Plan 9, the value is a list.

Version

632c7b6c

Expected Behavior

gopath should be respected

Actual Behavior

gopath is not respected

Steps To Reproduce

$ export GOPATH=/path/to/personal:/path/to/global:/random/other/path
$ bash gocsi.sh github.com/username/reponame
$ ls /path/to/personal\:/path/to/global\:/random/other/path/src/github.com/username/reponame

It blindly injects GOPATH

Logs

nope

@cornfeedhobo
Copy link
Author

After a brief investigation, the issue is with the usage of awk. It's not using : as a separator.

You need this if you want it to work as currently written:

$ echo $GOPATH | awk -F: '{print $1}'

However, I think you should consider using the last path instead:

$ echo $GOPATH | awk -F: '{print $NF}'

@cornfeedhobo cornfeedhobo linked a pull request Oct 20, 2021 that will close this issue
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

1 participant