mkdir hello_world
go mod init example.com/hello_world
to init a Go module in the cwd- Create a
go
file with apackage main
and afunc main()
go build
to create an executable with the module name that can be run with./hello_world
- or
go run .
Search
mkdir hello_world
go mod init example.com/hello_world
to init a Go module in the cwdgo
file with a package main
and a func main()
go build
to create an executable with the module name that can be run with ./hello_world
go run .