docs: use 'go build .' in getting-started tutorials - #4565
Merged
Conversation
'go build ./...' matches both the main package and the generated package, and Go discards the resulting binaries when building more than one package, so the tutorial step produced no executable. Building the single main package with 'go build .' writes the binary as the tutorials intend. Fixes #4554 Co-Authored-By: Claude Fable 5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01FdtZb2F2AHRqAypxKhbTHn
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Fixes #4554
The getting-started tutorials tell readers to run
go build ./...after fetching the database driver. In the tutorial layout the pattern matches two packages — the rootmainpackage and the generatedtutorialpackage — and whengo buildis given more than one package it compiles them as a check but discards the resulting binaries, so no executable is produced.Switching to
go build .builds just the main package and writes the binary, which is what the tutorials intend ("The program should compile without errors, and run successfully").The issue reports the SQLite tutorial, but the MySQL and PostgreSQL tutorials share the same layout and instruction, so all three are updated:
docs/tutorials/getting-started-sqlite.mddocs/tutorials/getting-started-mysql.mddocs/tutorials/getting-started-postgresql.mdVerified by reproducing the behavior in a minimal module with the same layout:
go build ./...leaves no binary;go build .writes it.🤖 Generated with Claude Code
https://claude.ai/code/session_01FdtZb2F2AHRqAypxKhbTHn
Generated by Claude Code