Skip to content

Commit

Permalink
fixed some linter warnings
Browse files Browse the repository at this point in the history
  • Loading branch information
caffix committed Jul 6, 2023
1 parent 156cfa7 commit 2395c5b
Show file tree
Hide file tree
Showing 4 changed files with 7 additions and 8 deletions.
9 changes: 4 additions & 5 deletions cmd/resolve/main_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,6 @@ package main
import (
"fmt"
"io"
"io/ioutil"
"log"
"net"
"os"
Expand Down Expand Up @@ -114,17 +113,17 @@ func compareParams(got, expected *params) bool {
}

func TestSetupFiles(t *testing.T) {
logfile, err := ioutil.TempFile("", "log")
logfile, err := os.CreateTemp("", "log")
if err != nil {
t.Fatalf("Failed to open the temporary log file: %v", err)
}

output, err := ioutil.TempFile("", "output")
output, err := os.CreateTemp("", "output")
if err != nil {
t.Fatalf("Failed to open the temporary output file: %v", err)
}

input, err := ioutil.TempFile("", "input")
input, err := os.CreateTemp("", "input")
if err != nil {
t.Fatalf("Failed to open the temporary input file: %v", err)
}
Expand Down Expand Up @@ -248,7 +247,7 @@ func TestEventLoop(t *testing.T) {

output, _ := os.Open(os.DevNull)
p := &params{
Log: log.New(ioutil.Discard, "", 0),
Log: log.New(io.Discard, "", 0),
QPS: 10,
Qtypes: []uint16{dns.TypeA},
Output: output,
Expand Down
2 changes: 1 addition & 1 deletion conn.go
Original file line number Diff line number Diff line change
Expand Up @@ -92,7 +92,7 @@ func (c *connections) WriteMsg(msg *dns.Msg, addr *net.UDPAddr) error {
if out, err = msg.Pack(); err == nil {
conn := c.Next()

conn.SetWriteDeadline(time.Now().Add(500 * time.Millisecond))
_ = conn.SetWriteDeadline(time.Now().Add(500 * time.Millisecond))
if n, err = conn.WriteToUDP(out, addr); err == nil && n < len(out) {
err = fmt.Errorf("only wrote %d bytes of the %d byte message", n, len(out))
}
Expand Down
2 changes: 1 addition & 1 deletion conn_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ func TestConnections(t *testing.T) {
msg := QueryMsg(name, 1)

if addr, err := net.ResolveUDPAddr("udp", addrstr); err == nil {
conn.WriteMsg(msg, addr)
_ = conn.WriteMsg(msg, addr)
}
if i%10 == 0 {
time.Sleep(100 * time.Millisecond)
Expand Down
2 changes: 1 addition & 1 deletion rate.go
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ import (
)

const (
maxQPSPerNameserver = 500
maxQPSPerNameserver = 100
numIntervalSeconds = 2
rateUpdateInterval = numIntervalSeconds * time.Second
maxTimeoutPercentage = 0.1
Expand Down

0 comments on commit 2395c5b

Please sign in to comment.