fix golangci-lint error G602 in caddyhttp#7334
Merged
francislavoie merged 2 commits intocaddyserver:masterfrom Nov 3, 2025
Merged
fix golangci-lint error G602 in caddyhttp#7334francislavoie merged 2 commits intocaddyserver:masterfrom
francislavoie merged 2 commits intocaddyserver:masterfrom
Conversation
Member
|
Thanks, @mholt fixed it in his branch with https://github.com/caddyserver/caddy/pull/7324/files#diff-384ea25b96b47d84c242c7fe3341847cb468d867fafdea97d0920b605321a35dR115 but it didn't get merged yet. I think we should change it to match how Matt did it in his so it avoids the merge conflict |
Contributor
Author
|
Thanks @francislavoie. I updated the PR to match #7324 change to prevent later merge conflicts |
francislavoie
approved these changes
Nov 3, 2025
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.
Commit ddec183 was failing CI due to lint error:
This linter-failing line is from an old PR. Looking at older CI logs, it appears a successful cache of this file's lint recently expired, causing the error to appear
Code chunk is safe because function is only used when passing in a buffer of size >=4, but the linter is unable to guarantee this
I tested code changes to make the linter pass, but the error remained unless an explicit size check was added. It does not feel necessary to check the size of buffer every time in
encodeSizewhen we guaranteed in caller that buffer is big enough. As such commenting to disable the linter error felt like the least invasive solution. Happy to change to whatever fits best the project's, I found this project recently, have enjoyed using it on my own, and wanted to make a small first PR_Assistance Disclosure
Used AI to test code changes that would disable linter. No AI code (or really any code) entered this PR