Update golangci-lint

This commit is contained in:
9seconds
2022-08-08 15:54:38 +03:00
parent 6a19ded78e
commit 36dad5a2f6
70 changed files with 227 additions and 214 deletions
+1 -1
View File
@@ -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
View File
@@ -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,
+4 -4
View File
@@ -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
View File
@@ -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.
+1 -1
View File
@@ -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