Go/Quick Start: Difference between revisions

From Fundamental Ramen
< Go
Jump to navigation Jump to search
Line 2: Line 2:


<syntaxhighlight lang="bash">
<syntaxhighlight lang="bash">
go mod init example.com/m
go mod init sandbox/hello
touch hello.go
</syntaxhighlight>
 
 
<syntaxhighlight lang="go">
package main
 
import "fmt"
 
func main() {
fmt.Println("Hello, World!")
}
</syntaxhighlight>
 
<syntaxhighlight lang="bash">
go run .
</syntaxhighlight>
</syntaxhighlight>


= Run =
= Run =

Revision as of 02:26, 22 May 2025

Create a module

go mod init sandbox/hello
touch hello.go


package main

import "fmt"

func main() {
	fmt.Println("Hello, World!")
}
go run .

Run