-
Notifications
You must be signed in to change notification settings - Fork 6.2k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
lint some of the things #4570
lint some of the things #4570
Conversation
4b975d2
to
ecc8299
Compare
cf3c23d
to
a916ead
Compare
@@ -963,7 +962,7 @@ func allowedHostsMiddleware(addr net.Addr) gin.HandlerFunc { | |||
} | |||
|
|||
if allowedHost(host) { | |||
if c.Request.Method == "OPTIONS" { | |||
if c.Request.Method == http.MethodOptions { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This is far less clear. Let's turn this lint rule off.
From the maintainers of net/http, in summary: "This was a mistake to introduce these constants. It's less clear and readable using them."
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'm fine turning off the linter however I disagree it's less clear. The var is much easier to search for and less error prone since typos causes build errors.
c89d08a
to
bc05f5f
Compare
53c3831
to
17cf925
Compare
now that ollama uses go1.22,
x/exp/slices
can be replaced with regularslices
enable some useful linters:
for i := 0; i < n; i++ { }
withfor i := range n { }
usestdlibvars to find values that can be replaced with stdlib vars, e.g.OPTIONS
withhttp.MethodOptions