Whole-book reading guide from stratified index samples; jump to passages in the text
Tip the Site
Support this siteYour recognition and a small knowledge-service contribution help keep this technical work open source.Scan the WeChat Pay or Alipay code below. Logged-in and guest visitors can both tip.
WeChat Pay
Alipay
Open WeChat or Alipay and scan. No login required.
AI guide
【One-Line Pitch】
A hands-on, project-driven guide to building a real web application in Go—routing, templates, databases, authentication, and security—for developers who know some Go and want to ship a working site rather than just study syntax.
【Book Arc】
- **Opening (~0%–10%)**: Bootstraps a minimal HTTP server, adds a custom router and 404 handling, and introduces the MVC mental model plus the request lifecycle.
- **Early (~10%–32%)**: Builds the view layer with `html/template`, reusable Bootstrap layouts and named templates, then wires up the first controller and form processing with struct tags.
- **Middle (~32%–48%)**: Introduces PostgreSQL and GORM, models users and orders, and refactors data access behind a `UserService` interface with query methods.
- **Late (~48%–60%)**: Implements authentication—password hashing, login/logout flows, and the security reasoning behind each step.
- **Ending (~60%+)**: Covers persistent sessions via remember tokens, HMAC signing, cookie hardening against XSS and theft, and CSRF prevention, closing with exercises.
【Key Takeaways】
- **The book teaches through one continuous project** (Opening): concepts arrive as features you add to a single app, so learning is cumulative rather than isolated snippets.
- **Routing is built from scratch before frameworks** (Opening): understanding `HandlerFunc`, method matching, and path parsing makes later framework use less magical.
- **`html/template` is a security choice, not just a convenience** (Early): its auto-escaping defends against code injection, unlike `text/template`.
- **Reusable layouts and named templates keep views maintainable** (Early): a shared Bootstrap shell lets individual pages focus on content.
- **Struct tags bridge forms, models, and databases** (Early): metadata like `schema` and `gorm` keys drives mapping without manual glue code.
- **Data access belongs behind a service layer** (Middle): the `UserService` interface isolates queries and makes the rest of the app easier to reason about.
- **Password handling requires deliberate separation** (Middle): storing a hash-only field and a non-persisted raw field prevents accidental double-hashing or plaintext leaks.
- **Cookie security is layered** (Ending): HMAC signing detects tampering, while XSS, theft, and CSRF each need their own mitigation.
【Reading Tips】
- Deep-read the routing and template chapters; they underpin everything later and are where Go's standard library shines.
- Skim the Bootstrap/CSS asides—they're about speed, not concepts—but don't skip the security boxes.
- Treat the exercises (especially the "HARD" ones) as required; they force you to extend the service layer yourself.
- When you hit GORM, pause to understand `AutoMigrate`'s limits before relying on it.
- Keep the running app open in a browser as you read; the book is designed to be typed along with.
【Coverage Limits】
The excerpts cover roughly the first half of the book plus the authentication/session chapters; later deployment, testing, and any advanced topics are not represented here.
Excerpt 1
in the terminal where you ran go run main.go. 26 CHAPTER 3. ADDING NEW PAGES w.WriteHeader(http.StatusNotFound) fmt.Fprint(w, "<h1>We could not find the page...
receive from our call to Glob. Box 6.6. Why so many panics? At this point I want to address the question, “Why are we panicking so much in view.go?” Aren’t p...
b.Close() db.AutoMigrate(&User{}) } You can also use the db.AutoMigrate function to update models. For exam- ple, if we added the Age int attribute to the Us...
ges we are done adding the login page and are ready to move on to implementing the Authenticate method for our user service. Source code The links below have...
ection in Appendix 18.1, then come back here. In Listing 12.1 we looked at how we might define our layers using structs, and we spoke briefly about how this...
dea to focus on this until you settle on a user experience. There are four types of alert: success, info, warning, and danger. The only difference between th...
e that in the next section then come back to finish our Up- date handler. In the meantime, we are rendering the edit page again with the submitted data and a...
he create method isn’t going to accept an Image struct type as its only argument, and is instead going to accept the data needed to create an image. What dat...
Support this siteYour recognition and a small knowledge-service contribution help keep this technical work open source.
Scan the WeChat Pay or Alipay code below. Logged-in and guest visitors can both tip.
WeChat PayAlipay
Open WeChat or Alipay and scan. No login required.
Add Tag
Enter tag name (max 50 characters)
Share E-Book
Web Development With Go (Jon Calhoun)(Z-Library)
Scan QR code with your phone to access
Copy the link or scan the QR code to access this e-book on your phone
Share to WeChat Moments
Web Development With Go (Jon Calhoun)(Z-Library)
Scan the QR code with WeChat to open this book
Tap the ··· menu in the top-right corner
Choose Share to Moments
You are already in WeChat. Tap ··· in the top-right corner and choose Share to Moments.
Share E-Book via Email
Please enter email address
Donation Statistics
¥.00
Total Donations
0
Donation Count
Web Development With Go (Jon Calhoun)(Z-Library)
Find Your Favorite Books
Only registered users can comment after logging in. Comments need to be reviewed by administrators before being displayed
Loading comments...
Reply to Comment
Edit Comment