@marcel91200 / caddy Mirror · read-only / commits / dff78d82
Fork 0

Fast and extensible multi-platform HTTP/1-2-3 web server with automatic HTTPS

Mirrored from https://github.com/Slazee/caddy.git

Synced Nov 14, 05:15 UTC

v2: housekeeping: address minor lint complaints (#2957)

* v2: housekeeping: update tools * v2: housekeeping: adhere to US locale in spelling * v2: housekeeping: simplify code

Mohammed Al Sahaf committed Jan 3, 2020 at 21:33 UTC dff78d82ce21d97cad53171b72b88550e02c2c7f
9 files changed +12 -15
azure-pipelines.yml
+2 -2
@@ -78,7 +78,7 @@ jobs:
78 condition: eq( variables['Agent.OS'], 'Windows_NT' )
79 displayName: Install Go on Windows
80
81 - - bash: curl -sfL https://raw.githubusercontent.com/golangci/golangci-lint/master/install.sh | sh -s -- -b $(go env GOPATH)/bin v1.19.1
81 + - bash: curl -sfL https://raw.githubusercontent.com/golangci/golangci-lint/master/install.sh | sh -s -- -b $(go env GOPATH)/bin v1.22.2
82 displayName: Install golangci-lint
83
84 - script: |
@@ -198,7 +198,7 @@ jobs:
198 sudo apt update && sudo apt install -y clang-7 lldb-7 lld-7
199
200 go get -v github.com/dvyukov/go-fuzz/go-fuzz github.com/dvyukov/go-fuzz/go-fuzz-build
201 - wget -q -O fuzzit https://github.com/fuzzitdev/fuzzit/releases/download/v2.4.74/fuzzit_Linux_x86_64
201 + wget -q -O fuzzit https://github.com/fuzzitdev/fuzzit/releases/download/v2.4.77/fuzzit_Linux_x86_64
202 chmod a+x fuzzit
203 mv fuzzit $(GOBIN)
204 displayName: Download go-fuzz tools and the Fuzzit CLI, and move Fuzzit CLI to GOBIN
context.go
+2 -2
@@ -30,7 +30,7 @@ import (
30 // that spawned the modules which are loaded. It should be used
31 // with care and wrapped with derivation functions from the
32 // standard context package only if you don't need the Caddy
33 -// specific features. These contexts are cancelled when the
33 +// specific features. These contexts are canceled when the
34 // lifetime of the modules loaded from it is over.
35 //
36 // Use NewContext() to get a valid value (but most modules will
@@ -75,7 +75,7 @@ func NewContext(ctx Context) (Context, context.CancelFunc) {
75 return newCtx, wrappedCancel
76 }
77
78 -// OnCancel executes f when ctx is cancelled.
78 +// OnCancel executes f when ctx is canceled.
79 func (ctx *Context) OnCancel(f func()) {
80 ctx.cleanupFuncs = append(ctx.cleanupFuncs, f)
81 }
listeners.go
+1 -1
@@ -138,7 +138,7 @@ func (fcl *fakeCloseListener) Accept() (net.Conn, error) {
138 fcl.deadlineMu.Unlock()
139
140 if atomic.LoadInt32(&fcl.closed) == 1 {
141 - // if we cancelled the Accept() by setting a deadline
141 + // if we canceled the Accept() by setting a deadline
142 // on the listener, we need to make sure any callers of
143 // Accept() think the listener was actually closed;
144 // if we return the timeout error instead, callers might
logging.go
+2 -2
@@ -76,7 +76,7 @@ type Logging struct {
76 }
77
78 // openLogs sets up the config and opens all the configured writers.
79 -// It closes its logs when ctx is cancelled, so it should clean up
79 +// It closes its logs when ctx is canceled, so it should clean up
80 // after itself.
81 func (logging *Logging) openLogs(ctx Context) error {
82 // make sure to deallocate resources when context is done
@@ -184,7 +184,7 @@ func (logging *Logging) setupNewDefault(ctx Context) error {
184
185 // closeLogs cleans up resources allocated during openLogs.
186 // A successful call to openLogs calls this automatically
187 -// when the context is cancelled.
187 +// when the context is canceled.
188 func (logging *Logging) closeLogs() error {
189 for _, key := range logging.writerKeys {
190 _, err := writers.Delete(key)
modules/caddyhttp/reverseproxy/streaming.go
-1
@@ -68,7 +68,6 @@ func (h Handler) handleUpgradeResponse(rw http.ResponseWriter, req *http.Request
68 go spc.copyToBackend(errc)
69 go spc.copyFromBackend(errc)
70 <-errc
71 - return
71 }
72
73 // flushInterval returns the p.FlushInterval value, conditionally
modules/caddyhttp/starlarkmw/internal/lib/module.go
+2 -2
@@ -60,7 +60,7 @@ func (r *LoadMiddleware) Run(thread *starlark.Thread, fn *starlark.Builtin, args
60
61 js := json.RawMessage(cfg.String())
62
63 - if strings.Index(name, "http.handlers.") == -1 {
63 + if !strings.Contains(name, "http.handlers.") {
64 name = fmt.Sprintf("http.handlers.%s", name)
65 }
66
@@ -108,7 +108,7 @@ func (r *LoadResponder) Run(thread *starlark.Thread, fn *starlark.Builtin, args
108
109 js := json.RawMessage(cfg.String())
110
111 - if strings.Index(name, "http.handlers.") == -1 {
111 + if !strings.Contains(name, "http.handlers.") {
112 name = fmt.Sprintf("http.handlers.%s", name)
113 }
114
modules/caddyhttp/templates/templates.go
+1 -3
@@ -259,9 +259,7 @@ func (t *Templates) ServeHTTP(w http.ResponseWriter, r *http.Request, next caddy
259 // refresh, so disable them until we find a better way to do this
260 rec.Header().Del("Etag")
261
262 - rec.WriteResponse()
263 -
264 - return nil
262 + return rec.WriteResponse()
263 }
264
265 // executeTemplate executes the template contained in wb.buf and replaces it with the results.
modules/caddytls/connpolicy.go
+1 -1
@@ -179,7 +179,7 @@ func (p *ConnectionPolicy) buildStandardTLSConfig(ctx caddy.Context) error {
179 // session ticket key rotation
180 tlsApp.SessionTickets.register(cfg)
181 ctx.OnCancel(func() {
182 - // do cleanup when the context is cancelled because,
182 + // do cleanup when the context is canceled because,
183 // though unlikely, it is possible that a context
184 // needing a TLS server config could exist for less
185 // than the lifetime of the whole app
modules/logging/filewriter.go
+1 -1
@@ -96,7 +96,7 @@ func (fw FileWriter) WriterKey() string {
96 // OpenWriter opens a new file writer.
97 func (fw FileWriter) OpenWriter() (io.WriteCloser, error) {
98 // roll log files by default
99 - if fw.Roll == nil || *fw.Roll == true {
99 + if fw.Roll == nil || *fw.Roll {
100 if fw.RollSizeMB == 0 {
101 fw.RollSizeMB = 100
102 }