![]() ![]() Whether or not you use the default location, itâs a good idea to explicitly define GOPATH and to put the $GOPATH/bin directory in your executable path. ![]() You can use this default or specify a different workspace by setting the $GOPATH environment variable. ![]() By default, this workspace is located in $HOME/go, with source code for these tools stored in $HOME/go/src and the compiled binaries in $HOME/go/bin. However, Go still expects there to be a single workspace for third-party Go tools installed via go install (see âGetting Third-Party Go Toolsâ). Because of this churn, thereâs lots of conflicting advice, and most of it is obsolete.įor modern Go development, the rule is simple: you are free to organize your projects as you see fit. Since the introduction of Go in 2009, there have been several changes in how Go developers organize their code and their dependencies. If youâre on Linux or FreeBSD, itâs possible you installed the 64-bit Go development tools on a 32-bit system or the development tools for the wrong chip architecture. If it isnât the go command at /usr/local/go/bin/go, you need to fix your executable path. On Mac OS and other Unix-like systems, use which go to see the go command being executed, if any. If you get an error instead of the version message, itâs likely that you donât have go in your executable path, or you have another program named go in your path. (Darwin is the name of the kernel for Mac OS and amd64 is the name for the 64-bit CPU architecture from both AMD and Intel.) This tells you that this is Go version 1.15.2 on Mac OS. If everything is set up correctly, you should see something like this printed: go version go1.15.2 darwin/amd64 ![]() You can validate that your environment is set up correctly by opening up a terminal or command prompt and typing: $ go version Install the Go development tools only on computers that build Go programs. Go programs compile to a single binary and do not require any additional software to be installed in order to run them. ![]()
0 Comments
Leave a Reply. |
AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |