LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Slackware (https://www.linuxquestions.org/questions/slackware-14/)
-   -   GoLang (https://www.linuxquestions.org/questions/slackware-14/golang-4175707706/)

ndavilam 02-08-2022 05:08 PM

GoLang
 
hi friends,
Slackware 15.0 has version GO 1.16.5 but I have version 1.17.6 in another directory. even though my version is included in /etc/profile.d/golang.sh, it always takes the system one.
Where can I change this?

ppr:kut 02-09-2022 01:09 AM

Did you re-login after installing the newer go?

sairum 02-09-2022 04:23 AM

AFAIK Slackware 15.0 does not ship any Go binaries. Either you installed them via SlackBuilds or you used AlienBob's binary package which is currently at version 1.17.5. If you have 1.16.15 it's because you installed it previously. Either remove that package or upgrade it to 1.17.5.

PS: Slackware provides Go through the Gnu compiler (gccgo)

ndavilam 02-09-2022 08:09 AM

Quote:

Originally Posted by sairum (Post 6327361)
AFAIK Slackware 15.0 does not ship any Go binaries. Either you installed them via SlackBuilds or you used AlienBob's binary package which is currently at version 1.17.5. If you have 1.16.15 it's because you installed it previously. Either remove that package or upgrade it to 1.17.5.

PS: Slackware provides Go through the Gnu compiler (gccgo)

Hi sairum,
My Slackware installation is clean, I have never installed GO(alienbob or any 3rd party repository).
I have always downloaded GO and put it in a path on my backup disk and add it to /etc/profile.d/golang.sh

And I'm surprised to see in /usr/bin/go
terminal:
go version go1.16.5 gccgo (GCC) 11.2.0 linux/amd64

drumz 02-09-2022 08:17 AM

Quote:

Originally Posted by nestorv.davilam (Post 6327205)
hi friends,
Slackware 15.0 has version GO 1.16.5 but I have version 1.17.6 in another directory. even though my version is included in /etc/profile.d/golang.sh, it always takes the system one.
Where can I change this?

Do you put your custom go path at the beginning or end of PATH? Can you show us your golang.sh?

/usr/bin/go is provided by gcc-go (a stock Slackware package), as already pointed out by sairum.

I suppose you could "removepkg gcc-go" if you want to get rid of GCC's go implementation (I didn't try this!).

ndavilam 02-09-2022 08:21 AM

Quote:

Originally Posted by drumz (Post 6327416)
Do you put your custom go path at the beginning or end of PATH? Can you show us your golang.sh?

/usr/bin/go is provided by gcc-go (a stock Slackware package), as already pointed out by sairum.

I suppose you could "removepkg gcc-go" if you want to get rid of GCC's go implementation (I didn't try this!).

I'll try something, I think it could be the name of the variable, I'm assuming.
Maybe the system is reading GOROOT/GOPATH and mine is GO_HOME.

ndavilam 02-09-2022 08:31 AM

Quote:

Originally Posted by drumz (Post 6327416)
Do you put your custom go path at the beginning or end of PATH? Can you show us your golang.sh?

/usr/bin/go is provided by gcc-go (a stock Slackware package), as already pointed out by sairum.

I suppose you could "removepkg gcc-go" if you want to get rid of GCC's go implementation (I didn't try this!).

No, my stupid idea didn't work.

drumz 02-09-2022 08:40 AM

Quote:

Originally Posted by nestorv.davilam (Post 6327422)
No, my stupid idea didn't work.

You still didn't show us your /etc/profile.d/golang.sh.

ndavilam 02-09-2022 08:41 AM

Quote:

Originally Posted by drumz (Post 6327425)
You still didn't show us your /etc/profile.d/golang.sh.

Sorry,

export GOROOT=/mnt/Backup/Tools/go
export PATH="$PATH:$GOROOT/bin"

drumz 02-09-2022 08:43 AM

Quote:

Originally Posted by nestorv.davilam (Post 6327427)
Sorry,

export GOROOT=/mnt/Backup/Tools/go
export PATH="$PATH:$GOROOT/bin"

Change it to:

Code:

export GOROOT=/mnt/Backup/Tools/go
export PATH="$GOROOT/bin:$PATH"


ndavilam 02-09-2022 08:45 AM

Quote:

Originally Posted by drumz (Post 6327428)
Change it to:

Code:

export GOROOT=/mnt/Backup/Tools/go
export PATH="$GOROOT/bin:$PATH"


I'll try and let you know how it goes

ndavilam 02-09-2022 08:48 AM

Quote:

Originally Posted by drumz (Post 6327428)
Change it to:

Code:

export GOROOT=/mnt/Backup/Tools/go
export PATH="$GOROOT/bin:$PATH"


are you a sorcerer? LoL

Thanks, I hope that this change does not bring consequences.

ndavilam 02-09-2022 08:51 AM

Quote:

Originally Posted by drumz (Post 6327428)
Change it to:

Code:

export GOROOT=/mnt/Backup/Tools/go
export PATH="$GOROOT/bin:$PATH"


But it's weird you know?
Because with the current version of Slackware 15 RC, I had no problems with Go previously

drumz 02-09-2022 08:53 AM

Quote:

Originally Posted by nestorv.davilam (Post 6327430)
are you a sorcerer? LoL

Thanks, I hope that this change does not bring consequences.

No, not a sorcerer (wouldn't a sorcerer know if he is one?) :)

The consequence is that any binary in /mnt/Backup/Tools/go/bin has preference over the rest of your PATH, like /usr/bin, /bin, etc.

Assuming you only have go tools in /mnt/Backup/Tools/go/bin and don't do anything silly like put an executable named "bash" in /mnt/Backup/Tools/go/bin/ you'll be fine.

This preference ordering is why /usr/local/bin comes before /usr/bin in Slackware's default PATH: it assumes anything in /usr/local/bin should take preference over anything in /usr/bin.

ndavilam 02-09-2022 09:04 AM

Another option would be to rebuild http://slackware.uk/slackware/slackw.../source/d/gcc/

This is correct?



Quote:

Originally Posted by drumz (Post 6327434)
No, not a sorcerer (wouldn't a sorcerer know if he is one?) :)

The consequence is that any binary in /mnt/Backup/Tools/go/bin has preference over the rest of your PATH, like /usr/bin, /bin, etc.

Assuming you only have go tools in /mnt/Backup/Tools/go/bin and don't do anything silly like put an executable named "bash" in /mnt/Backup/Tools/go/bin/ you'll be fine.

This preference ordering is why /usr/local/bin comes before /usr/bin in Slackware's default PATH: it assumes anything in /usr/local/bin should take preference over anything in /usr/bin.



All times are GMT -5. The time now is 12:36 AM.