Intro

https://commandcenter.blogspot.com/2012/06/less-is-exponentially-more.html

https://commandcenter.blogspot.com/2024/01/what-we-got-right-what-we-got-wrong.html

Learning resources

https://go.dev/tour/welcome/1

https://go.dev/doc/effective_go

Courses / classes

https://zchee.github.io/golang-wiki/Courses/

  • huge variety of classes, from language intro to advanced distributed systems and compiler design

Books

https://github.com/dariubs/GoBooks

Best practices

https://blog.separateconcerns.com/2023-09-11-linear-code.html

https://go-proverbs.github.io/

Pass by value or by reference

https://preslav.me/2024/04/23/two-reasons-to-prefer-struct-pointers-in-golang/

Error handling

https://www.joeshaw.org/dont-defer-close-on-writable-files/

Configuration options

https://rednafi.com/go/dysfunctional_options_pattern/

  • beyond functional options

Concurrency

https://unskilled.blog/posts/preemption-in-go-an-introduction/

  • premption

https://unskilled.blog/posts/lets-dive-a-tour-of-sync.pool-internals/

  • sync.Pool

HTTP handling

https://go.dev/blog/routing-enhancements

  • new routing with patameters in Go 1.22

https://jvns.ca/blog/2024/09/27/some-go-web-dev-notes/

Anti-patterns / warts / gotchas

https://rytisbiel.com/2021/03/06/darker-corners-of-go/

http://golang50shad.es

Environment setup

https://boyter.org/posts/how-to-start-go-project-2023/

create-go-app

https://github.com/create-go-app/cli

Update dependencies

go get -u -v ./...
go mod tidy
go mod vendor

Ecosystem

https://henvic.dev/posts/go/

Release tools

https://www.kosli.com/blog/how-to-publish-your-golang-binaries-with-goreleaser/

  • GoReleaser
  • some linters
  • fuzzying

Update dependencies

https://brandur.org/fragments/mostly-automatic-deps

Patching a dependency locally

https://eli.thegreenplace.net/2024/locally-patching-dependencies-in-go/

  • go.mod with replace directive
  • go workspace
  • gohack

Embedding files

https://brandur.org/fragments/go-embed

  • embed files in prod, serve from file syatem in dev

Backend in Go

Simple web server

https://github.com/eliben/static-server/blob/main/internal/server/server.go

Simple scalable backend

https://tableplus.com/blog/2024/03/how-we-deal-with-ddos.html

  • In Go or Rust language
  • Web server, API monolith (!!!!)
  • Deployed as single binary
  • With Cloudflare CDN and R2
  • Nginx reverse proxy
  • DB : separate production data and logging

Take on writing HTTP services

https://grafana.com/blog/2024/02/09/how-i-write-http-services-in-go-after-13-years/

  • functions for testability
  • decode/encode via generics
  • NewServer and dependency injection
  • focus on end-to-end tests
  • t.Parallel()

Project layout

https://8thlight.com/blog/emmanuel-byrd/2022/05/19/well-thought-project-layout-design-for-a-golang-backend.html

Resiliency

https://failsafe-go.dev/

  • retry
  • circuit breaker
  • rate limiter
  • timeout
  • fallback
  • hedge
  • bulkhead

APIs : N+1 issue

https://brandur.org/two-phase-render

API service with sqlc and Gin

https://betterprogramming.pub/modern-rest-api-with-go-and-postgresql-c765d571b9e7

Database migration

https://github.com/peterldowns/pgmigrate

Database testing

https://github.com/peterldowns/pgtestdb

Useful libraries for backend dev

https://gofiber.io/

https://threedots.tech/post/list-of-recommended-libraries/

Structured logging

Fast structured logging, zero deps https://github.com/phuslu/log

Postgres - best packages

https://brandur.org/sqlc

https://alanilling.com/exiting-the-vietnam-of-programming-our-journey-in-dropping-the-orm-in-golang-3ce7dff24a0f

Posgres and Go details

https://henvic.dev/posts/go-postgres/

Job queue based on Postgres

https://brandur.org/river

Advanced caching

https://github.com/eko/gocache

In-process caches

https://github.com/maypok86/otter

API rate limiting

https://brandur.org/fragments/reservation-api

Event-based architecture

https://threedots.tech/post/distributed-transactions-in-go/

Pub/Sub clients

https://github.com/ThreeDotsLabs/watermill#examples

Performance tools

https://steveazz.xyz/blog/go-performance-tools-cheat-sheet/

Profiling

https://nyadgar.com/posts/go-profiling-like-a-pro/

https://github.com/DataDog/go-profiler-notes/blob/main/guide/README.md

  • CPU, memory, goroutine, blocks

Tracing

https://go.dev/blog/execution-traces-2024

Fgtrace

https://github.com/felixge/fgtrace

Profile-guided optimization (PGO)

https://go.dev/blog/pgo

https://www.dolthub.com/blog/2024-04-19-golang-pgo-builds-using-github-actions/

Linting

Nosleep https://xeiaso.net/blog/nosleep

Advanced tests

Security-oriented tools

https://jarosz.dev/article/writing-secure-go-code/

  • static checkers / linter
  • vulnerability scanners
  • tests with race detection
  • fuzzying

Race detection

Detect leak of Goroutines

https://brandur.org/fragments/goroutine-leaks

Fuzzing

https://blog.fuzzbuzz.io/go-fuzzing-basics/

Randomize test order to catch issues

go test -shuffle=on .

CI / CD

Automatic dependency updates with GH Actions

https://brandur.org/fragments/mostly-automatic-deps

Command execution

https://blog.kowalczyk.info/article/wOYk/advanced-command-execution-in-go-with-osexec.html

Exotic

Go embeddable interpreter

https://github.com/traefik/yaegi

Choosing Go - pros and cons

https://preslav.me/scratchpad/2023/12/why-golang-over-rust-java-python/