Repository navigation
fix(inspect): Runtime safety, exhaustive switch cases (Phase 1+3) - #231
Merged
Merged
Conversation
Fix 27 GoLand inspection issues across runtime safety and missing switch case categories: Phase 1 — Potential Runtime Bugs (16 issues): - Use t.Fatal instead of t.Error before nil dereference (selfinstall_test) - Add nil guards after session.Next() calls (console_test) - Add nil guards after graph.PhaseByID() calls (phase_test) - Add nil guard after opts.Parse() (starcomplexity, starindex providers) - Delete tautological const-value tests (output_test, segment_test) Phase 3 — Missing Switch Cases (11 issues): - Add default case to reflect.Kind switches (output.go) - Add StepProgress case and exhaustive StepType coverage (model.go) - Add ResultPending/ResultRunning cases (executor.go) - Add upgradeResultError case with error reporting (commands.go) - Add missing SessionState cases (session.go) - Add default case to test switch (session_test.go) - Add gitignore.NoMatch case (tracker.go) Update plan status: Phase 1 complete, Phase 3 complete.
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
goland-inspection-cleanupplant.Fatalupgrades, nil guards afterPhaseByID()/Next()/Parse(), delete tautological const tests (16 issues)StepType,ResultStatus,upgradeResult,SessionState,reflect.Kind, andgitignore.MatchResult(11 issues)Files changed (15)
internal/cli/selfinstall_test.got.Error→t.Fatalbefore nilerr.Error()internal/console/console_test.gosession.Next()internal/execution/phase_test.gograph.PhaseByID()pkg/op/provider/starcomplexity/provider.goopts.Parse()pkg/op/provider/starindex/provider.goopts.Parse()internal/cli/output_test.goDefaultFormattestinternal/writ/segment/segment_test.goEnvVarPrefixtestinternal/cli/output.godefault:in bothreflect.Kindswitchesinternal/console/model.goStepProgress+ exhaustiveStepTypecasesinternal/execution/executor.goResultPending,ResultRunningcasesinternal/writ/commands.goupgradeResultErrorcase with error returninternal/writ/migrate/session.goSessionStatecasesinternal/writ/migrate/session_test.godefault:forStepTypeswitchpkg/op/provider/file/gitignore/tracker.gogitignore.NoMatchcasedocs/plans/goland-inspection-cleanup.mdTest plan
make vetpassesmake testpasses — all packages greengofmt -lreports no formatting issues on all changed files