Skip to content

Agent Mesh

Fix lint errors

Antonio Ojea879abf9fca87
diff --git a/tests/integration/fakedns_test.go b/tests/integration/fakedns_test.go
index 8f56216d..3308b95a 100644
--- a/tests/integration/fakedns_test.go
+++ b/tests/integration/fakedns_test.go
@@ -73,7 +73,7 @@ func (s *FakeDNSServer) serve() {
resp := dnsmessage.Message{
Header: dnsmessage.Header{
- ID: msg.Header.ID,
+ ID: msg.ID,
Response: true,
Authoritative: true,
},
@@ -85,7 +85,8 @@ func (s *FakeDNSServer) serve() {
domain := strings.TrimSuffix(q.Name.String(), ".")
s.mu.RLock()
- if q.Type == dnsmessage.TypeA || q.Type == dnsmessage.TypeAAAA {
+ switch q.Type {
+ case dnsmessage.TypeA, dnsmessage.TypeAAAA:
if ip, ok := s.hosts[domain]; ok {
if ipv4 := ip.To4(); ipv4 != nil && q.Type == dnsmessage.TypeA {
resp.Answers = append(resp.Answers, dnsmessage.Resource{
@@ -99,7 +100,7 @@ func (s *FakeDNSServer) serve() {
})
}
}
- } else if q.Type == dnsmessage.TypeTXT {
+ case dnsmessage.TypeTXT:
if txtRecords, ok := s.txtHosts[domain]; ok {
for _, txt := range txtRecords {
resp.Answers = append(resp.Answers, dnsmessage.Resource{
@@ -114,7 +115,7 @@ func (s *FakeDNSServer) serve() {
packed, err := resp.Pack()
if err == nil {
- s.conn.WriteToUDP(packed, addr)
+ _, _ = s.conn.WriteToUDP(packed, addr)
}
}
}
@@ -134,7 +135,7 @@ func (s *FakeDNSServer) Hijack(t *testing.T) {
t.Cleanup(func() {
net.DefaultResolver.Dial = originalDial
net.DefaultResolver.PreferGo = originalPreferGo
- s.conn.Close()
+ _ = s.conn.Close()
dnsHijackLock.Unlock()
})
}
diff --git a/tests/integration/federation_test.go b/tests/integration/federation_test.go
index 913869b8..d6e34700 100644
--- a/tests/integration/federation_test.go
+++ b/tests/integration/federation_test.go
@@ -217,7 +217,7 @@ roles:
// Assert datapath works via Node B's local Egress Proxy
t.Log("Testing datapath from Node B to Node A...")
-
+
// Extract Node A's Peer ID from its logs
peerIDRe := regexp.MustCompile(`(?m)^PeerID:\s+([A-Za-z0-9]+)$`)
matches := peerIDRe.FindStringSubmatch(nodeStdoutA.String())
@@ -230,12 +230,12 @@ roles:
proxyURL := fmt.Sprintf("http://127.0.0.1:%d/sam/%s/mcp/federated-tool", apiPortB, peerIDA_node)
req, _ := http.NewRequest("POST", proxyURL, bytes.NewBuffer([]byte(`{"jsonrpc": "2.0", "id": 1, "method": "test"}`)))
req.Header.Set("Authorization", "Bearer tokenB")
-
+
resp, err := http.DefaultClient.Do(req)
if err != nil {
t.Fatalf("Datapath failed: %v", err)
}
- defer resp.Body.Close()
+ defer func() { _ = resp.Body.Close() }()
if resp.StatusCode != http.StatusOK {
body, _ := io.ReadAll(resp.Body)
t.Fatalf("Datapath returned status %d: %s", resp.StatusCode, string(body))
@@ -250,7 +250,7 @@ roles:
func fetchPeerID(t *testing.T, port int) string {
var bodyBytes []byte
var err error
-
+
ctx, cancel := context.WithTimeout(context.Background(), 10*time.Second)
defer cancel()
@@ -259,7 +259,7 @@ func fetchPeerID(t *testing.T, port int) string {
resp, err = http.Get(fmt.Sprintf("http://127.0.0.1:%d/info", port))
if err == nil {
bodyBytes, err = io.ReadAll(resp.Body)
- resp.Body.Close()
+ _ = resp.Body.Close()
if err == nil {
break
}
diff --git a/tests/integration/mock_oidc_test.go b/tests/integration/mock_oidc_test.go
index c36a13c1..7d25c6ee 100644
--- a/tests/integration/mock_oidc_test.go
+++ b/tests/integration/mock_oidc_test.go
@@ -26,7 +26,7 @@ func startMockOIDC(t *testing.T) (string, string) {
mux.HandleFunc("/.well-known/openid-configuration", func(w http.ResponseWriter, r *http.Request) {
w.Header().Set("Content-Type", "application/json")
- json.NewEncoder(w).Encode(map[string]interface{}{
+ _ = json.NewEncoder(w).Encode(map[string]interface{}{
"issuer": issuer,
"jwks_uri": issuer + "/keys",
})
@@ -34,7 +34,7 @@ func startMockOIDC(t *testing.T) (string, string) {
mux.HandleFunc("/keys", func(w http.ResponseWriter, r *http.Request) {
w.Header().Set("Content-Type", "application/json")
- json.NewEncoder(w).Encode(map[string]interface{}{
+ _ = json.NewEncoder(w).Encode(map[string]interface{}{
"keys": []map[string]interface{}{
{
"kty": "RSA",