Frequently used commands
go env
go help
go get
go run
go build
go fmt
go install
go test // with '_test.go' at he end of File
go doc
Built in keywords(25,and all lowercase)
break default func interface select
case defer go map struct chan else
goto package switch const fallthrogh
if range type continue for import return
var
Annotation method
// Annotation
/* Annotation */
basic_structure.go
// the package name of the current program
package main
// import other packages
import "fmt"
// definition of constants
const PI = 3.14
// declaration and assignment of global variables
var name="goher"
// general type decalration
type newType int
// decalaration of structure
type gopher struct{}
// decalaration of interface
type golang interface{
}
// it is started by the 'main' function as the program entry point
func main() {
Println("hello world! ")
}