fix(providers,tools): address linter issues after reorg

This commit is contained in:
lc6464 committed 2026-04-17 14:16:18 +08:00
1 parent 4c133dc2d9
commit 9b4efddd9b
5 files changed
+36 -27

No files matched your search

+6 -6
View File
@@ -120,16 +120,12 @@ func (t *I2CTool) detect() *ToolResult {
// Helper functions for I2C operations (used by platform-specific implementations)
// isValidBusID checks that a bus identifier is a simple number (prevents path injection)
//
//nolint:unused // Used by i2c_linux.go
func isValidBusID(id string) bool {
matched, _ := regexp.MatchString(`^\d+$`, id)
return matched
}
// parseI2CAddress extracts and validates an I2C address from args
//
//nolint:unused // Used by i2c_linux.go
func parseI2CAddress(args map[string]any) (int, *ToolResult) {
addrFloat, ok := args["address"].(float64)
if !ok {
@@ -143,8 +139,6 @@ func parseI2CAddress(args map[string]any) (int, *ToolResult) {
}
// parseI2CBus extracts and validates an I2C bus from args
//
//nolint:unused // Used by i2c_linux.go
func parseI2CBus(args map[string]any) (string, *ToolResult) {
bus, ok := args["bus"].(string)
if !ok || bus == "" {
@@ -155,3 +149,9 @@ func parseI2CBus(args map[string]any) (string, *ToolResult) {
}
return bus, nil
}
var (
_ = isValidBusID
_ = parseI2CAddress
_ = parseI2CBus
)
+2 -2
View File
@@ -122,8 +122,6 @@ func (t *SPITool) list() *ToolResult {
// Helper function for SPI operations (used by platform-specific implementations)
// parseSPIArgs extracts and validates common SPI parameters
//
//nolint:unused // Used by spi_linux.go
func parseSPIArgs(args map[string]any) (device string, speed uint32, mode uint8, bits uint8, errMsg string) {
dev, ok := args["device"].(string)
if !ok || dev == "" {
@@ -160,3 +158,5 @@ func parseSPIArgs(args map[string]any) (device string, speed uint32, mode uint8,
return dev, speed, mode, bits, ""
}
var _ = parseSPIArgs