mirror of
https://github.com/0xERR0R/blocky.git
synced 2026-10-12 02:01:13 +00:00
build: add additional linters
This commit is contained in:
@@ -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
@@ -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)
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user