build: add additional linters

This commit is contained in:
Dimitri Herzog
2025-08-08 23:20:29 +02:00
committed by GitHub
parent 098f17b3dd
commit 353b4e5b81
51 changed files with 147 additions and 134 deletions
+4 -2
View File
@@ -3,11 +3,13 @@ package helpertest
import (
"bytes"
"context"
"errors"
"fmt"
"net"
"net/http"
"net/http/httptest"
"os"
"strconv"
"strings"
"github.com/0xERR0R/blocky/log"
@@ -43,7 +45,7 @@ func GetIntPort(port int) int {
// process by adding the current ginkgo parallel process to
// the base port and returning it as string.
func GetStringPort(port int) string {
return fmt.Sprintf("%d", GetIntPort(port))
return strconv.Itoa(GetIntPort(port))
}
// GetHostPort returns a host:port string for the current testing
@@ -181,7 +183,7 @@ func HaveTTL(matcher types.GomegaMatcher) types.GomegaMatcher {
// No records to match
if len(records) == 0 {
return 0, fmt.Errorf("answer must not be empty")
return 0, errors.New("answer must not be empty")
}
// Return TTL of the first record
+3 -3
View File
@@ -12,7 +12,7 @@ import (
type HTTPProxy struct {
Addr net.Addr
requestTarget atomic.Value // string: HTTP Host of latest request
requestTarget atomic.Pointer[string] // string: HTTP Host of latest request
}
// TestHTTPProxy returns a new HTTPProxy server.
@@ -61,11 +61,11 @@ func (p *HTTPProxy) RequestTarget() string {
ginkgo.Fail(fmt.Sprintf("http proxy %s received no requests", p.Addr))
}
return val.(string)
return *val
}
func (p *HTTPProxy) ServeHTTP(w http.ResponseWriter, req *http.Request) {
p.requestTarget.Store(req.Host)
p.requestTarget.Store(&req.Host)
w.WriteHeader(http.StatusNotImplemented)
}