In this series article, I want to note some tips during watching Golang courses that are important for me.
Overall points :
- golang is a compiled programming language
- like as c and c++ it needs a main function
- all built in functions are not available like as php and you need to import situble library
- you cant define unused variable , function or even import unused library.
- to print we need to import “fmt” library
- it needs to specify variable type on definitions
some usefull commands:
go mod init mymodule
go run main.go
Golang Data types list

Array and slice in golang
#array :
var booking [50]string
or
var booking = [50]string{"masoud"}
#slice
var booking []string
or istead of "var" we can use ":="
booking :=[]string
add an index to a slice
append(booking, firstName + "- "+ lastName)
loop in Golang
we have just “for” loop in golang
to ignore a variable you dont want to use you can use “unser line” => “_”
so with Go you need to make unused variables explicit
for example :
firstNames := []string{}
for _, bookingItem := range booking {
var names = strings.Fields(bookingItem)
firstNames = append(firstNames, names[0])
}