Skip to content

Commit 0356cd9

Browse files
fix(ipscan.go): lints related to fmt.ErrorF and address formatting
1 parent 63ffe2a commit 0356cd9

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

src/mod/ipscan/ipscan.go

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -108,7 +108,7 @@ func (host *DiscoveredHost) CheckPing() error {
108108
pinger.Run()
109109
stats := pinger.Statistics()
110110
if stats.PacketsRecv == 0 {
111-
return fmt.Errorf("Host unreachable for " + host.IP)
111+
return fmt.Errorf("host unreachable for %s", host.IP)
112112
}
113113
host.Ping = int(stats.AvgRtt.Milliseconds())
114114
return nil
@@ -136,7 +136,7 @@ func (host *DiscoveredHost) ScanPorts(startPort, endPort int) []int {
136136
var openPorts []int
137137

138138
for port := startPort; port <= endPort; port++ {
139-
target := fmt.Sprintf("%s:%d", host.IP, port)
139+
target := net.JoinHostPort(host.IP, fmt.Sprintf("%d", port))
140140
conn, err := net.DialTimeout("tcp", target, time.Millisecond*500)
141141
if err == nil {
142142
conn.Close()

0 commit comments

Comments
 (0)