From dff78d82ce21d97cad53171b72b88550e02c2c7f Mon Sep 17 00:00:00 2001 From: Mohammed Al Sahaf Date: Fri, 3 Jan 2020 21:33:22 +0300 Subject: v2: housekeeping: address minor lint complaints (#2957) * v2: housekeeping: update tools * v2: housekeeping: adhere to US locale in spelling * v2: housekeeping: simplify code --- modules/caddyhttp/reverseproxy/streaming.go | 1 - modules/caddyhttp/starlarkmw/internal/lib/module.go | 4 ++-- modules/caddyhttp/templates/templates.go | 4 +--- modules/caddytls/connpolicy.go | 2 +- modules/logging/filewriter.go | 2 +- 5 files changed, 5 insertions(+), 8 deletions(-) (limited to 'modules') diff --git a/modules/caddyhttp/reverseproxy/streaming.go b/modules/caddyhttp/reverseproxy/streaming.go index 3ab122c..0c8e338 100644 --- a/modules/caddyhttp/reverseproxy/streaming.go +++ b/modules/caddyhttp/reverseproxy/streaming.go @@ -68,7 +68,6 @@ func (h Handler) handleUpgradeResponse(rw http.ResponseWriter, req *http.Request go spc.copyToBackend(errc) go spc.copyFromBackend(errc) <-errc - return } // flushInterval returns the p.FlushInterval value, conditionally diff --git a/modules/caddyhttp/starlarkmw/internal/lib/module.go b/modules/caddyhttp/starlarkmw/internal/lib/module.go index a75aedf..13c706c 100644 --- a/modules/caddyhttp/starlarkmw/internal/lib/module.go +++ b/modules/caddyhttp/starlarkmw/internal/lib/module.go @@ -60,7 +60,7 @@ func (r *LoadMiddleware) Run(thread *starlark.Thread, fn *starlark.Builtin, args js := json.RawMessage(cfg.String()) - if strings.Index(name, "http.handlers.") == -1 { + if !strings.Contains(name, "http.handlers.") { name = fmt.Sprintf("http.handlers.%s", name) } @@ -108,7 +108,7 @@ func (r *LoadResponder) Run(thread *starlark.Thread, fn *starlark.Builtin, args js := json.RawMessage(cfg.String()) - if strings.Index(name, "http.handlers.") == -1 { + if !strings.Contains(name, "http.handlers.") { name = fmt.Sprintf("http.handlers.%s", name) } diff --git a/modules/caddyhttp/templates/templates.go b/modules/caddyhttp/templates/templates.go index adf9844..94764bf 100644 --- a/modules/caddyhttp/templates/templates.go +++ b/modules/caddyhttp/templates/templates.go @@ -259,9 +259,7 @@ func (t *Templates) ServeHTTP(w http.ResponseWriter, r *http.Request, next caddy // refresh, so disable them until we find a better way to do this rec.Header().Del("Etag") - rec.WriteResponse() - - return nil + return rec.WriteResponse() } // executeTemplate executes the template contained in wb.buf and replaces it with the results. diff --git a/modules/caddytls/connpolicy.go b/modules/caddytls/connpolicy.go index 658adb9..3e46514 100644 --- a/modules/caddytls/connpolicy.go +++ b/modules/caddytls/connpolicy.go @@ -179,7 +179,7 @@ func (p *ConnectionPolicy) buildStandardTLSConfig(ctx caddy.Context) error { // session ticket key rotation tlsApp.SessionTickets.register(cfg) ctx.OnCancel(func() { - // do cleanup when the context is cancelled because, + // do cleanup when the context is canceled because, // though unlikely, it is possible that a context // needing a TLS server config could exist for less // than the lifetime of the whole app diff --git a/modules/logging/filewriter.go b/modules/logging/filewriter.go index cc60c64..f17f975 100644 --- a/modules/logging/filewriter.go +++ b/modules/logging/filewriter.go @@ -96,7 +96,7 @@ func (fw FileWriter) WriterKey() string { // OpenWriter opens a new file writer. func (fw FileWriter) OpenWriter() (io.WriteCloser, error) { // roll log files by default - if fw.Roll == nil || *fw.Roll == true { + if fw.Roll == nil || *fw.Roll { if fw.RollSizeMB == 0 { fw.RollSizeMB = 100 } -- cgit v1.2.3