Go uses semicolons under the hood. But the developer should never add them themselves.

If the last token before a newline is any of the following, the lexer inserts a semicolon after the token:

  • An identifier (which includes words like int and float64)
  • A basic literal such as a number or string constant
  • One of the tokens: break, continue, fallthrough, return, ++, --, ), or }

Example

func main()
{
    fmt.Println("Hello, world!")
}

is translated into

func main();
{
    fmt.Println("Hello, world!");
};

that is not a valid Go.