Setting $GOPATH environment variable for Unix/Linux and Windows
Go relies on one important environment variable called $GOPATH to determine where is the workspace located in your computer. To setup the $GOPATH environment variable in your computer, use this command :
export GOPATH=/home/userid/goworkspace
now, of couse the /home/userid/goworkspace
is for my own and you have to set the correct path for your own computer.
For Windows, use the SET
command
set GOPATH=c:\goworkspace
again, the c:\goworkspace
is just an example. Change it according to your own preference.
By Adam Ng
IF you gain some knowledge or the information here solved your programming problem. Please consider donating to the less fortunate or some charities that you like. Apart from donation, planting trees, volunteering or reducing your carbon footprint will be great too.
Advertisement
Tutorials
+12.9k Golang : package is not in GOROOT during compilation
+6.4k Golang : Check from web if Go application is running or not
+15.4k Golang : Defer function inside init()
+7.4k Golang : Capture text return from exec function example
+6.3k Golang : Ways to recover memory during run time.
+11.3k Python : Convert IPv6 address to decimal and back to IPv6
+22k Golang : Check if element exist in map
+17.3k Golang : Convert seconds to human readable time format example
+20.8k Golang : Round float to precision example
+14.8k Golang : read gzipped http response
+7.8k Golang : Scramble and unscramble text message by randomly replacing words
+4.9k Golang : Handling image beyond OpenCV video capture boundary