Installing & Verifying GO in VS at MAC

Step #1.) First download the GO-package :-

Step #2.) Proceed to install the GO-package, by double clicking on the same :-

Step #3.) Verify now, whether the GO has been installed or not ?

Step #4.) Verify the path, where GO has been installed ?

Step #5.) Verify the PATh variable, which would indicate where GO has been installed.

Step #6.) Now, head to VS-Studio Code and install the plugin of GO in VS :-

Step #7.) Now, In VSCode, goto View → Command Palette → Locate Configured GO Tools. With this, we can see output of GO related variables :-

Step #8.) Now, head to our working directory and create a file called as “go.mod” by this command and observe that, we have a new file being created under this directory.

go mod init hello

Step #9.) Let’s create a “main.go” file and write some sample code of GOLANG :-

// You can edit this code!
// Click here and start typing.
package main
import "fmt"
func main() {
var companies = [4]string{"Amazon", "Microsoft", "Yahoo", "Google"}
fmt.Println("Array of Strings is: ", companies)
var intArrays [5]int
intArrays[0] = 78
intArrays[1] = 85
intArrays[2] = 91
intArrays[3] = 93
intArrays[4] = 97
fmt.Println("Array of Integers is: ", intArrays)
fmt.Println("Size of IntegersArray is: ", len(intArrays))
fmt.Println("Size of StringArray is: ", len(companies))
}

Step #10.) Let’s now try running this sample go file by clicking on :- Run → Run Without Debugging.

Step #11.) Let’s observe the output of the same :-

Step #12.) Another way of executing the GO Programs is, using Integrated Terminal by using command :-

go run <NAME_OF_FILE.go>

Step #13.) We can also execute the GO files directly using below command too:-

go run .

Step #13.) We can also generate the Build along with RunTime from a given source file of GO :-

go build .
  • Upon performing the build operation, note that compiled binary file specifically designed for MAC operating-system, has been generated with name “hello”.
  • We can execute this executable binary directly ONLY at this particular OS i.e. MAC and it shall NOT work on Windows.

That’s all in this section. If you liked reading this blog, kindly do press on clap button multiple times, to indicate your appreciation. We would see you in next series.

References :-

--

--

--

Software Engineer for Big Data distributed systems

Love podcasts or audiobooks? Learn on the go with our new app.

Recommended from Medium

The five mentors every software developer needs and how to find them

Live Expert Session on Open Source Contributions, Kubernetes, Terraform, Cloud & DevOps.

Cloning original HD to SSD (Dell Inspiron 7460)

[How-to] Request IT Inventory Stock In AssetSonar

[How-to] Request IT Inventory Stock In AssetSonar

Cnc Machine Simulator

Traceback Writeup — HackTheBox

Learning a new programming language the right way.

Let’s see how to learn properly

Adding a Gif to your Github README

Get the Medium app

A button that says 'Download on the App Store', and if clicked it will lead you to the iOS App store
A button that says 'Get it on, Google Play', and if clicked it will lead you to the Google Play store
aditya goel

aditya goel

Software Engineer for Big Data distributed systems

More from Medium

Learning Go from Documentation #3 (Error handling)

Golang Debugging with Delve — [Step by Step]

How To Install And Setup Go Language On Ubuntu (Complete Guide)

How To Install And Setup Go Language On Ubuntu (Complete Guide)

Go(lang) playground