Skip to content

fix: resolve Go vet errors - #1

Open
beausterling wants to merge 1 commit into
Robj1925:mainfrom
beausterling:fix/go-test-errors
Open

fix: resolve Go vet errors#1
beausterling wants to merge 1 commit into
Robj1925:mainfrom
beausterling:fix/go-test-errors

Conversation

@beausterling

@beausterling beausterling commented Aug 12, 2026

Copy link
Copy Markdown

Fix Go vet errors in authentication and self-install

Status: Ready for review
Scope: Two localized error-construction fixes
Behavior change: Error paths now preserve the correct underlying error and pass Go vet
Risk: Low; success paths and public command interfaces are unchanged

Human summary

This PR fixes two existing Go vet failures that prevent a clean go test ./... run. One error path wrapped a directory string instead of the actual write error, and another passed runtime-generated text to fmt.Errorf as though it were a format string.

After these corrections, the full test suite, vet pass, and both command builds complete successfully.

Problem

The repository's baseline validation failed with:

internal/cli/auth.go:367:23: non-constant format string in call to fmt.Errorf
internal/cli/install.go:44:46: fmt.Errorf format %w has arg binDir of wrong type string

These failures affected contributor confidence and prevented standard Go validation from completing cleanly.

Root cause

internal/cli/install.go

The self-install write failure used:

fmt.Errorf("writing binary to %s: %w", target, binDir)

%w requires an error, but binDir is a string. The actual os.WriteFile error was available as err and was being discarded.

internal/cli/auth.go

The HAR importer assembled a user-facing error message dynamically and returned it through:

fmt.Errorf(msg)

Go vet flags a non-constant format string here. No formatting operation is needed after the message has been constructed.

Changes

File Change Result
internal/cli/install.go Pass err to %w Preserves the underlying filesystem error for inspection and unwrapping
internal/cli/auth.go Return dynamic message with errors.New(msg) Preserves the exact message without treating runtime text as a format string

Both changed sites include // PATCH: annotations according to the generated-tree contribution guidance in AGENTS.md.

Behavior matrix

Scenario Before After
self-install binary write succeeds Success Unchanged
self-install binary write fails Incorrect formatting argument; underlying error lost Target path plus wrapped filesystem error
HAR import finds credentials Success Unchanged
HAR import receives empty/invalid HAR Dynamic message passed as format string Same dynamic message returned safely

Validation evidence

Executed successfully on macOS ARM64 with Go 1.26.4:

go test ./...
go vet ./...
go build ./cmd/skool-pp-cli ./cmd/skool-pp-mcp

Observed result:

  • all packages built
  • all existing tests passed
  • go vet ./... exited successfully
  • both CLI and MCP entry points built successfully

Security and privacy

  • No authentication values, HAR content, cookies, or configuration files are included.
  • Credential handling behavior is unchanged.
  • The install failure path is improved because it now retains the real filesystem error rather than discarding it.

Compatibility

  • No command names, flags, output schemas, API paths, or persisted formats changed.
  • No new runtime dependencies were added.
  • Success-path behavior is unchanged.

Review guide

Recommended review order:

  1. Confirm %w now receives the os.WriteFile error in internal/cli/install.go.
  2. Confirm the completed HAR error message is returned with errors.New in internal/cli/auth.go.
  3. Verify the validation commands above.

Dependencies

None. This PR is independently mergeable.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant