Conventions used
There are a number of text conventions used throughout this book.
CodeInText: Indicates code words in text, database table names, folder names, filenames, file extensions, pathnames, dummy URLs, user input, and Twitter handles. Here is an example: " The make() function will create a slice of a certain type with a certain length and capacity."
A block of code is set as follows:
package main
import (
"fmt"
)
func main() {
// Basic for loop
for i := 0; i < 3; i++ {
fmt.Println("i:", i)
}
// For used as a while loop
n := 5
for n < 10 {
fmt.Println(n)
n++
}
}
When we wish to draw your attention to a particular part of a code block, the relevant lines or items are set in bold:
package main
import (
"fmt"
)
func main() {
// Basic for loop
for i := 0; i < 3; i++ {
fmt.Println("i:", i)
}
// For used as a while loop
n := 5
for n < 10 {
fmt.Println(n)
n++
}
}
Any command-line input or output is written as follows:
sudo apt-get install golang-go
Bold: Indicates a new term, an important word, or words that you see onscreen. For example, words in menus or dialog boxes appear in the text like this. Here is an example: " In Windows 10, this can be found by navigating to Control Panel | System |
Advanced System Settings | Environment Variables."