shell-etc icon indicating copy to clipboard operation
shell-etc copied to clipboard

remove /usr/share/gocode and ~/.local/gocode from $GOPATH

Open aerth opened this issue 8 years ago • 5 comments

This will work with PR #153 to allow users to use go right away

aerth avatar Apr 19 '17 08:04 aerth

Hi, and thanks for the pull request :)

Could you describe what are the issues you encounter with go, and what is special about ~/go ? Also, /usr/share/gocode contains system-wide installs of Go packages for Debian, is it truly necessary to remove it?

KellerFuchs avatar Apr 19 '17 23:04 KellerFuchs

@KellerFuchs , in recent Go versions, GOPATH variable is ~/go by default

$GOPATH should be user writable, and is where all user source live

To give an example,

# get new package using 'git', and install to $GOPATH/bin
go get -v github.com/golang/example/hello

# run the compiled binary
./go/bin/hello

I had to unset GOPATH to go get packages, because i can't write to /usr/share/gocode

Also, /usr/share/gocode doesn't exist

'System-wide install of go packages' doesn't make sense. Things like gocode, godoc, goimports, and other go tools can still be in /usr/share/gocode/bin but just added to $PATH

GOROOT is usually /usr/local/go and contains a full go tree, including source and go tools such as godoc, and the go compiler 'go'

$GOROOT/bin must be placed before /usr/bin because /usr/bin/go is go version go1.3.3 linux/amd64 which is way outdated

aerth avatar Apr 20 '17 00:04 aerth

@aerth As said on IRC, Debian has Go lib packages that do install their sources under /usr/share/gocode. However, it seems we got rid of those, so we can simplify the GOPATH and switch to the new default value.

Regarding $GOROOT/bin vs /usr/bin, the Debian packages for go ship the binaries in /usr/bin, so that's not needed. Again, as said 1.3.3 is the version shipped in Debian Jessie, and there is a PR ongoing to pull 1.7.5 from jessie-backports.

KellerFuchs avatar Apr 20 '17 01:04 KellerFuchs

BTW, this is how you can check which versions of a package are in the Debian archive:

% rmadison golang-go
debian:
 golang-go | 2:1.0.2-1.1       | wheezy           | amd64, armel, armhf, i386
 golang-go | 2:1.3.3-1~bpo70+1 | wheezy-backports | amd64, armel, armhf, i386
 golang-go | 2:1.3.3-1         | jessie           | amd64, armel, armhf, i386
 golang-go | 2:1.7~5~bpo8+1    | jessie-backports | amd64, arm64, armel, armhf, i386, ppc64el
 golang-go | 2:1.7~5           | stretch          | amd64, arm64, armel, armhf, i386, ppc64el
 golang-go | 2:1.7~5           | sid              | amd64, arm64, armel, armhf, i386, ppc64el
 golang-go | 2:1.8~1           | experimental     | amd64, arm64, armel, armhf, i386, ppc64el

KellerFuchs avatar Apr 20 '17 01:04 KellerFuchs

@aerth Sorry this is kinda stalled right now, as it depends on #153 and I've not been available to deal with some issues related to package deployments. I will be getting to this as soon as I can, though. :)

There is nothing you need to do, just letting you know I didn't forget about this.

KellerFuchs avatar Apr 24 '17 04:04 KellerFuchs