Go/Quick Start: Difference between revisions
< Go
Jump to navigation
Jump to search
No edit summary |
|||
| Line 44: | Line 44: | ||
{| class="wikitable" | {| class="wikitable" | ||
! || | ! Thing || Naming Rule | ||
|- | |- | ||
| Module Name || | | Module Name || | ||
|- | |- | ||
| | | || | ||
|} | |} | ||
Revision as of 02:52, 27 July 2026
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 main greetings sucks
cd greetings
go mod init sandbox/greetings
cd ../sucks
go mod init sandbox/sucks
cd ../main
go mod init
go mod edit -replace sandbox/greetings=../greetings
go mod edit -replace sandbox/sucks=../sucks
go mod tidy
naming convention table
| Thing | Naming Rule |
|---|---|
| Module Name | |