Go is a statically typed, compiled high-level programming language designed at Google by Robert Griesemer, Rob Pike, and Ken Thompson. It is syntactically similar to C, but with memory safety, garbage collection, structural typing, and CSP-style concurrency.
For setup we need two thing:
- GO Compiler
- IDE for writing codes (Here I am using VS Code)
Now Install GO Compiler after installation, checking if the go compiler is installed or not executing this command in CMD or terminal:
go version
Now Open VS Code and Hit Ctrl + Shift + X
There download the Go Extension
Create a file with go extension for example:
main.go
Then Open New Terminal in VS Code by Ctrl + Shift + `
Write this command to initialize Go mod
go mod init <folder name>
in my case it is:
go mod init Learning-GoLang
Now write your porgram and run it by:
go run <file name.go>
in my case:
go run main.go