Skip to content

fix: preserve where context line numbers - #263

Merged
andrew merged 1 commit into
git-pkgs:mainfrom
sanmaxdev:fix/where-context-line-numbers
Jul 1, 2026
Merged

andrew merged 1 commit into
git-pkgs:mainfrom
sanmaxdev:fix/where-context-line-numbers

Conversation

@sanmaxdev

Copy link
Copy Markdown
Contributor

Summary

  • keep the original context start line when where --context builds a truncated window
  • use that start line when printing text context so EOF-truncated output keeps the match marker on the correct source line
  • add a regression test for a dependency match near the end of a manifest

Testing

  • go test ./cmd -run 'TestOutputWhereTextContextNearEOFUsesOriginalLineNumbers|TestSearchFileForPackage'
  • go test -v -race ./...
  • go build -v ./...
  • go tool golangci-lint run ./...
  • git diff --check

Closes #258

@andrew
andrew merged commit 4ad0012 into git-pkgs:main Jul 1, 2026
4 checks passed
@sanmaxdev
sanmaxdev deleted the fix/where-context-line-numbers branch July 1, 2026 16:01
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.

where --context prints incorrect line numbers when match is near end of file

2 participants