refactor: replace custom runtime with Go stdlib runtime/debug#2420
Merged
paganotoni merged 1 commit intomainfrom Mar 20, 2026
Merged
refactor: replace custom runtime with Go stdlib runtime/debug#2420paganotoni merged 1 commit intomainfrom
paganotoni merged 1 commit intomainfrom
Conversation
Replace the custom runtime package implementation that relied on build-time ldflags injection with Go's standard library runtime/debug package. This change: - Removes the underscore import of runtime package from buffalo.go - Updates runtime.Build() to use debug.ReadBuildInfo() internally - Maintains backward compatibility with existing API - Deprecates all runtime package functions with migration instructions - Removes runtime/version.go (merged into build.go) This modernization leverages Go 1.18+'s built-in VCS information embedding and eliminates the vendoring workaround that required the blank import. Breaking changes: - runtime.Version defaults to 'dev' instead of 'v1.1.0' - BuildInfo.Time now uses vcs.time (commit time) instead of build time - The runtime package is now deprecated and will be removed in v2
781376a to
66eeab9
Compare
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.
Summary
This PR modernizes the buffalo runtime package by replacing the custom build-time ldflags injection with Go's standard library
runtime/debugpackage.Changes
Breaking Changes
runtime.Versionnow defaults to'dev'instead of hardcoded'v1.1.0'BuildInfo.Timenow uses VCS commit time (vcs.time) instead of build timeruntimepackage is now deprecated and will be removed in v2Implementation Details
runtimepackage frombuffalo.goruntime.Build()now internally usesdebug.ReadBuildInfo()runtime/version.go(content merged intobuild.go)CHANGELOG.mdwith comprehensive migration guideBackward Compatibility
✅ The runtime package API remains fully backward compatible:
runtime.Build()works the same wayruntime.Versionis still accessibleruntime.SetBuild()still exists (though now a no-op after firstBuild()call)Migration Path
Users can modernize their code to use
runtime/debugdirectly:Testing
All existing tests pass:
go build ./...- successfulgo test ./... -short- all packages passRequirements
Related
This change eliminates the vendoring workaround that required the blank import in
buffalo.go, modernizing the codebase to use standard Go practices.