mirror of
https://github.com/sot-tech/mochi.git
synced 2026-07-30 11:08:10 -07:00
upgrade golangci to v2
* migrate configuration to version 2 * fix new lint warnings * update lint.yaml to use golangci-lint-action v7
This commit is contained in:
@@ -117,7 +117,7 @@ func (cfg Config) Validate() (validCfg Config, err error) {
|
||||
Strs("default", validCfg.ScrapeRoutes).
|
||||
Msg("falling back to default configuration")
|
||||
}
|
||||
validCfg.ParseOptions.ParseOptions = cfg.ParseOptions.ParseOptions.Validate(logger)
|
||||
validCfg.ParseOptions.ParseOptions = cfg.ParseOptions.Validate(logger)
|
||||
return
|
||||
}
|
||||
|
||||
@@ -163,7 +163,7 @@ func NewFrontend(c conf.MapConfig, logic *middleware.Logic) (frontend.Frontend,
|
||||
return nil, err
|
||||
}
|
||||
certs := []tls.Certificate{cert}
|
||||
f.Server.TLSConfig = &tls.Config{
|
||||
f.TLSConfig = &tls.Config{
|
||||
Certificates: certs,
|
||||
MinVersion: tls.VersionTLS12,
|
||||
}
|
||||
@@ -194,7 +194,7 @@ func NewFrontend(c conf.MapConfig, logic *middleware.Logic) (frontend.Frontend,
|
||||
pathRouting[path.Clean(route)] = f.ping
|
||||
}
|
||||
|
||||
f.Server.Handler = func(ctx *fasthttp.RequestCtx) {
|
||||
f.Handler = func(ctx *fasthttp.RequestCtx) {
|
||||
if route, exists := pathRouting[string(ctx.Path())]; exists {
|
||||
route(ctx)
|
||||
} else {
|
||||
@@ -228,7 +228,7 @@ func runServer(s *fasthttp.Server, cfg *Config) {
|
||||
func (f *httpFE) Close() (err error) {
|
||||
f.onceCloser.Do(func() {
|
||||
if f.Server != nil {
|
||||
err = f.Server.Shutdown()
|
||||
err = f.Shutdown()
|
||||
}
|
||||
})
|
||||
|
||||
|
||||
@@ -2,9 +2,10 @@ package http
|
||||
|
||||
import (
|
||||
"github.com/rs/zerolog"
|
||||
"github.com/valyala/fasthttp"
|
||||
|
||||
"github.com/sot-tech/mochi/bittorrent"
|
||||
"github.com/sot-tech/mochi/pkg/str2bytes"
|
||||
"github.com/valyala/fasthttp"
|
||||
)
|
||||
|
||||
// queryParams parses a URL Query and implements the Params interface with some
|
||||
@@ -33,5 +34,5 @@ func (qp queryParams) InfoHashes() bittorrent.InfoHashes {
|
||||
|
||||
// MarshalZerologObject writes fields into zerolog event
|
||||
func (qp queryParams) MarshalZerologObject(e *zerolog.Event) {
|
||||
e.Str("query", str2bytes.BytesToString(qp.Args.QueryString()))
|
||||
e.Str("query", str2bytes.BytesToString(qp.QueryString()))
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user