Anyone use $HOME as their $GOPATH?


(Emilio Vesprini) #1

I was thinking of doing that for convenience. Has anyone had any problems with name collisions?


(George Calianu) #2

I always use $HOME as $GOPATH.


(Aofei Sheng) #3

I’m using “/tmp/gopath” as my $GOPATH with $GO111MODULE=on and $GOBIN=/usr/local/bin. I think this way is the future. :wink:


(Emilio Vesprini) #5

So no troubles mixing go stuff with no go stuff in bin or src? awesome.


(George Calianu) #6

From my point of view is no problem to have $GOPATH in $HOME. More than this I also use an installer who build the entire Go environment based on $HOME as root for instalation and also for $GOPATH. I guess you shouldn’t make worries, having bin and src folder basically won’t interfere with nothing else.

If you have a mixed environment (let’s say you develop in other languages) can be a good idea to use src (source folder) also for other projects written in other languages (that’s what I’m doing).

Example of my $HOME folder structure (related to Go):

/bin
/go
  /bin
  /src
/src/
  /github.com
    /go_project
    /other_language_project
  /projects
    /go_project
    /other_language_project
  /tests

(Eric Lindblad) #7

From the Wiki.

FileTreeDocumentation, SettingGOPATH


(Emilio Vesprini) #8

From the Wiki.

FileTreeDocumentation, SettingGOPATH

Thanks <3


(Emilio Vesprini) #9

Actually, there’s no relevant info there.


(Eric Lindblad) #10

standardisation has its benefits for communication with other coders

that being said

C:\>TYPE %USERPROFILE%\go.bat
@ECHO off
ECHO go1.10.2
SET GOPATH=%USERPROFILE%

C:\>

on Un*x one could place a shell script in $HOME and source it

or one could code a modified variable in a user customisation file

if %USERPROFILE% contains blank spaces double quote the variable