package main
import "fmt"
func main(){
fmt.Print("Hello world")
}
Explanation:
package main
- This defines the package name.
- Every Go program must start with
package
declaration. main
is special - it tells Go compiler that this file should be complied as an executable program(not a shared library).- The Go program will start execution in the
main
function inside themain
package.
Share this post
Related Posts
[Go Tutorials P2] Data types
April 20, 2025
[Go Tutorials P3] Variable Declaration
April 21, 2025
[Go Tutorials P4] Pointer
April 26, 2025