Switch to Go 1.23 and fix CI failures

Some new upcoming changes require us to use Go 1.23. However, if we switch to Go 1.23 some
new linter errors are showing up. This commit fixes most of the errors and adds an
exclusion for integer overflow errors.

Signed-off-by: Amit <ambarve@microsoft.com>
This commit is contained in:
Amit
2025-10-27 09:08:22 -07:00
committed by Amit Barve
parent bdc6c11280
commit fd34511314
52 changed files with 41 additions and 82 deletions
+4 -5
View File
@@ -1,5 +1,4 @@
//go:build windows
// +build windows
package bindfilter
@@ -109,7 +108,7 @@ func GetBindMappings(volumePath string) ([]BindMapping, error) {
}
if outBuffSize < 12 {
return nil, fmt.Errorf("invalid buffer returned")
return nil, errors.New("invalid buffer returned")
}
result := buf[:outBuffSize]
@@ -185,7 +184,7 @@ func decodeEntry(buffer []byte) (string, error) {
func getTargetsFromBuffer(buffer []byte, offset, count int) ([]string, error) {
if len(buffer) < offset+count*6 {
return nil, fmt.Errorf("invalid buffer")
return nil, errors.New("invalid buffer")
}
targets := make([]string, count)
@@ -193,7 +192,7 @@ func getTargetsFromBuffer(buffer []byte, offset, count int) ([]string, error) {
entryBuf := buffer[offset+i*8 : offset+i*8+8]
tgt := *(*mappingTargetEntry)(unsafe.Pointer(&entryBuf[0]))
if len(buffer) < int(tgt.TargetRootOffset)+int(tgt.TargetRootLength) {
return nil, fmt.Errorf("invalid buffer")
return nil, errors.New("invalid buffer")
}
decoded, err := decodeEntry(buffer[tgt.TargetRootOffset : tgt.TargetRootOffset+tgt.TargetRootLength])
if err != nil {
@@ -259,7 +258,7 @@ func getFinalPath(pth string) (string, error) {
func getBindMappingFromBuffer(buffer []byte, entry mappingEntry) (BindMapping, error) {
if len(buffer) < int(entry.VirtRootOffset)+int(entry.VirtRootLength) {
return BindMapping{}, fmt.Errorf("invalid buffer")
return BindMapping{}, errors.New("invalid buffer")
}
src, err := decodeEntry(buffer[entry.VirtRootOffset : entry.VirtRootOffset+entry.VirtRootLength])
-1
View File
@@ -1,5 +1,4 @@
//go:build windows
// +build windows
package bindfilter
-1
View File
@@ -1,5 +1,4 @@
//go:build windows
// +build windows
package etw
-1
View File
@@ -1,5 +1,4 @@
//go:build windows
// +build windows
package etw
-1
View File
@@ -1,5 +1,4 @@
//go:build windows
// +build windows
package etw
-2
View File
@@ -1,6 +1,4 @@
//go:build windows && (amd64 || arm64 || 386)
// +build windows
// +build amd64 arm64 386
package etw
-1
View File
@@ -1,5 +1,4 @@
//go:build windows && arm
// +build windows,arm
package etw
-1
View File
@@ -1,5 +1,4 @@
//go:build windows
// +build windows
package etw
-1
View File
@@ -1,5 +1,4 @@
//go:build windows
// +build windows
package etw
-1
View File
@@ -1,5 +1,4 @@
//go:build windows
// +build windows
package etw
-2
View File
@@ -1,6 +1,4 @@
//go:build windows && (386 || arm)
// +build windows
// +build 386 arm
package etw
-2
View File
@@ -1,6 +1,4 @@
//go:build windows && (amd64 || arm64)
// +build windows
// +build amd64 arm64
package etw
-1
View File
@@ -1,5 +1,4 @@
//go:build !windows
// +build !windows
package main
-1
View File
@@ -1,5 +1,4 @@
//go:build windows
// +build windows
// Shows a sample usage of the ETW logging package.
package main
-2
View File
@@ -1,6 +1,4 @@
//go:build windows && (386 || arm)
// +build windows
// +build 386 arm
package etw
-2
View File
@@ -1,6 +1,4 @@
//go:build windows && (amd64 || arm64)
// +build windows
// +build amd64 arm64
package etw
-1
View File
@@ -1,5 +1,4 @@
//go:build windows
// +build windows
package etwlogrus
-1
View File
@@ -1,5 +1,4 @@
//go:build windows
// +build windows
package etwlogrus
-1
View File
@@ -1,5 +1,4 @@
//go:build !windows
// +build !windows
package guid
-1
View File
@@ -1,5 +1,4 @@
//go:build windows
// +build windows
package guid
-1
View File
@@ -1,5 +1,4 @@
//go:build windows
// +build windows
package process
-1
View File
@@ -1,5 +1,4 @@
//go:build windows
// +build windows
package process
-1
View File
@@ -1,5 +1,4 @@
//go:build windows
// +build windows
package security
-1
View File
@@ -1,5 +1,4 @@
//go:build windows
// +build windows
package security