feat(options): Add cmdline option to not follow symlinks#127
Merged
Conversation
Add `NoFollowSymlinks` (`--no-follow`) option. While here do `gofmt` in `options.go` file.
`options.go`: * `ioutil.ReadFile is deprecated: As of Go 1.16, this function simply calls [os.ReadFile]` * `ioutil.WriteFile is deprecated: As of Go 1.16, this function simply calls [os.WriteFile]` * `ioutil.Discard is deprecated: As of Go 1.16, this value is simply [io.Discard]` * `"golang.org/x/crypto/ssh/terminal" is deprecated: Deprecated: this package moved to golang.org/x/term.` `sift.go`: * `"golang.org/x/crypto/ssh/terminal" is deprecated: Deprecated: this package moved to golang.org/x/term.` `sift.go`: * `should check error returned from os.Open() before deferring f.Close()` * `unnecessary nil check around range` * `if statement can be modernized using min` * `bufio.Scanner "scanner" is used in Scan loop at line 623 without final check of scanner.Err()` `matching.go`: * `if statement can be modernized using min` * `for loop can be modernized using range over int` * `bufio.Scanner "scanner" is used in Scan loop at line 610 without final check of scanner.Err()`
There was a problem hiding this comment.
Pull request overview
Note
Copilot was unable to run its full agentic suite in this review.
Modernizes the codebase to use current Go APIs and small refactors, while improving robustness in file/scan handling.
Changes:
- Replace deprecated
ioutilandx/crypto/ssh/terminalusage withos/ioandgolang.org/x/term. - Simplify slice/range logic (
min/max, slicing, composite literals) and add missingscanner.Err()checks. - Add a
//go:buildconstraint and introduce--no-followflag handling.
Reviewed changes
Copilot reviewed 5 out of 5 changed files in this pull request and generated 3 comments.
Show a summary per file
| File | Description |
|---|---|
| sift.go | Uses x/term, simplifies slicing/loops, and adds scanner error handling for pattern files |
| output.go | Small cleanup of variable declaration and slice expressions for readability |
| options.go | Replaces deprecated ioutil, switches to x/term, and adds --no-follow option handler |
| matching_other.go | Adds //go:build line to align with modern Go build constraints |
| matching.go | Simplifies logic and literals, adds scanner error handling, but introduces a compile-time loop issue |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
Contributor
Author
|
@svent Will you have a moment to look at this PR please? 🙏🏻 |
Contributor
Author
|
Friendly reminder. |
Contributor
Author
|
Another friendly nudge 🙏🏻 |
Contributor
Author
|
Just another friendly ping. |
Owner
|
Thanks for your contribution, looks good to me! |
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.
Resolves #113
Add
NoFollowSymlinks(--no-follow) option.Also while here lint and format code (gopls, go vet, gofmt):
options.go:ioutil.ReadFile is deprecated: As of Go 1.16, this function simply calls [os.ReadFile]ioutil.WriteFile is deprecated: As of Go 1.16, this function simply calls [os.WriteFile]ioutil.Discard is deprecated: As of Go 1.16, this value is simply [io.Discard]"golang.org/x/crypto/ssh/terminal" is deprecated: Deprecated: this package moved to golang.org/x/term.sift.go:"golang.org/x/crypto/ssh/terminal" is deprecated: Deprecated: this package moved to golang.org/x/term.sift.go:should check error returned from os.Open() before deferring f.Close()unnecessary nil check around rangeif statement can be modernized using minbufio.Scanner "scanner" is used in Scan loop at line 623 without final check of scanner.Err()matching.go:if statement can be modernized using minfor loop can be modernized using range over intbufio.Scanner "scanner" is used in Scan loop at line 610 without final check of scanner.Err()