Share E-Book
Scan to open this page

Scan with your phone to open this page

Author: Jon Bodner [Jon Bodner]

Rating No ratings yet

This book is targeted at developers who are looking to pick up a second (or fifth) language. The focus is on people who are new to Go. This ranges from those who don’t know anything about Go other than it has a cute mascot, to those who have already worked through a Go tutorial or even written some Go code. The focus for Learning Goisn’t just how to write programs in Go; it’s how to write Go idiomatically. More experienced Go developers can find advice on how to best use the newer features of the language. The most important thing is that the reader wants to learn how to write Go code that looks like Go. Experience is assumed with the tools of the developer trade, such as version control (preferably Git) and IDEs. Readers should be familiar with basic computer science concepts like concurrency and abstraction, as the book explains how they work in Go. Some of the code examples are downloadable from GitHub and dozens more can be tried out online on The Go Playground. While an internet connection isn’t required, it is helpful when reviewing executable examples. Since Go is often used to build and call HTTP servers, some examples assume familiarity with basic HTTP concepts. While most of Go’s features are found in other languages, Go makes different tradeoffs, so programs written in it have a different structure. Learning Go starts by looking at how to set up a Go development environment, and then covers variables, types, control structures, and functions. If you are tempted to skip over this material, resist the urge and take a look. It is often the details that make your Go code idiomatic. Some of what seems obvious at first glance might actually be subtly surprising when you think about it in depth.

AI Reading Assistant

Whole-book reading guide from stratified index samples; jump to passages in the text

AI guide
【One-Line Pitch】 A practical, opinionated guide to writing Go that looks like Go—not Java or Python translated into Go syntax. Best for developers who already know another language and want to become immediately productive and idiomatic in Go, from setup through concurrency, testing, and real-world tooling. 【Book Arc】 - **Opening (~0%–10%)**: Frames the book's core thesis—Go is deliberately "boring" and small, and idiomatic Go requires understanding how its limited features fit together rather than importing habits from other languages. - **Early (~10%–35%)**: Sets up the development environment and toolchain: installing Go, understanding the workspace and GOPATH, and the difference between `go run` and `go build`, plus installing third-party tools via `go install`. - **Middle (~35%–55%)**: Moves into tooling discipline—`go fmt`, `goimports`, the semicolon insertion rule, linting with `golint`, and vetting—showing how Go enforces style and catches mistakes before they reach production. - **Late (~55%–85%)**: (Excerpts do not cover this stage in detail.) Based on the book's stated scope, this is where core language material—variables, types, control structures, functions, and eventually concurrency—is developed in depth. - **Ending (~85%–100%)**: (Excerpts do not cover this stage.) Presumably closes with advanced and real-world topics such as concurrency patterns, testing, and HTTP server work, though the provided excerpts stop before these. 【Key Takeaways】 - **Idiomatic Go is the real subject, not just syntax** (Opening): The book's goal is code that "looks like Go," which means resisting the temptation to write Java- or Python-shaped programs in Go. - **Go's small feature set is a design choice, not a limitation** (Opening): No inheritance, generics (at the time), exceptions, or operator overloading—"boring" is intentional and supports maintainability. - **Don't skip the fundamentals** (Early): The author explicitly warns that seemingly obvious material on variables, types, control structures, and functions contains the details that make code idiomatic. - **Tooling enforces style automatically** (Middle): `go fmt` and `goimports` reformat code, and the semicolon insertion rule explains why brace placement matters—run them before compiling. - **Linting is advisory but culturally important** (Middle): `golint` suggestions aren't compiler errors, but ignoring them makes your code "stick out" to Go developers. - **The workspace model has changed and old advice is obsolete** (Early): Modern Go lets you organize projects freely; GOPATH mainly matters for third-party tools installed via `go install`. - **`go run` vs. `go build` reflects intent** (Early): Use `go run` for scripting-like experimentation and `go build` (with `-o`) for distributable binaries. - **Go shares code via repositories, not a central registry** (Middle): `go install` pulls from source repos (e.g., GitHub) with version suffixes like `@latest`, unlike Maven Central or NPM. 【Reading Tips】 - **Deep-read the early chapters even if they feel basic.** The author explicitly says the idiomatic details live here; skimming risks absorbing non-Go habits. - **Skim the installation and O'Reilly boilerplate** (roughly the first quarter) if your environment is already set up—focus instead on the workspace and tooling concepts. - **Treat the tooling chapter as a checklist.** Actually run `go fmt`, `goimports`, and `golint` on a small project to internalize the workflow. - **Keep Effective Go and the Code Review Comments wiki open** alongside the book, as the author recommends them for understanding idiomatic style. - **Use the GitHub examples and Go Playground** to run code as you read; the book assumes you'll experiment. 【Coverage Limits】 The provided excerpts cover only the preface, setup, and tooling portions of the book (roughly the first half). Core language chapters, concurrency, testing, and HTTP material are referenced in the book's stated scope but not detailed in these excerpts, so this guide cannot summarize their specific content.
Excerpt 1
lly be subtly surprising when you think about it in depth. Praise for Learning Go “Go is unique and even experienced programmers have to unlearn a few things...
View in text
Excerpt 2
ion usually includes the title, author, publisher, and ISBN. For example: “ Learning Go by Jon Bodner (O’Reilly). Copyright 2021 Jon Bodner, 978-1-492-07721-...
View in text
Excerpt 3
stem using bash , add the following lines to your .profile . (If you are using zsh , add these lines to .zshrc instead): export GOPATH=$HOME/go export PATH=$...
View in text
Excerpt 4
ode like this: func main () { fmt . Println ( "Hello, world!" ) } the semicolon insertion rule sees the “)” at the end of the func main() line and turns that...
View in text
Excerpt 5
es that run for too long or use too much memory are stopped. If your program depends on time, be aware that the clock is set to November 10, 2009, 23:00:00 U...
View in text
Excerpt 6
ls represent characters and are surrounded by single quotes. Unlike many other languages, in Go single quotes and double quotes are not interchangeable. Rune...
View in text
Excerpt 7
n for every integer type. In all other cases, just use int . Tip Unless you need to be explicit about the size or sign of an integer for performance or integ...
View in text
Excerpt 8
type, Go is not a popular language for numerical computing. Adoption has been limited because other features (like matrix support) are not part of the langua...
View in text
Tags
AI categories
GoProgramming LanguageSoftware
ISBN: 1492077216
Publish Year: 2021
Language: English
File Format: EPUB
File Size: 5.2 MB