diff options
author | Valery Piashchynski <[email protected]> | 2021-03-28 14:00:54 +0300 |
---|---|---|
committer | Valery Piashchynski <[email protected]> | 2021-03-28 14:00:54 +0300 |
commit | 2a58b1be2c79f2fe10c0a429878937661645a928 (patch) | |
tree | f3a7cd472c75c4dd2a97bcf97cb154731ed81230 /plugins | |
parent | 970014530a23d57a3be41c6369ac6456d0b36ae1 (diff) |
- Fix bug with the worker reallocating during the response
- Update .golangci and fix new warnings
Signed-off-by: Valery Piashchynski <[email protected]>
Diffstat (limited to 'plugins')
-rw-r--r-- | plugins/http/errors.go | 2 | ||||
-rw-r--r-- | plugins/http/handler.go | 2 | ||||
-rw-r--r-- | plugins/kv/boltdb/plugin.go | 2 | ||||
-rw-r--r-- | plugins/logger/zap_adapter.go | 2 | ||||
-rw-r--r-- | plugins/metrics/plugin.go | 2 | ||||
-rw-r--r-- | plugins/reload/plugin.go | 6 | ||||
-rw-r--r-- | plugins/reload/watcher.go | 1 |
7 files changed, 8 insertions, 9 deletions
diff --git a/plugins/http/errors.go b/plugins/http/errors.go index fb8762ef..5889aa76 100644 --- a/plugins/http/errors.go +++ b/plugins/http/errors.go @@ -16,7 +16,7 @@ var errEPIPE = errors.New("EPIPE(32) -> connection reset by peer") func handleWriteError(err error) error { if netErr, ok2 := err.(*net.OpError); ok2 { if syscallErr, ok3 := netErr.Err.(*os.SyscallError); ok3 { - if syscallErr.Err == syscall.EPIPE { + if errors.Is(syscallErr.Err, syscall.EPIPE) { return errEPIPE } } diff --git a/plugins/http/handler.go b/plugins/http/handler.go index b7c6f1fa..d3c928aa 100644 --- a/plugins/http/handler.go +++ b/plugins/http/handler.go @@ -176,7 +176,7 @@ func (h *Handler) sendEvent(event interface{}) { // get real ip passing multiple proxy func (h *Handler) resolveIP(r *Request) { - if h.trusted.IsTrusted(r.RemoteAddr) == false { + if h.trusted.IsTrusted(r.RemoteAddr) == false { //nolint:gosimple return } diff --git a/plugins/kv/boltdb/plugin.go b/plugins/kv/boltdb/plugin.go index 1e3d2c34..ffcbc85a 100644 --- a/plugins/kv/boltdb/plugin.go +++ b/plugins/kv/boltdb/plugin.go @@ -187,7 +187,7 @@ func (s *Plugin) Get(key string) ([]byte, error) { func (s *Plugin) MGet(keys ...string) (map[string]interface{}, error) { const op = errors.Op("boltdb_plugin_mget") - // defence + // defense if keys == nil { return nil, errors.E(op, errors.NoKeys) } diff --git a/plugins/logger/zap_adapter.go b/plugins/logger/zap_adapter.go index 0a0855b8..6d865519 100644 --- a/plugins/logger/zap_adapter.go +++ b/plugins/logger/zap_adapter.go @@ -23,7 +23,7 @@ func (log *ZapAdapter) fields(keyvals []interface{}) []zap.Field { return []zap.Field{zap.Error(fmt.Errorf("odd number of keyvals pairs: %v", keyvals))} } - var fields []zap.Field + fields := make([]zap.Field, 0, len(keyvals)/2) for i := 0; i < len(keyvals); i += 2 { key, ok := keyvals[i].(string) if !ok { diff --git a/plugins/metrics/plugin.go b/plugins/metrics/plugin.go index efcbfc50..223788c9 100644 --- a/plugins/metrics/plugin.go +++ b/plugins/metrics/plugin.go @@ -105,7 +105,7 @@ func (m *Plugin) Serve() chan error { hasGCMAsm := hasGCMAsmAMD64 || hasGCMAsmARM64 || hasGCMAsmS390X if hasGCMAsm { - // If AES-GCM hardware is provided then prioritise AES-GCM + // If AES-GCM hardware is provided then prioritize AES-GCM // cipher suites. topCipherSuites = []uint16{ tls.TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256, diff --git a/plugins/reload/plugin.go b/plugins/reload/plugin.go index d76fb0a4..bf88462e 100644 --- a/plugins/reload/plugin.go +++ b/plugins/reload/plugin.go @@ -44,11 +44,11 @@ func (s *Plugin) Init(cfg config.Configurer, log logger.Logger, res resetter.Res s.stopc = make(chan struct{}, 1) s.services = make(map[string]interface{}) - var configs []WatcherConfig + configs := make([]WatcherConfig, 0, len(s.cfg.Services)) for serviceName, serviceConfig := range s.cfg.Services { - ignored, err := ConvertIgnored(serviceConfig.Ignore) - if err != nil { + ignored, errIgn := ConvertIgnored(serviceConfig.Ignore) + if errIgn != nil { return errors.E(op, err) } configs = append(configs, WatcherConfig{ diff --git a/plugins/reload/watcher.go b/plugins/reload/watcher.go index 8dde38de..1b3407e5 100644 --- a/plugins/reload/watcher.go +++ b/plugins/reload/watcher.go @@ -148,7 +148,6 @@ func ConvertIgnored(ignored []string) (map[string]struct{}, error) { // pass map from outside func (w *Watcher) retrieveFilesSingle(serviceName, path string) (map[string]os.FileInfo, error) { - const op = errors.Op("watcher_retrieve_files_single") stat, err := os.Stat(path) if err != nil { return nil, err |