mirror of
https://github.com/ScuroNeko/mtg.git
synced 2026-08-31 12:54:01 +03:00
Update golangci-lint
This commit is contained in:
+1
-1
@@ -11,7 +11,7 @@ var streamInfoPool = sync.Pool{
|
||||
}
|
||||
|
||||
func acquireStreamInfo() *streamInfo {
|
||||
return streamInfoPool.Get().(*streamInfo) // nolint: forcetypeassert
|
||||
return streamInfoPool.Get().(*streamInfo) //nolint: forcetypeassert
|
||||
}
|
||||
|
||||
func releaseStreamInfo(info *streamInfo) {
|
||||
|
||||
+3
-3
@@ -171,18 +171,18 @@ func (p *PrometheusFactory) Make() events.Observer {
|
||||
|
||||
// Serve starts an HTTP server on a given listener.
|
||||
func (p *PrometheusFactory) Serve(listener net.Listener) error {
|
||||
return p.httpServer.Serve(listener) // nolint: wrapcheck
|
||||
return p.httpServer.Serve(listener) //nolint: wrapcheck
|
||||
}
|
||||
|
||||
// Close stops a factory. Please pay attention that underlying listener
|
||||
// is not closed.
|
||||
func (p *PrometheusFactory) Close() error {
|
||||
return p.httpServer.Shutdown(context.Background()) // nolint: wrapcheck
|
||||
return p.httpServer.Shutdown(context.Background()) //nolint: wrapcheck
|
||||
}
|
||||
|
||||
// NewPrometheus builds an events.ObserverFactory which can serve HTTP
|
||||
// endpoint with Prometheus scrape data.
|
||||
func NewPrometheus(metricPrefix, httpPath string) *PrometheusFactory { // nolint: funlen
|
||||
func NewPrometheus(metricPrefix, httpPath string) *PrometheusFactory { //nolint: funlen
|
||||
registry := prometheus.NewPedanticRegistry()
|
||||
httpHandler := promhttp.HandlerFor(registry, promhttp.HandlerOpts{
|
||||
EnableOpenMetrics: true,
|
||||
|
||||
@@ -25,16 +25,16 @@ type PrometheusTestSuite struct {
|
||||
func (suite *PrometheusTestSuite) Get() (string, error) {
|
||||
addr := fmt.Sprintf("http://%s/", suite.httpListener.Addr().String())
|
||||
|
||||
resp, err := http.Get(addr) // nolint: noctx
|
||||
resp, err := http.Get(addr) //nolint: noctx
|
||||
if err != nil {
|
||||
return "", err // nolint: wrapcheck
|
||||
return "", err //nolint: wrapcheck
|
||||
}
|
||||
|
||||
defer resp.Body.Close()
|
||||
|
||||
data, err := io.ReadAll(resp.Body)
|
||||
if err != nil {
|
||||
return "", err // nolint: wrapcheck
|
||||
return "", err //nolint: wrapcheck
|
||||
}
|
||||
|
||||
return string(data), nil
|
||||
@@ -45,7 +45,7 @@ func (suite *PrometheusTestSuite) SetupTest() {
|
||||
suite.factory = stats.NewPrometheus("mtg", "/")
|
||||
suite.prometheus = suite.factory.Make()
|
||||
|
||||
go suite.factory.Serve(suite.httpListener) // nolint: errcheck
|
||||
go suite.factory.Serve(suite.httpListener) //nolint: errcheck
|
||||
}
|
||||
|
||||
func (suite *PrometheusTestSuite) TearDownTest() {
|
||||
|
||||
+1
-1
@@ -160,7 +160,7 @@ type StatsdFactory struct {
|
||||
|
||||
// Close stops sending requests to statsd.
|
||||
func (s StatsdFactory) Close() error {
|
||||
return s.client.Close() // nolint: wrapcheck
|
||||
return s.client.Close() //nolint: wrapcheck
|
||||
}
|
||||
|
||||
// Make build a new observer.
|
||||
|
||||
@@ -30,7 +30,7 @@ func (s *statsdFakeServer) Addr() string {
|
||||
|
||||
func (s *statsdFakeServer) Close() error {
|
||||
if s.conn != nil {
|
||||
return s.conn.Close() // nolint: wrapcheck
|
||||
return s.conn.Close() //nolint: wrapcheck
|
||||
}
|
||||
|
||||
return nil
|
||||
|
||||
Reference in New Issue
Block a user