Remove dead Go code identified by deadcode analysis#2979
Merged
markphelps merged 3 commits intomainfrom Apr 30, 2026
Merged
Conversation
These packages were confirmed unreachable by deadcode analysis. pkg/web (Replicate API client) and pkg/http (auth transport) lost their callers when the push flow moved to the custom registry pusher. Also removes the orphaned BuildInfo struct and Push function from pkg/docker/push.go, and the WebHost/APIHost env helpers that only those packages used.
… helpers, console/shell utils, predict inputs
Contributor
There was a problem hiding this comment.
LGTM overall - this is a well-executed cleanup of genuinely dead code.
One minor observation:
The removal of InvalidLevel from the iota changes the integer values of the log levels. Previously:
InvalidLevel = -1DebugLevel = 0InfoLevel = 1
Now:
DebugLevel = 0InfoLevel = 1
This is actually correct since InvalidLevel was unused, but worth noting that the underlying integer values haven't changed for the valid levels.
Build passes, tests pass (1121), lint clean. The go mod tidy removal of timeago is correct - it was only used by the deleted pkg/web/ client.
Contributor
|
Posted review to PR #2979: #2979 (review) |
Contributor
|
LGTM |
markphelps
approved these changes
Apr 30, 2026
Contributor
markphelps
left a comment
There was a problem hiding this comment.
i love the smell of deleted code in the morning
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.
Large chunks of Go code have accumulated with zero callers -- leftovers from feature removals (fast/monobase builds, old docker CLI client,
cog migrate) and abstractions that were designed wider than what the CLI adopted.Ran
deadcode ./...across the repo, traced each hit back through git history to confirm it's genuinely orphaned, then removed everything that's safe to delete. ~1,870 lines gone across both commits.What's removed:
pkg/web/,pkg/http/-- Replicate API client for push telemetry (removed in first commit)GenerateRequirements,CurrentRequirements,VersionSpecifier,CheckMajorOnly,CheckMajorMinorPatch,dockerignore.Walk,WriteIfDifferentRingBufferWriter,DockerCommandFromEnvironment,isNetworkErrorparseFile,defaultConfig,DefaultBuildOptions,WithRequirementsFS,WithStrictDeprecationsFormatTime,Interactive/InteractiveBool,ParseLevel/MustParseLevel,Level.String,GetWidth, non-fSuccess/Errorvariantspkg/util/shell/package,WrapError,IsDir,IsExecutable,CopyFile,SHA256Hash*predict.NewInputs,predict.NewInputsWithBaseDirWhat's kept (intentionally):
FromYAML-- explicitly designed as a test helper, used by 8+ config testsPickFreePort-- deadcode false positive, called byregistry_testhelpersStandardPush,WithAuthConfig,WithHost-- may be needed againGetEnvOrDefault,OverwriteYAML,RingBufferWriter... wait, that one's gone nowdockertest/,registrytest/,registry_testhelpers/,integration-tests/harness/-- test infrastructure, deadcode false positivesTests that exercised removed functions were either removed or updated to use equivalent internal APIs.
go mod tidydroppedgithub.com/xeonx/timeago.Build passes, 0 lint issues, 1121 tests pass.