General structure of Go program: Basic_structure.go
• Racing program Rental "Enterprise E: 217 1793 408"
go programs are organized through the package
• Only packages with a package name called Main can contain the main function
• One executable program has and only one main package
• Importing other non-main packages via the Import keyword
• Define constants by using the Const keyword
• Declare a global variable by using the var keyword outside the body of the function to assign a value
• Declaration of a struct (struct) or interface (interface) by using the Type keyword
• via the Func keyword
Visibility rules
go language, use casing to determine the constant, variable, type, interface, structure,
or whether the function can be called by an external package
• The function name is private if the first letter is lowercase
The first letter of the function name is public
Package Main
The package name of the current program
Import "FMT"
To import additional packages
Const PI = 3.13
Constants are defined with a const modifier, with names all capitalized
var a string = "Hello"
var b = 123//Automatic type recognition
Declaration and assignment of global variables, global variables can be used throughout the package
Type name int
Basic type declaration
Type Gopher struct {
Age int
Sex int
Declaration of the}//structure
Type Golang Interface {}
Definition of the interface
Func Main () {
Fmt. Println ("Hello,word")
}