Go PATH not being passed to subprocesses (?)
See original GitHub issueKind of related to #107, but might be separate issue.
I have the following in my script:
- name: Install Go
uses: actions/setup-go@v3
with:
go-version: '>=1.18.0'
check-latest: true
When I run this action:
- run: |
go version
which go
it prints:
go version go1.18 linux/amd64
/opt/hostedtoolcache/go/1.18.0/x64/bin/go
I have a debuild script
- run: |
debuild -us -uc -ui
which has:
override_dh_auto_build:
go version
which go
which prints:
> go version
go version go1.15.15 linux/amd64
> which go
/usr/bin/go
I’m guessing 1.15.15 is preinstalled with the Ubuntu image, or something like that? I’m guessing this has to do with debuild
(haven’t tested with other programs/scripts yet) not passing along PATH, but this stills seems like a catalyst for confusion (rather than getting go: command not found
, all your builds are failing for no clear reason, or you’re compiling on an outdated version without knowing it).
I know that apt
installs Go differently from the recommended way (I think it creates a symlink in /usr/bin), so I think that’s what the issue is. It’s the same thing as if you were to try running sudo go <something>
, but export PATH=$PATH:/usr/local/go/bin
was in your .bashrc, but not root’s; it would fallback onto the apt
version (you can see in my example, I’m not running anything as root, but same result).
If that’s the case, it’s obviously not really a bug, but I think something could be done to prevent this from happening to people.
Issue Analytics
- State:
- Created a year ago
- Comments:5
Top GitHub Comments
Thanks @vsafonkin! I tried a few different variants of that, but wasn’t able to get any of them to work. I was able to reassign the executable, but the go args did not carry over properly, and I ended up compiling 1.15 packages (all imported package errored with import cycle)
I was able to confirm that
debuild
does sanitize PATH (unless specified otherwise). It’s late now, so I’ll post back with more info later.I did not work for me. I might have been doing something wrong though. Here’s what I did (from my commit):
Looking back, I’m pretty sure root would expand
$(which go)
, so I think I’m just an idiot. I’ll wait for #107 to resolve.