go lang

Go lang Installation on mac os with Visual Studio Code.

Please click below to getting started with Go.

First, we have to download the binaries from the https://golang.org/doc/install page. Please visit to this page and download binaries specific to your OS.

Golang Website: https://golang.org/doc/install
Golang Install: https://golang.org/dl/
Visual Studio Code: https://code.visualstudio.com/

Once you downloaded the go language and visual studio code. Please go ahead and open a visual studio code editor. It will look like below.

Open the visual studio code and install the go plugin/extension which is official plugin from go team. Navigate to the Extensions pane (Ctrl+Shift+X). Search for “Go” and install this extension (the publisher ID is golang.Go).

To validate your go installation, please go ahead and check the go language version.

$ go version

$ go version go1.15.6 darwin/amd64

Some useful go tools

commanddescription
go buildcompiles packages and dependencies
go envprints Go environment information
go getadds dependencies to current module and installs them
go installcompiles and installs packages and dependencies
go listlists packages and modules
go runcompiles and runs a Go program
go versionprints Go version

Now let us go ahead and create one file Hello.go, once you create a file with an extension as go then it will show the go lang icon.

package main 

import "fmt"

func main() {
    fmt.Println("Go is simple but elegant")
}

In the above code snippet, we just printing the simple string. We have imported one package and in main() we have fmt.Println() which is helping us displaying the result on a console. To run the go programming please run the below command and enjoy the result. Please open terminal in visual studio code and fire below command in that.

$ go run Hello.go 
Go is simple but elegant
Conclusion:-

Please download and install and keep ready your local environment to test the go language test. Here I recommended to use visual studio code editor but you can use any editor which you are using daily life. Here we are using editor to make sure that we have proper tools ready in one integrated environment.

Source Code:
https://github.com/maheshwarLigade/spring-boot-examples
$ git clone https://github.com/maheshwarLigade/GoLanguage-tutorials
$ cd GoLanguage-tutorials
$ go run Hello.go