Are you and your team new to Go? Could you use some expert advice? Check out my Comprehensive Go Code Audit service!

Unlocking the Power of Infrastructure as Code, Go, & More on Schematical
Unlocking the Power of Infrastructure as Code, Go, & More
Writing Go and doin' DevOps on Backend Banter
Listen as I discuss Go, DevOps, and more, with Lane Wagner on the Backend Banter podcast.
Talking DevOps, Go and Continuous Delivery in Reverse on the Lovin' Legacy podcast
I join the Lovin' Legacy podcast to talk about DevOps, the Go language, and implementing Continuous Delivery in reverse. Have a listen.
Subscribe to the Daily Commit
Every day I write about improving software delivery at small companies like yours. Don't miss out! I will respect your inbox, and honor my privacy policy.Unsure? Browse the archive.

Lexical elements: Keywords, Operators and punctuation
Keywords The following keywords are reserved and may not be used as identifiers. break default func interface select case defer go map struct chan else goto package switch const fallthrough if range type continue for import return var Operators and punctuation The following character sequences represent operators (including assignment operators) and punctuation: + & += &= && == != ( ) - | -= |= || < <= [ ] * ^ *= ^= <- > >= { } / << /= <<= ++ = := , ; % >> %= >>= -- !

Lexical elements: Identifiers
Identifiers Identifiers name program entities such as variables and types. An identifier is a sequence of one or more letters and digits. The first character in an identifier must be a letter. identifier = [letter](https://go.dev/ref/spec#letter) { [letter](https://go.dev/ref/spec#letter) | [unicode_digit](https://go.dev/ref/spec#unicode_digit) } . So in other words, every identifier must begin with a letter, followed by zero or more letters and/or digits. Pretty simple. The spec offers a few examples a _x9 ThisVariableIsExported αβ That second one looks a bit suspicious.

Lexical elements: Semicolons
Go’s use of semicolons is one area of confusion for newcomers to the language. It certainly was for me. But it’s more intuitive than it seems. Here’s the formal explanation: Semicolons The formal syntax uses semicolons ";" as terminators in a number of productions. Go programs may omit most of these semicolons using the following two rules: When the input is broken into tokens, a semicolon is automatically inserted into the token stream immediately after a line’s final token if that token is

Lexical elements: Tokens
Tokens Tokens form the vocabulary of the Go language. There are four classes: identifiers, keywords, operators and punctuation, and literals. White space, formed from spaces (U+0020), horizontal tabs (U+0009), carriage returns (U+000D), and newlines (U+000A), is ignored except as it separates tokens that would otherwise combine into a single token. Also, a newline or end of file may trigger the insertion of a semicolon. While breaking the input into tokens, the next token is the longest sequence of characters that form a valid token.