Skip to content

fix: resolve macOS test link failure and update lint rules#2428

Closed
SudhanshuMatrix wants to merge 3 commits into
spf13:mainfrom
SudhanshuMatrix:fix-macos-link-and-lint
Closed

fix: resolve macOS test link failure and update lint rules#2428
SudhanshuMatrix wants to merge 3 commits into
spf13:mainfrom
SudhanshuMatrix:fix-macos-link-and-lint

Conversation

@SudhanshuMatrix

Copy link
Copy Markdown
Contributor

Description

This Pull Request addresses macOS test linking failures and linter configuration adjustments to ensure clean CI/CD runs and local builds.

As suggested in #2423 (comment), this PR isolates these config and CI updates into a separate branch.

Changes Proposed

  1. macOS Test Link Fix:

    • Added GO_TEST_FLAGS: -ldflags=-linkmode=external environment variable for macOS platforms in the GitHub Actions test-unix job.
    • Updated the Makefile (test and richtest targets) to reference $(GO_TEST_FLAGS), keeping target execution platform-independent while resolving macOS-specific link issues.
  2. Linter Rule Exclusions & Hygiene (.golangci.yml):

    • Disabled goconst on all _test.go files to prevent noisy alerts on duplicated test strings.
    • Added goconst exclusions for common shell inputs (true, bash, zsh, fish, powershell).
    • Configured linters.settings.nolintlint.allow-unused: true (following the version: "2" config schema) to prevent build failures under newer Go versions (like Go 1.26) where some pre-existing //nolint comments are no longer triggered.

Verification Results

  • Unit Tests: All tests pass successfully locally (go test ./...).
  • Linter Validation: Verified against the golangci-lint JSON schema for version 2. The configuration modifications resolve all nolintlint warnings and pass schema validation checks.

SudhanshuMatrix and others added 3 commits June 26, 2026 13:37
…tions_test

Under Go 1.26, `go vet` has tightened its format verb checks, flagging `%q` when used on the integer-based `ShellCompDirective` type:

`(*testing.common).Errorf format %q has arg directive of wrong type github.com/spf13/cobra.ShellCompDirective`

This fixes the issue by formatting the directive using `%s` alongside its unexported `string()` helper method, keeping the change isolated to the test file.

Fixes spf13#2422
Co-authored-by: Christophe Colombier <3875889+ccoVeille@users.noreply.github.com>
@github-actions github-actions Bot added the area/github For changes to Github specific things not shipped in the library label Jul 1, 2026
@SudhanshuMatrix SudhanshuMatrix changed the title ix: resolve macOS test link failure and update lint rules fix: resolve macOS test link failure and update lint rules Jul 1, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

area/github For changes to Github specific things not shipped in the library

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant