Links:
- Go Getting Start
- Tutorial
- W3 Schools
- Example
- geeksforgeeks
- GoLangPrograms
- Compile and Install
- DigitalOcean Tutorial
- Build and Install Go
Steps:
- Install go: https://go.dev/doc/install
Write some code
Create a directory:
mkcd helloInitialize:
go mod init example/helloCreatea file: hello.go
code hello.goAdd code:
package main import "fmt" func main() { fmt.Println("Hello, World!") }Run Code:
go run .
Call code in an external package
Install Module (like Pip in Python):
go get rsc.io/quoteAfter importing module add this to code:
package main import "fmt" import "rsc.io/quote" func main() { fmt.Println(quote.Go()) }Add new module requirements and sums.
go mod todyRun
go run .Build
go build .Execute
./hello