Skip to content
Snippets Groups Projects
Commit 8a072922 authored by ale's avatar ale
Browse files

Suppress some linter warnings in tests

parent 305126af
No related branches found
No related tags found
No related merge requests found
...@@ -15,7 +15,7 @@ func TestProxyHeaders(t *testing.T) { ...@@ -15,7 +15,7 @@ func TestProxyHeaders(t *testing.T) {
if err != nil { if err != nil {
host = r.RemoteAddr host = r.RemoteAddr
} }
io.WriteString(w, host) io.WriteString(w, host) // nolint: errcheck
}) })
p1, err := newProxyHeaders(h, []string{"1.2.3.4/16"}) p1, err := newProxyHeaders(h, []string{"1.2.3.4/16"})
......
...@@ -22,13 +22,13 @@ import ( ...@@ -22,13 +22,13 @@ import (
func saveCertificate(cert *x509.Certificate, path string) { func saveCertificate(cert *x509.Certificate, path string) {
data := pem.EncodeToMemory(&pem.Block{Type: "CERTIFICATE", Bytes: cert.Raw}) data := pem.EncodeToMemory(&pem.Block{Type: "CERTIFICATE", Bytes: cert.Raw})
ioutil.WriteFile(path, data, 0644) ioutil.WriteFile(path, data, 0644) // nolint: errcheck
} }
func savePrivateKey(pkey *ecdsa.PrivateKey, path string) { func savePrivateKey(pkey *ecdsa.PrivateKey, path string) {
der, _ := x509.MarshalECPrivateKey(pkey) der, _ := x509.MarshalECPrivateKey(pkey)
data := pem.EncodeToMemory(&pem.Block{Type: "EC PRIVATE KEY", Bytes: der}) data := pem.EncodeToMemory(&pem.Block{Type: "EC PRIVATE KEY", Bytes: der})
ioutil.WriteFile(path, data, 0600) ioutil.WriteFile(path, data, 0600) // nolint: errcheck
} }
func generateTestCA(t testing.TB, dir string) (*x509.Certificate, *ecdsa.PrivateKey) { func generateTestCA(t testing.TB, dir string) (*x509.Certificate, *ecdsa.PrivateKey) {
...@@ -148,10 +148,10 @@ func TestTLS_Serve(t *testing.T) { ...@@ -148,10 +148,10 @@ func TestTLS_Serve(t *testing.T) {
}, },
} }
h := http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) { h := http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) {
io.WriteString(w, "OK") io.WriteString(w, "OK") // nolint: errcheck
}) })
go Serve(h, config, ":19898") go Serve(h, config, ":19898") // nolint: errcheck
time.Sleep(100 * time.Millisecond) time.Sleep(100 * time.Millisecond)
// A client without a certificate should get a transport-level error. // A client without a certificate should get a transport-level error.
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment