In Go, every Go source file (even the main.go file) must declare a package at the top of the file. This is a requirement of the Go language. The package declaration indicates which package the file belongs to and helps organize the code.
main.go
filetouch main.go
package main
import "fmt"
func main() {
fmt.Println("Hello world")
}
go run main.go