Skip to content

Commit fd89aec

Browse files
Update 01.2.md
It's better to use .profile instead of .bashrc. ${HOME} is better than fixed paths.
1 parent 2e09b9d commit fd89aec

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

en/01.2.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,13 +2,13 @@
22

33
## $GOPATH
44

5-
Go takes a unique approach to manage the code files with the introduction of a `$GOPATH` directory which contains all the go code in the machine. Note that this is different from the `$GOROOT` environment variable which states where go is installed on the machine. We have to define the $GOPATH variable before using the language, in *nix systems there is a file called `.bashrc` we need to append the below export statement to the file. The concept behind gopath is a novel one, where we can link to any go code at any instant of time without ambiguity.
5+
Go takes a unique approach to manage the code files with the introduction of a `$GOPATH` directory which contains all the go code in the machine. Note that this is different from the `$GOROOT` environment variable which states where go is installed on the machine. We have to define the $GOPATH variable before using the language, in *nix systems there is a file called `.profile` we need to append the below export statement to the file. The concept behind gopath is a novel one, where we can link to any go code at any instant of time without ambiguity.
66

77
Starting from go 1.8, the GOPATH environment variable now has a default value if it is unset. It defaults to $HOME/go on Unix and %USERPROFILE%/go on Windows.
88

99
In Unix-like systems, the variable should be used like this:
1010

11-
export GOPATH=/home/apple/mygo
11+
export GOPATH=${HOME}/mygo
1212

1313
In Windows, you need to create a new environment variable called GOPATH, then set its value to `c:\mygo`( ***This value depends on where your workspace is located*** )
1414

0 commit comments

Comments
 (0)