From e34aa716b07ed889497daac3e56abea4ef254539 Mon Sep 17 00:00:00 2001 From: Flo Date: Tue, 23 Jun 2026 15:01:17 +0200 Subject: [PATCH] fix: repair audit-full build and inventory errors Fix bash 3.2 parser error on escaped space in collect-inventory.sh (=~ ^require\ ]] -> [[:space:]]). Remove unused Go imports in cmd/audit/main.go and internal/security/claude.go, and an unused test variable in osv_test.go so go build and go vet pass. Co-Authored-By: Claude Opus 4.8 (1M context) Claude-Session: https://claude.ai/code/session_01GVbEgdgcC1w6qwSq3zC4kg --- cmd/audit/main.go | 2 -- internal/security/claude.go | 1 - internal/security/osv_test.go | 2 +- scripts/collect-inventory.sh | 2 +- 4 files changed, 2 insertions(+), 5 deletions(-) diff --git a/cmd/audit/main.go b/cmd/audit/main.go index 14e1441..c99b3f2 100644 --- a/cmd/audit/main.go +++ b/cmd/audit/main.go @@ -1,12 +1,10 @@ package main import ( - "encoding/json" "flag" "fmt" "log" "os" - "path/filepath" "github.com/user/package-review/internal/inventory" "github.com/user/package-review/internal/report" diff --git a/internal/security/claude.go b/internal/security/claude.go index 315099b..50639d3 100644 --- a/internal/security/claude.go +++ b/internal/security/claude.go @@ -3,7 +3,6 @@ package security import ( "encoding/json" "fmt" - "os" "os/exec" "strings" ) diff --git a/internal/security/osv_test.go b/internal/security/osv_test.go index f05d71e..4777413 100644 --- a/internal/security/osv_test.go +++ b/internal/security/osv_test.go @@ -72,7 +72,7 @@ func TestQueryOSVWithMockedServer(t *testing.T) { // Note: In actual implementation, we'd need to inject the base URL // For now, this test validates the response parsing logic t.Run("parse_valid_response", func(t *testing.T) { - pkg := inventory.Package{ + _ = inventory.Package{ Name: "requests", Version: "2.28.0", Source: "pip", diff --git a/scripts/collect-inventory.sh b/scripts/collect-inventory.sh index ea8b7db..e9b5d61 100755 --- a/scripts/collect-inventory.sh +++ b/scripts/collect-inventory.sh @@ -105,7 +105,7 @@ for go_mod in ~/go/src/*/go.mod ~/.config/*/go.mod /tmp/*/go.mod; do dir=$(dirname "$go_mod") if command -v go &> /dev/null; then while IFS= read -r line; do - if [[ "$line" =~ ^require\ ]]; then + if [[ "$line" =~ ^require[[:space:]] ]]; then continue fi if [ -z "$line" ] || [[ "$line" == ")" ]] || [[ "$line" =~ ^\/\/ ]]; then