Skip to content

chore: Show correct path when example has lint errors - #3656

Merged
gmlewis merged 1 commit into
google:masterfrom
alexandear-org:chore/remove-path-prefix
Jul 28, 2025
Merged

chore: Show correct path when example has lint errors#3656
gmlewis merged 1 commit into
google:masterfrom
alexandear-org:chore/remove-path-prefix

Conversation

@alexandear

Copy link
Copy Markdown
Contributor

Let's assume example/simple/main.go contains a lint issue fmt.Printf("Enter GitHub username: ") and we run ./script/lint.sh.

Before (duplicated example in the issued file path):

$ ./script/lint.shlinting .0 issues.linting example/Users/alexandear/src/github.com/google/go-github/exampleexample/example/simple/main.go:27:2: unnecessary-format: unnecessary use of formatting function "fmt.Printf", you can replace it with "fmt.Print" or "fmt.Println" (revive) fmt.Printf("Enter GitHub username: ") ^1 issues:* revive: 1failed linting example

After:

$ ./script/lint.shlinting .0 issues.linting example/Users/alexandear/src/github.com/google/go-github/exampleexample/simple/main.go:27:2: unnecessary-format: unnecessary use of formatting function "fmt.Printf", you can replace it with "fmt.Print" or "fmt.Println" (revive) fmt.Printf("Enter GitHub username: ") ^1 issues:* revive: 1failed linting example

The fix is simple: remove --path-prefix option as not needed in v2. See https://golangci-lint.run/product/migration-guide/#runrelative-path-mode

@gmlewisgmlewis left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thank you, @alexandear!
LGTM.
Merging.

@codecov

codecovBot commented Jul 28, 2025

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 91.25%. Comparing base (a81b973) to head (e450da7).
⚠️ Report is 1 commits behind head on master.

Additional details and impacted files
@@ Coverage Diff @@## master #3656 +/- ##
=======================================
Coverage 91.25% 91.25% =======================================
Files 184 184 Lines 16311 16311 =======================================
Hits 14884 14884 Misses 1245 1245 Partials 182 182 

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

@gmlewis
gmlewis merged commit 9f2b91b into google:masterJul 28, 2025
7 checks passed
@alexandear
alexandear deleted the chore/remove-path-prefix branch July 28, 2025 16:08
jlaportebot added a commit to jlaportebot/go-github that referenced this pull request Jun 28, 2026
Sign up for freeto 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.

2 participants

@alexandear@gmlewis