diff --git a/.golangci.yml b/.golangci.yml index d9efa75c7..eac1e3dbd 100644 --- a/.golangci.yml +++ b/.golangci.yml @@ -1,5 +1,6 @@ # Run only staticcheck for now. Additional linters will be enabled one-by-one. linters: - enable: - - staticcheck disable-all: true + enable: + - misspell + - staticcheck diff --git a/config/config.go b/config/config.go index b665a6e11..d1a7dc46b 100644 --- a/config/config.go +++ b/config/config.go @@ -463,8 +463,8 @@ func (s *HeaderMatch) UnmarshalYAML(unmarshal func(interface{}) error) error { // // With that logic, this function validates that if a compression // algorithm is specified, it's covered by the specified accept encoding -// header. It doesn't need to be the most prefered encoding, but it MUST -// be included in the prefered encodings. +// header. It doesn't need to be the most preferred encoding, but it MUST +// be included in the preferred encodings. func isCompressionAcceptEncodingValid(encoding, acceptEncoding string) bool { // unspecified compression + any encoding value is valid // any compression + no accept encoding is valid diff --git a/prober/http_test.go b/prober/http_test.go index 05ca36d8e..7427458ac 100644 --- a/prober/http_test.go +++ b/prober/http_test.go @@ -174,7 +174,7 @@ func TestContentLength(t *testing.T) { fw.Close() return testdata{ msg: msg, - contentLength: len(buf.Bytes()), // Content lenght is the length of the compressed buffer. + contentLength: len(buf.Bytes()), // Content length is the length of the compressed buffer. uncompressedBodyLength: len(buf.Bytes()), // No decompression. handler: func(w http.ResponseWriter, r *http.Request) { w.Header().Add("Content-Encoding", "br") @@ -194,7 +194,7 @@ func TestContentLength(t *testing.T) { fw.Close() return testdata{ msg: msg, - contentLength: len(buf.Bytes()), // Content lenght is the length of the compressed buffer. + contentLength: len(buf.Bytes()), // Content length is the length of the compressed buffer. uncompressedBodyLength: len(buf.Bytes()), // No decompression. handler: func(w http.ResponseWriter, r *http.Request) { w.Header().Add("Content-Encoding", "deflate") @@ -213,7 +213,7 @@ func TestContentLength(t *testing.T) { gw.Close() return testdata{ msg: msg, - contentLength: len(buf.Bytes()), // Content lenght is the length of the compressed buffer. + contentLength: len(buf.Bytes()), // Content length is the length of the compressed buffer. uncompressedBodyLength: len(buf.Bytes()), // No decompression. handler: func(w http.ResponseWriter, r *http.Request) { w.Header().Add("Content-Encoding", "gzip") @@ -285,7 +285,7 @@ func TestHandlingOfCompressionSetting(t *testing.T) { enc.Write(msg) enc.Close() return testdata{ - contentLength: buf.Len(), // Content lenght is the length of the compressed buffer. + contentLength: buf.Len(), // Content length is the length of the compressed buffer. uncompressedBodyLength: len(msg), handler: func(w http.ResponseWriter, r *http.Request) { w.Header().Add("Content-Encoding", "gzip") @@ -306,7 +306,7 @@ func TestHandlingOfCompressionSetting(t *testing.T) { enc.Write(msg) enc.Close() return testdata{ - contentLength: len(buf.Bytes()), // Content lenght is the length of the compressed buffer. + contentLength: len(buf.Bytes()), // Content length is the length of the compressed buffer. uncompressedBodyLength: len(msg), handler: func(w http.ResponseWriter, r *http.Request) { w.Header().Add("Content-Encoding", "br") @@ -328,7 +328,7 @@ func TestHandlingOfCompressionSetting(t *testing.T) { enc.Write(msg) enc.Close() return testdata{ - contentLength: len(buf.Bytes()), // Content lenght is the length of the compressed buffer. + contentLength: len(buf.Bytes()), // Content length is the length of the compressed buffer. uncompressedBodyLength: len(msg), handler: func(w http.ResponseWriter, r *http.Request) { w.Header().Add("Content-Encoding", "deflate") @@ -367,7 +367,7 @@ func TestHandlingOfCompressionSetting(t *testing.T) { enc.Close() return testdata{ expectFailure: true, - contentLength: buf.Len(), // Content lenght is the length of the compressed buffer. + contentLength: buf.Len(), // Content length is the length of the compressed buffer. uncompressedBodyLength: 0, handler: func(w http.ResponseWriter, r *http.Request) { w.Header().Add("Content-Encoding", "gzip") @@ -389,7 +389,7 @@ func TestHandlingOfCompressionSetting(t *testing.T) { enc.Close() return testdata{ expectFailure: false, - contentLength: buf.Len(), // Content lenght is the length of the compressed buffer. + contentLength: buf.Len(), // Content length is the length of the compressed buffer. uncompressedBodyLength: len(msg), handler: func(w http.ResponseWriter, r *http.Request) { w.Header().Add("Content-Encoding", "gzip") @@ -414,7 +414,7 @@ func TestHandlingOfCompressionSetting(t *testing.T) { enc.Close() return testdata{ expectFailure: false, - contentLength: buf.Len(), // Content lenght is the length of the compressed buffer. + contentLength: buf.Len(), // Content length is the length of the compressed buffer. uncompressedBodyLength: len(msg), handler: func(w http.ResponseWriter, r *http.Request) { w.Header().Add("Content-Encoding", "gzip") @@ -439,7 +439,7 @@ func TestHandlingOfCompressionSetting(t *testing.T) { enc.Close() return testdata{ expectFailure: false, - contentLength: buf.Len(), // Content lenght is the length of the compressed buffer. + contentLength: buf.Len(), // Content length is the length of the compressed buffer. uncompressedBodyLength: len(msg), handler: func(w http.ResponseWriter, r *http.Request) { w.Header().Add("Content-Encoding", "gzip") @@ -728,7 +728,7 @@ func TestRedirectionLimit(t *testing.T) { registry, log.NewNopLogger()) if result { - t.Fatalf("Probe suceeded unexpectedly") + t.Fatalf("Probe succeeded unexpectedly") } if tooManyRedirects { @@ -825,7 +825,7 @@ func TestFailIfNotSSL(t *testing.T) { config.Module{Timeout: time.Second, HTTP: config.HTTPProbe{IPProtocolFallback: true, FailIfNotSSL: true}}, registry, log.NewNopLogger()) body := recorder.Body.String() if result { - t.Fatalf("Fail if not SSL test suceeded unexpectedly, got %s", body) + t.Fatalf("Fail if not SSL test succeeded unexpectedly, got %s", body) } mfs, err := registry.Gather() if err != nil { @@ -1204,7 +1204,7 @@ func TestFailIfSelfSignedCA(t *testing.T) { }}, registry, log.NewNopLogger()) body := recorder.Body.String() if result { - t.Fatalf("Fail if selfsigned CA test suceeded unexpectedly, got %s", body) + t.Fatalf("Fail if selfsigned CA test succeeded unexpectedly, got %s", body) } mfs, err := registry.Gather() if err != nil { diff --git a/prober/tcp_test.go b/prober/tcp_test.go index 846f7b0c8..0deba3a83 100644 --- a/prober/tcp_test.go +++ b/prober/tcp_test.go @@ -67,7 +67,7 @@ func TestTCPConnectionFails(t *testing.T) { testCTX, cancel := context.WithTimeout(context.Background(), 10*time.Second) defer cancel() if ProbeTCP(testCTX, ":0", config.Module{TCP: config.TCPProbe{}}, registry, log.NewNopLogger()) { - t.Fatalf("TCP module suceeded, expected failure.") + t.Fatalf("TCP module succeeded, expected failure.") } }