
3 min read
Constants don't overflow
Constants … Numeric constants represent exact values of arbitrary precision and do not overflow. Consequently, there are no constants denoting the IEEE-754 negative zero, infinity, and not-a-number values. Now this is a very interesting thing about constants in Go, and it’s something that confuses a lot of people. So let’s play around with this one a bit. If you’re experienced with compiled languages, you’re probably already familiar with numeric overflows.
7 min read
Book Review: Learning GO Programming
Very well organized, reasonable content, but the rampant grammatical errors are terribly distracting.

1 min read
Constants at compile time
Yesterday I made a passing comment in the last code example: Although x is not a constant, the result of len(x) is, because it is known at compile time. I want to dive into this aspect of constants in Go today. In Go (or at least most, if not all implementations of Go) a constant is logically replaced during compilation. This can be a useful mental shortcut when trying to determine whether a given expression can be a constant or not.
8 min read
Book Review: Beginning Go Programming
Full of factual errors, poorly edited, poorly organized. All around a bad book.

2 min read
Constants
Constants There are boolean constants, rune constants, integer constants, floating-point constants, complex constants, and string constants. Rune, integer, floating-point, and complex constants are collectively called numeric constants. So there we have it. A comprehensive list of the available constant types in Go. And all but boolean and string constants are numeric. Notice that none of the composite types can be constants in Go. You can’t have a constant array, slice, struct, or interface.

5 min read
Book Review: Learning Go
The focus for Learning Go isn't just how to write programs in Go; it's how to write Go idiomatically.

3 min read
Lexical elements: Interpreted string literals
A quick note that episode 2 of Cup o’ Go dropped today. Check it out! Picking up where we left off last week, we’re discussing string literals. Last week we talked about raw string literals, which leaves us now with interpreted string literals. To recap: String literals A string literal represents a string constant obtained from concatenating a sequence of characters. There are two forms: raw string literals and interpreted string literals.
Subscribe to Boldly Go: Daily
Every day I'll send you advice to improve your understanding of Go. Don't miss out! I will respect your inbox, and honor my privacy policy.
Unsure? Browse the archive.
6 min read
Book Review: Go Programming In Easy Steps
Is "Go Programming In Easy Steps" the way to learn Go in 2023?

3 min read
Lexical elements: Raw string literals
Now that I’ve bored you to death with more about rune literals than you ever asked, let’s take things up a level, and talk about strings. String literals A string literal represents a string constant obtained from concatenating a sequence of characters. There are two forms: raw string literals and interpreted string literals. Raw string literals are character sequences between back quotes, as in `foo`. Within the quotes, any character may appear except back quote.
7 min read
Book Review: Go Programming Language for Dummies
I review the book "Go Programming Language for Dummies" and offer my recommendation whether you should buy this book to learn Go.

3 min read
Lexical elements: Rune literals pt 3
Let’s continue our disection of rune literals. If you missed the parts, check them out from Monday when we discussed Unicode, and yesterday when we discussed quoting single characters. Today we’re looking at the various escape sequences supported by the rune literal syntax. Rune literals Several backslash escapes allow arbitrary values to be encoded as ASCII text. There are four ways to represent the integer value as a numeric constant: \x followed by exactly two hexadecimal digits; \u followed by exactly four hexadecimal digits; \U followed by exactly eight hexadecimal digits, and a plain backslash \ followed by exactly three octal digits.