{{ message }}
Repository navigation
Various gopls lint cleanups for package git - #6211
Merged
Merged
Conversation
We have several pieces of code that open-code `slices.Contains`. We did not originally write this code this way since our codebase precedes the `slices` package and, for that matter, generics in Go, but this is now a easier and simpler way to write this code and gopls suggests we modernize, so change it. Remove our own version of this code as well, since it's just a duplicate of the standard function.
bk2204
marked this pull request as ready for review
March 2, 2026 21:42
chrisd8088
approved these changes
Mar 4, 2026
chrisd8088
left a comment
Member
There was a problem hiding this comment.
Thank you, this looks like a nice bit of code cleanup!
I had one pair of minor suggestions about variable names (natch!), but aside from that this looks great, thank you.
gopls warns us that some of this code can be more easily and simply written using `strings.Cut`. Update our parsing code to use this function, which appeared in Go 1.18, to simplify our code somewhat.
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.

I was in the
gitpackage and noticed that my editor was providing me with some linting suggestions, which apparently come from gopls, the Go LSP. I've fixed the two major issues that I found there, which can be listed withgopls check --severity=hint ./git/*.go.I did not fix every issue, however. I skipped removing the unused functions which implement a complete interface and I only chose to fix items that were at least several Go releases old (I think the latest version required is Go 1.21) in order to reduce the burden on downstream maintainers.
This PR contains independent, logical, bisectable commits each with their own commit message, and as such is best reviewed commit by commit.