![]() You can create Go package, as well importing shared ones. Prints : hello, world Some References and utilities: Import a Go package: Since we have $GOPATH/bin added to our $PATH, you can run your program from placement : $ hello If you wish to compile it and move it to $GOPATH/bin, then run: $ go install hello.go Run your first Go program by executing: $ go run hello.go $GOPATH/pkg : contains every package objectsĬreate a file in your $GOPATH/src, in my case hello.go $GOPATH/src : Where your Go projects / programs are located bashrc fileĮxport GOPATH=$HOME/go-workspace # don't forget to change your path correctly!Ĭreate the workspace directories tree: $ mkdir -p $GOPATH $GOPATH/src $GOPATH/pkg $GOPATH/bin Then add those lines to export the required variables # This is actually your. One of does files located at your home directory bash_profile, bashrc or. ![]() We'll add some environment variables into shell config. For more information consult : How to write Go Codeįirst, you'll need to tell Go the location of your workspace. Go has a different approach of managing code, you'll need to create a single Workspace for all your Go projects. Setup the workspace: Add Environment variables: When installed, try to run go version to see the installed version of Go. Go (golang programming language) Install Golang with Homebrew: $ brew update
0 Comments
Leave a Reply. |
Details
AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |