$GOPATH specifies the top-level directory containing source code for all our Go projects, this directory is known as Go Workspace

The default value of $GOPATH /home/username/go in Linux Distribution platform. On Windows platform is /user/username/go.

On the /home/username/go folder our Go workspace sub-folders must have the following which our task it create three (3) new sub-folders {src,bin,pkg}.

  • /home/username/go/src
  • /home/username/go/bin
  • /home/username/go/pkg

Our project folder will be sub-folder of /home/username/src, let say to print a hello world message. Create a new sub-folder “helloworld folder” under src folder. Inside the sub-folder helloworld, create a go source file “helloworld.go”.

Categories: Uncategorized