News for hackers. Stuff that matters.
Re:Traitor: Linux privilege escalation made easy by iso1631 on Monday February 22, 2021 @11:20AM (#26226263)
Well that failed rather misterably

  package github.com/liamg/traitor/cmd/traitor: mkdir /home/test/go: not a directory
Does go assume that you have a directory in $HOME that is for it's own personal use?
Re:Traitor: Linux privilege escalation made easy by nonameiguess on Monday February 22, 2021 @08:29PM (#26232874)
He obviously wasn't clear enough about this, but if you're just trying to use the tool, download the binary release. Don't use go get as an installer. They're trying to be multi-OS compatible, an autotools that doesn't assume every system has a /usr/local or whatever the Windows equivalent but not assuming everyone has a %USERPROFILE%\AppData\Local\Low\Roaming or whatever. It does assume everyone has a home directory and an environment variable indicating where that is.
Re:Traitor: Linux privilege escalation made easy by oauea on Monday February 22, 2021 @11:55AM (#26226750)
Not since 2019: https://blog.golang.org/using-go-modules

The project has to opt into it, which appears to be the case here since there is a `go.mod` file. Are you using a modern version of Go?

Re:Traitor: Linux privilege escalation made easy by axaxs on Monday February 22, 2021 @12:00PM (#26226827)
If you opt into modules, modules get stored in GOPATH. If you don't use modules...source gets downloaded into GOPATH. If GOPATH is unset, it uses ~/go.
Re:Traitor: Linux privilege escalation made easy by arghwhat on Monday February 22, 2021 @02:28PM (#26229265)
1. If you opt into modules, $GOMODCACHE is used for go mod downloads. It defaults to $GOPATH/pkg/mod.

2. If you don't use modules, $GOPATH is used.

3. If $GOPATH isn't set, it defaults to ~/go.

Re:Traitor: Linux privilege escalation made easy by tsimionescu on Monday February 22, 2021 @04:14PM (#26230731)
Actually, modules are still downloaded to a global location, they are not copied locally to your project by default.
Re:Traitor: Linux privilege escalation made easy by oauea on Tuesday February 23, 2021 @11:42AM (#26239393)
Well yes, but most languages have some kind of cache in the home folder.
Re:Traitor: Linux privilege escalation made easy by tsimionescu on Friday February 26, 2021 @02:17AM (#26272134)
So yes, go does "assume that you have a directory in $HOME that is for it's own personal use?"
Re:Traitor: Linux privilege escalation made easy by axaxs on Monday February 22, 2021 @11:22AM (#26226287)
Yes, that's precisely what it does.
Re:Traitor: Linux privilege escalation made easy by Filligree on Monday February 22, 2021 @11:50AM (#26226674)
And good luck making it fit in a multi-language project of any kind.
Re:Traitor: Linux privilege escalation made easy by smokey_circles on Monday February 22, 2021 @12:59PM (#26227791)
well, no. that's just default behavior.

and it's also just for depedencies it downloads.

_your_ code lives where you put it

Re:Traitor: Linux privilege escalation made easy by Filligree on Monday February 22, 2021 @03:33PM (#26230189)
I spent days, a few years ago, trying to figure out how to do that. When I asked on the IRC channel, they just made fun of me.

Perhaps that's changed, but it put me off the language entirely.

Re:Traitor: Linux privilege escalation made easy by axaxs on Monday February 22, 2021 @04:00PM (#26230542)
Not just you. I've been using Go for many years, and while I enjoy the language I always found the environment of it awkward and unfriendly. Envvars on top of envvars. Work only in GOPATH, no wait, stop working in GOPATH. Vendor things...no wait don't do that either.

I think a lot of it is just growing pains, but it still feels clunky. My system has a .cache folder that everything already uses, why does Go need a special cache?

Re:Traitor: Linux privilege escalation made easy by tinco on Monday February 22, 2021 @04:47PM (#26231107)
They didn't consider it a cache, they consider your gopath to be the place where you put all source code, your own, and that of all your dependencies.
Re:Traitor: Linux privilege escalation made easy by colejohnson66 on Monday February 22, 2021 @05:51PM (#26231755)
That seems... a bit much IMO. I personally prefer containerizing things. Such as Node.js’ way with node_modules. Then I can put my project wherever I want. Downloaded dependencies can also go in ~/.cache because I don’t plan on editing them.
Re:Traitor: Linux privilege escalation made easy by Groxx on Monday February 22, 2021 @11:42PM (#26233888)
Go projects using modules are permissive about where you put them (e.g. they don't have to be inside a GOPATH at the right location). It does still use a GOPATH for caching directories though, which seems normal enough. They have to go somewhere, usually declared in some env variable, or they have to have a default location and silently spread files all over. `go get` is not a binary installer, it's a go-project-downloader that happens to also be able to install binaries, so this is IMO expected as it doesn't toss the intermediate products (i.e. a temp folder is not a reasonable choice).

As for multi-language projects and conflicting layout needs: oh yeah, that's still terrible. Maybe try Bazel? It can break `go`(the CLI binary)'s rules and build any package from any source files, regardless of their locations. None of that is part of the language spec, `go` is just opinionated and inflexible (probably for simplicity).

Re:Traitor: Linux privilege escalation made easy by tinco on Monday February 22, 2021 @04:46PM (#26231095)
Everyone had this experience, that's why after years and years they finally changed that behaviour.
Re:Traitor: Linux privilege escalation made easy by spinny on Monday February 22, 2021 @12:46PM (#26227567)
Go uses $GOPATH to save it's own packages/binaries but uses $HOME/go if $GOPATH is not set. Originally needed $GOPATH to be set, but that changed later
Re:Traitor: Linux privilege escalation made easy by z3t4 on Monday February 22, 2021 @01:35PM (#26228387)
I guess if it can't write to /home/test your system is safe...
Re:Traitor: Linux privilege escalation made easy by iso1631 on Monday February 22, 2021 @02:36PM (#26229409)
I have a file - /home/test/go, which consisted of some script I'd knocked up a few months ago