December 2018
Intermediate to advanced
500 pages
12h 19m
English
The go fmt tool automatically formats Go source code. This includes tabs for indentation and blanks for alignment. For example, look at the following code snippet:
package mainimport "fmt"// sample code to demo // gofmt var b int=2;func main(){a := 1;fmt.Println(" a,b : "); fmt.Println(a);fmt.Println(b); }
It will be formatted to the following:
package mainimport "fmt"// sample code to demo// gofmtvar b int = 2func main() { a := 1 fmt.Println(" a,b : ") fmt.Println(a) fmt.Println((b))}
This happens thanks to Go fmt.
Read now
Unlock full access