Go/Quick Start: Difference between revisions
< Go
Jump to navigation
Jump to search
| Line 1: | Line 1: | ||
= Create a module = | = Create a module = | ||
Create module and source file. | |||
<syntaxhighlight lang="bash"> | <syntaxhighlight lang="bash"> | ||
| Line 6: | Line 8: | ||
</syntaxhighlight> | </syntaxhighlight> | ||
Add source code. | |||
<syntaxhighlight lang="go"> | <syntaxhighlight lang="go"> | ||
| Line 16: | Line 19: | ||
} | } | ||
</syntaxhighlight> | </syntaxhighlight> | ||
Run. | |||
<syntaxhighlight lang="bash"> | <syntaxhighlight lang="bash"> | ||
Revision as of 02:26, 22 May 2025
Create a module
Create module and source file.
go mod init sandbox/hello
touch hello.go
Add source code.
package main
import "fmt"
func main() {
fmt.Println("Hello, World!")
}
Run.
go run .