diff --git a/cmd/ooniprobe/internal/utils/utils.go b/cmd/ooniprobe/internal/utils/utils.go index 328e4da..ff25e20 100644 --- a/cmd/ooniprobe/internal/utils/utils.go +++ b/cmd/ooniprobe/internal/utils/utils.go @@ -39,7 +39,7 @@ func EscapeAwareRuneCountInString(s string) int { return n } -// RightPadd adds right padding in from of a string +// RightPad adds right padding in from of a string func RightPad(str string, length int) string { c := length - EscapeAwareRuneCountInString(str) if c < 0 { diff --git a/internal/engine/experiment/riseupvpn/riseupvpn_test.go b/internal/engine/experiment/riseupvpn/riseupvpn_test.go index 1be8aa4..6206034 100644 --- a/internal/engine/experiment/riseupvpn/riseupvpn_test.go +++ b/internal/engine/experiment/riseupvpn/riseupvpn_test.go @@ -555,6 +555,9 @@ func TestMissingTransport(t *testing.T) { transports = transports[:len(transports)-1] eipService.Gateways[1].Capabilities.Transport = transports eipservicejson, err := json.Marshal(eipservice) + if err != nil { + t.Fatal(err) + } requestResponseMap := map[string]string{ eipserviceurl: string(eipservicejson), @@ -746,7 +749,7 @@ func generateMockGetter(requestResponse map[string]string, responseStatus map[st FailedOperation: failedOperation, HTTPResponseStatus: responseStatus, HTTPResponseBody: responseBody, - Requests: []archival.RequestEntry{archival.RequestEntry{ + Requests: []archival.RequestEntry{{ Failure: failure, Request: archival.HTTPRequest{ URL: url, diff --git a/internal/engine/experiment/tlstool/internal/splitter.go b/internal/engine/experiment/tlstool/internal/splitter.go index 795f9a6..0aecfb8 100644 --- a/internal/engine/experiment/tlstool/internal/splitter.go +++ b/internal/engine/experiment/tlstool/internal/splitter.go @@ -29,7 +29,6 @@ func SNISplitter(input []byte, sni []byte) (output [][]byte) { } if len(buf) > 0 { output = append(output, buf) - buf = nil } output = append(output, input[idx+len(sni):]) return diff --git a/internal/engine/inputloader.go b/internal/engine/inputloader.go index 2dc1f87..4f28d3e 100644 --- a/internal/engine/inputloader.go +++ b/internal/engine/inputloader.go @@ -159,7 +159,7 @@ func (il *InputLoader) loadLocal() ([]model.URLInfo, error) { type inputLoaderOpenFn func(filepath string) (fs.File, error) // readfile reads inputs from the specified file. The open argument should be -// compatibile with stdlib's fs.Open and helps us with unit testing. +// compatible with stdlib's fs.Open and helps us with unit testing. func (il *InputLoader) readfile(filepath string, open inputLoaderOpenFn) ([]model.URLInfo, error) { inputs := []model.URLInfo{} filep, err := open(filepath) diff --git a/internal/engine/legacy/netx/dialer_test.go b/internal/engine/legacy/netx/dialer_test.go index 7f5e016..186fdd8 100644 --- a/internal/engine/legacy/netx/dialer_test.go +++ b/internal/engine/legacy/netx/dialer_test.go @@ -101,6 +101,9 @@ func TestDialerSetCABundleWAI(t *testing.T) { func TestDialerForceSpecificSNI(t *testing.T) { dialer := netx.NewDialer() err := dialer.ForceSpecificSNI("www.facebook.com") + if err != nil { + t.Fatal(err) + } conn, err := dialer.DialTLS("tcp", "www.google.com:443") if err == nil { t.Fatal("expected an error here") diff --git a/internal/engine/legacy/netx/modelx/modelx_test.go b/internal/engine/legacy/netx/modelx/modelx_test.go index 82deb2e..a0ec4b4 100644 --- a/internal/engine/legacy/netx/modelx/modelx_test.go +++ b/internal/engine/legacy/netx/modelx/modelx_test.go @@ -56,7 +56,7 @@ func TestMeasurementRootWithMeasurementRootPanic(t *testing.T) { } }() ctx := context.Background() - ctx = WithMeasurementRoot(ctx, nil) + _ = WithMeasurementRoot(ctx, nil) } func TestErrWrapperPublicAPI(t *testing.T) { diff --git a/internal/engine/netx/errorx/errorx_test.go b/internal/engine/netx/errorx/errorx_test.go index 9b69d2a..f37ff98 100644 --- a/internal/engine/netx/errorx/errorx_test.go +++ b/internal/engine/netx/errorx/errorx_test.go @@ -175,6 +175,9 @@ func TestToFailureString(t *testing.T) { defer cancel() // fail immediately udpAddr := &net.UDPAddr{IP: net.ParseIP("216.58.212.164"), Port: 80, Zone: ""} udpConn, err := net.ListenUDP("udp", &net.UDPAddr{IP: net.IPv4zero, Port: 0}) + if err != nil { + t.Fatal(err) + } sess, err := quic.DialEarlyContext(ctx, udpConn, udpAddr, "google.com:80", &tls.Config{}, &quic.Config{}) if err == nil { t.Fatal("expected an error here") diff --git a/pkg/oonimkall/session_integration_test.go b/pkg/oonimkall/session_integration_test.go index 725c872..9d9b7ff 100644 --- a/pkg/oonimkall/session_integration_test.go +++ b/pkg/oonimkall/session_integration_test.go @@ -78,7 +78,7 @@ func TestMaybeUpdateResourcesWithCancelledContext(t *testing.T) { ctx := sess.NewContext() ctx.Cancel() // cause immediate failure err = sess.MaybeUpdateResources(ctx) - // Explaination: we embed resources. We should change the API + // Explanation: we embed resources. We should change the API // and remove the context. Until we do that, let us just assert // that we have embedding and the context does not matter. if err != nil {