Install golang: GOLANG OFFICIAL
First, you should know the basic characteristics of go.
Go is compiled. If you need test your application before the build you can use:
$ go run nameOfMainFile.go
For basic build you can use:
$ go build nameOfMainFile.go
The main file always must have a main function like
package main // this is the name of package
func main(){ // func is the prefix of every function on go
// this is the main function
}
Packages is normally separated by directories and the functions are share with all the files. Like:
project
└── main.go
└── anotherFile.go
if your main file has the function called "calc" you can access this function on anotherFile.go using:
// It's anotherFile.go
package main // this is the name of package
func anotherFunction(){
calc() //
}
- Types in go
- Functions in go
- Pointers in go
- Interfaces in go
- Errors in go
- Tests in go
- Routines in go
- Channels in go (WRITING)
- HTTP communication in go
- Data Base communication in go (WRITING)
- The go mod (WRITING)