Skip to content

Commit

Permalink
fixup! chore: Specify minimum Golang version as 1.20
Browse files Browse the repository at this point in the history
  • Loading branch information
rexagod committed Mar 30, 2024
1 parent bc79f98 commit 4310ef4
Show file tree
Hide file tree
Showing 6 changed files with 12 additions and 12 deletions.
4 changes: 2 additions & 2 deletions arp.go
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,7 @@ type ARPEntry struct {
func (fs FS) GatherARPEntries() ([]ARPEntry, error) {
data, err := os.ReadFile(fs.proc.Path("net/arp"))
if err != nil {
return nil, fmt.Errorf("%w: error reading arp %w: %w", ErrFileRead, fs.proc.Path("net/arp"), err)
return nil, fmt.Errorf("%w: error reading arp %s: %w", ErrFileRead, fs.proc.Path("net/arp"), err)
}

return parseARPEntries(data)
Expand All @@ -78,7 +78,7 @@ func parseARPEntries(data []byte) ([]ARPEntry, error) {
} else if width == expectedDataWidth {
entry, err := parseARPEntry(columns)
if err != nil {
return []ARPEntry{}, fmt.Errorf("%w: Failed to parse ARP entry: %w: %w", ErrFileParse, entry, err)
return []ARPEntry{}, fmt.Errorf("%w: Failed to parse ARP entry: %v: %w", ErrFileParse, entry, err)
}
entries = append(entries, entry)
} else {
Expand Down
6 changes: 3 additions & 3 deletions ipvs.go
Original file line number Diff line number Diff line change
Expand Up @@ -221,16 +221,16 @@ func parseIPPort(s string) (net.IP, uint16, error) {
case 46:
ip = net.ParseIP(s[1:40])
if ip == nil {
return nil, 0, fmt.Errorf("%w: Invalid IPv6 addr %w: %w", ErrFileParse, s[1:40], err)
return nil, 0, fmt.Errorf("%w: Invalid IPv6 addr %s: %w", ErrFileParse, s[1:40], err)
}
default:
return nil, 0, fmt.Errorf("%w: Unexpected IP:Port %w: %w", ErrFileParse, s, err)
return nil, 0, fmt.Errorf("%w: Unexpected IP:Port %s: %w", ErrFileParse, s, err)
}

portString := s[len(s)-4:]
if len(portString) != 4 {
return nil, 0,
fmt.Errorf("%w: Unexpected port string format %w: %w", ErrFileParse, portString, err)
fmt.Errorf("%w: Unexpected port string format %s: %w", ErrFileParse, portString, err)
}
port, err := strconv.ParseUint(portString, 16, 16)
if err != nil {
Expand Down
4 changes: 2 additions & 2 deletions mdstat.go
Original file line number Diff line number Diff line change
Expand Up @@ -189,7 +189,7 @@ func evalStatusLine(deviceLine, statusLine string) (active, total, down, size in

matches := statusLineRE.FindStringSubmatch(statusLine)
if len(matches) != 5 {
return 0, 0, 0, 0, fmt.Errorf("%w: Could not fild all substring matches %w: %w", ErrFileParse, statusLine, err)
return 0, 0, 0, 0, fmt.Errorf("%w: Could not fild all substring matches %s: %w", ErrFileParse, statusLine, err)
}

total, err = strconv.ParseInt(matches[2], 10, 64)
Expand All @@ -209,7 +209,7 @@ func evalStatusLine(deviceLine, statusLine string) (active, total, down, size in
func evalRecoveryLine(recoveryLine string) (syncedBlocks int64, pct float64, finish float64, speed float64, err error) {
matches := recoveryLineBlocksRE.FindStringSubmatch(recoveryLine)
if len(matches) != 2 {
return 0, 0, 0, 0, fmt.Errorf("%w: Unexpected recoveryLine %w: %w", ErrFileParse, recoveryLine, err)
return 0, 0, 0, 0, fmt.Errorf("%w: Unexpected recoveryLine %s: %w", ErrFileParse, recoveryLine, err)
}

syncedBlocks, err = strconv.ParseInt(matches[1], 10, 64)
Expand Down
2 changes: 1 addition & 1 deletion net_ip_socket.go
Original file line number Diff line number Diff line change
Expand Up @@ -155,7 +155,7 @@ func parseIP(hexIP string) (net.IP, error) {
}
return i, nil
default:
return nil, fmt.Errorf("%w: Unable to parse IP %w: %w", ErrFileParse, hexIP, nil)
return nil, fmt.Errorf("%w: Unable to parse IP %s: %v", ErrFileParse, hexIP, nil)
}
}

Expand Down
2 changes: 1 addition & 1 deletion proc_sys.go
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,7 @@ func (fs FS) SysctlInts(sysctl string) ([]int, error) {
vp := util.NewValueParser(f)
values[i] = vp.Int()
if err := vp.Err(); err != nil {
return nil, fmt.Errorf("%w: field %d in sysctl %w is not a valid int: %w", ErrFileParse, i, sysctl, err)
return nil, fmt.Errorf("%w: field %d in sysctl %s is not a valid int: %w", ErrFileParse, i, sysctl, err)
}
}
return values, nil
Expand Down
6 changes: 3 additions & 3 deletions swaps.go
Original file line number Diff line number Diff line change
Expand Up @@ -74,15 +74,15 @@ func parseSwapString(swapString string) (*Swap, error) {

swap.Size, err = strconv.Atoi(swapFields[2])
if err != nil {
return nil, fmt.Errorf("%w: invalid swap size: %w: %w", ErrFileParse, swapFields[2], err)
return nil, fmt.Errorf("%w: invalid swap size: %s: %w", ErrFileParse, swapFields[2], err)
}
swap.Used, err = strconv.Atoi(swapFields[3])
if err != nil {
return nil, fmt.Errorf("%w: invalid swap used: %w: %w", ErrFileParse, swapFields[3], err)
return nil, fmt.Errorf("%w: invalid swap used: %s: %w", ErrFileParse, swapFields[3], err)
}
swap.Priority, err = strconv.Atoi(swapFields[4])
if err != nil {
return nil, fmt.Errorf("%w: invalid swap priority: %w: %w", ErrFileParse, swapFields[4], err)
return nil, fmt.Errorf("%w: invalid swap priority: %s: %w", ErrFileParse, swapFields[4], err)
}

return swap, nil
Expand Down

0 comments on commit 4310ef4

Please sign in to comment.