About
Go Script structure:
- The import declarations must follow the package declaration.
- The declarations of functions, variables, constants, and types (introduced by the keywords func, var, const, and type) in any order
Go does not require semicolons at the ends of statements or declarations, except where two or more appear on the same line. In effect, newlines following certain tokens are converted into semicolons, so where newlines are placed matters to proper parsing of Go code.
For instance:
- the opening brace { of the function must be on the same line as the end of the func declaration, not on a line by itself,
- in the expression x + y, a newline is permitted after but not before the + operator.