Quick start Go
Make a empty folder on desktop
Open it with VScode
Make a file named main.go leave it blank for now
Run
go mod init <name of project>
This will make a go.mod file, simple answer it where dependencies live
To add a dependency
go get <package name>
*NOTE*
Sometime the dependency do not want to play well so you may need to run this command and save a few times to make all the errors and warnings go away
go mod tidy
Basic hello world
This to the main.go file
package main
import (
"fmt"
)
func main(){
fmt.println("Hello world")
}
Run
go run main.go
Last updated