Jump to content

Go From Scratch/The Language

From Wikibooks, open books for an open world

Go is...

- Static instead of Dynamic, meaning that you need to define the types you are using instead of letting the computer guess at what types are being used.

- Compiled rather than interpreted. This means your program is converted into direct machine code at the start when it is compiled before running. This may lead to some efficiencies as there isn't an extra step to running the code. However, it does mean that code cannot easily be dynamically modified.

- Concurrent rather than strictly sequential. Go allows you to more easily write and think about concurrent processes. This allows for certain types of problems (common in web/server development) to be built with simpler designs; by breaking up more complex tasks into smaller ones that are coordinated by communicating with each other. An added advantage to this design is that it allows these smaller tasks to run in parallel.

- Memory-safe. This means Go handles your usage of memory to prevent going out of bounds and crashing your program (or worse).

- Garbage-collected. This means memory data that will no longer be used is freed up for reuse, and your still-used data can be stored more efficiently.