Go on VS, installation


(Andrew Makkink) #1

HI Im trying to run Visual Studio to run Go on Linux Peppermint. I need to add some lines to the .bashrc file, but am afraid that I could break the whole system if O do the wrong thing. Would like to here from somebody that has had a similar experience.
Thanks


(Norbert Melzer) #2

Could you please point me to the download or purchase of visual studio for linux?

Also what lines do you need to add to your .bashrc? If its just some exports, then its unlikely that you break your system, but only your user, and still the user will be able to log in, but have an bash thats inconvinient… But by having a backup and reverting to this and carefully checking what one might have inserted wrong, it might be easy to roll back and repeat.


(Andrew Makkink) #3

When i type, in terminal, go version, I get 1.12.7, which indicated that the GOROOT part is OK. I need to add
export GOPATH=/home/ao/GO Space/golib
export PATH=$PATH:$PATH/bin
export GOPATH=$GOPATH:/home/ao/GO SPACE/code

There are a similar set of lines existing in the bashrc file, see below, pointing to different directories, probably the standard ones, with a different syntax. Is this just because I am using Peppermint rather than Ubuntu which is been used for the demonstration.

export GOPATH="$HOME/gocode"
export PATH="$PATH:${GOPATH//://bin:}/bin"
export GOPATH="$HOME/go"
export PATH="$PATH:${GOPATH//://bin:}/bin"

For the download I went into the Visual studio and downloaded the Deb file, just a few hours ago.
Thanks for the response
Andrew


(Norbert Melzer) #4

Do you plan to have your GO workspace in that folder? Or why do you think you want to have that setting?

To be honest, Since GO 1.9 there is no need to set GOPATH anymore, just use the default of ~/go, or since 1.12 use modules…

Anyway, if you really want to use that setting, you need to quote the path, as it contains a space ():

export GOPATH="/home/ao/GO Space/golib"

Also, as I try to keep my dot-RC files transferable, I’d use this:

export GOPATH="${HOME}/GO Space/golib"

This setting doesn’t make any sense at all.

I assume, what you really want is this:

export PATH=$PATH:$GOPATH/bin

But I would turn it around, that you locally installed go tools won’t be shadowed by system installed programs with the same name.

export PATH=$GOPATH/bin:$PATH

Again, since GO 1.9 I’d even omit the setting of GOPATH at all, and instead use this to configure the PATH:

export PATH="$(go env GOPATH)/bin":"${PATH}"

This will overwrite your previously set GOPATH, are you sure you want to do that?


You say those were already there? Who has added them?

Why are they duplicated? And why point they to different GOPATHs? At the end you should make sure, that there is only a single line to set and export the GOPATH, if at all. Also you shouldn’t bulk to much in the PATH especially not if you do not intend to actually use those segments…


I tried the community eddition, and I get directed straight to a windows installer. Are you perhaps talking about Visual Studio Code, which is a totally different product?


(Andrew Makkink) #5

Andy:
export GOPATH=/home/ao/GO Space/golib

Do you plan to have your GO workspace in that folder? Or why do you think you want to have that setting?

To be honest, Since GO 1.9 there is no need to set GOPATH anymore, just use the default of ~/go, or since 1.12 use modules…

Anyway, if you really want to use that setting, you need to quote the path, as it contains a space (``):

export GOPATH="/home/ao/GO Space/golib"This is where I wanted my work space to be, the Go Space folder but it doesn't really matter, as long as it works

Also, as I try to keep my dot-RC files transferable, I’d use this:


export GOPATH="${HOME}/GO Space/golib"


(Norbert Melzer) #6

As you replied by mail, I assume the partial and not annotated quote happened by accident, as well as the fact that it seems that there is not additional content from you.

Could you therefore try to repeat what you wanted to write?


(Andrew Makkink) #7

Do you plan to have your GO workspace in that folder? Or why do you think you want to have that setting?

To be honest, Since GO 1.9 there is no need to set GOPATH anymore, just use the default of ~/go , or since 1.12 use modules…

Anyway, if you really want to use that setting, you need to quote the path, as it contains a space ( `` ):

export GOPATH="/home/ao/GO Space/golib"
*This is where I wanted my work space to be, the Go Space folder but it doesn't really matter, as long as it works*

Also, as I try to keep my dot-RC files transferable, I’d use this:

export GOPATH="${HOME}/GO Space/golib"

Andy:

export PATH=$PATH:$PATH/bin

This setting doesn’t make any sense at all.

I assume, what you really want is this:

export PATH=$PATH:$GOPATH/bin

But I would turn it around, that you locally installed go tools won’t be shadowed by system installed programs with the same name.

export PATH=$GOPATH/bin:$PATH

Again, since GO 1.9 I’d even omit the setting of GOPATH at all, and instead use this to configure the PATH :

export PATH="$(go env GOPATH)/bin":"${PATH}"

Andy:

export GOPATH=$GOPATH:/home/ao/GO SPACE/code

This will overwrite your previously set GOPATH , are you sure you want to do that?

Andy:

export GOPATH="$HOME/gocode"
export PATH="$PATH:${GOPATH//://bin:}/bin"
export GOPATH="$HOME/go"
export PATH="$PATH:${GOPATH//://bin:}/bin"

You say those were already there? Who has added them?

I think these may have been added when I added the Microsoft Rich Go Language support fo visual studio, as it was the only one for Go available. And the software I am using is Visual Studio Code. I didn’t know they were different products. Thanks for the help again, much appreciated

Why are they duplicated? And why point they to different GOPATH s? At the end you should make sure, that there is only a single line to set and export the GOPATH , if at all. Also you shouldn’t bulk to much in the PATH especially not if you do not intend to actually use those segments…

Andy:

For the download I went into the Visual studio and downloaded the Deb file,

I tried the community eddition, and I get directed straight to a windows installer. Are you perhaps talking about Visual Studio Code, which is a totally different product?