- Does not support nested functions
- Must use variable/lambda assignment:
func main() {
test := func() {
println("Hello")
}
test()
}
- Uses
go
keyword for threading stuff:
func main() {
go func() {
println("Hello")
}()
}
-
No
Array.prototype.map
alternative - Not an FP language -
No generics until v2 (https://go2goplay.golang.org/)
-
chan
used for multi-go routing communication- Cannot be accessed using indices
-
range
supports indexes and values but not onchan
(only values) -
No
range()
method like there is in Python, instead use typical for loops https://stackoverflow.com/questions/21950244/is-there-a-way-to-iterate-over-a-range-of-integers
go mod init
to start projectgo run file.go
to run project
Use go install instead:
$ go install golang.org/x/tools/gopls@latest
$ go install golang.org/x/tools/gopls@v0.6.4
$ go install golang.org/x/tools/gopls
$ go install ./cmd/...
Switch case based on type https://tour.golang.org/methods/16
Using the 'go doc' command is helpful. You can find out more about a package. Or about a function inside the package. EXAMPLE: go doc time. Now