Installing & Verifying GO in VS at MAC

go mod init hello
// 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))
}
go run <NAME_OF_FILE.go>
go run .
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.

--

--

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