Go/Quick Start: Difference between revisions
< Go
Jump to navigation
Jump to search
| Line 27: | Line 27: | ||
= Work with 2 modules = | = Work with 2 modules = | ||
<syntaxhighlight lang="bash"> | |||
mkdir greetings | |||
go mod init sandbox/greetings | |||
</syntaxhighlight> | |||
<syntaxhighlight lang="bash"> | |||
mkdir sucks | |||
go mod init sandbox/sucks | |||
</syntaxhighlight> | |||
Revision as of 02:35, 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 .
Work with 2 modules
mkdir greetings
go mod init sandbox/greetings
mkdir sucks
go mod init sandbox/sucks