Dev Skills
Go tests·10 questions

Modules and tooling

go.mod, versioning, build flags, and what runs in CI.

1 / 10

What does go.sum hold?

All questions with explanations (answers shown)
  1. 1. What does go.sum hold?

    Answer: Cryptographic checksums of every module version, making builds reproducible and tamper-evident

    Commit it. Together with go.mod it is why Go needs no separate lockfile.

  2. 2. Go picks which version of a shared dependency?

    Answer: The oldest that satisfies everyone — Minimal Version Selection

    Your build does not change because someone else published a release. Upgrades only happen when you ask for one.

  3. 3. What does CGO_ENABLED=0 give you?

    Answer: A fully static binary with no libc dependency — which is what makes distroless images and cross-compiling work

    It is the flag behind both the ~15MB container image and GOOS=linux GOARCH=arm64 go build needing no toolchain.

  4. 4. You publish a breaking change to your library. What must the module path become?

    Answer: github.com/you/thing/v2

    The major version lives in the import path from v2 onward, so v1 and v2 can coexist in one build.

  5. 5. Which four commands should gate every push?

    Answer: gofmt -l, go vet, go test -race, govulncheck

    Formatted, vetted, race-free and free of known vulnerabilities. govulncheck is low-noise because it only reports vulnerabilities in code you actually call.

  6. 6. Which routers let you keep the standard func(http.ResponseWriter, *http.Request) handler?

    Answer: net/http and chi

    chi is a thin router over net/http, so every standard middleware and httptest still work. gin, echo and fiber each define their own context and handler type.

  7. 7. You see c.JSON(200, gin.H{...}) in a handler. What does that tell you?

    Answer: Every handler is tied to gin — moving away means rewriting them all

    gin.H and *gin.Context only exist in gin. Going to gin is easy; coming back means rewriting every handler signature.

  8. 8. Ordered from most control over the SQL to least, which is right?

    Answer: database/sql → sqlx → sqlc → GORM

    database/sql is raw. sqlx scans for you but keeps your SQL. sqlc generates typed Go from your SQL. GORM writes the SQL for you.

  9. 9. What is the best single reason to add golang.org/x/sync/errgroup?

    Answer: Bounded concurrency with SetLimit plus first-error cancellation, in a few lines

    It turns a 25-line worker pool into about 8 lines and cancels the rest on the first error. It is one of the clearest cases in Go for taking a dependency.

  10. 10. How should you judge whether a package is safe to depend on?

    Answer: Last commit, open issues, what go mod graph pulls in, and govulncheck

    Stars measure attention at some point in the past. What matters is whether it is maintained now and how much it drags into your build.