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) <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01GVbEgdgcC1w6qwSq3zC4kg
This commit is contained in:
@@ -1,12 +1,10 @@
|
|||||||
package main
|
package main
|
||||||
|
|
||||||
import (
|
import (
|
||||||
"encoding/json"
|
|
||||||
"flag"
|
"flag"
|
||||||
"fmt"
|
"fmt"
|
||||||
"log"
|
"log"
|
||||||
"os"
|
"os"
|
||||||
"path/filepath"
|
|
||||||
|
|
||||||
"github.com/user/package-review/internal/inventory"
|
"github.com/user/package-review/internal/inventory"
|
||||||
"github.com/user/package-review/internal/report"
|
"github.com/user/package-review/internal/report"
|
||||||
|
|||||||
@@ -3,7 +3,6 @@ package security
|
|||||||
import (
|
import (
|
||||||
"encoding/json"
|
"encoding/json"
|
||||||
"fmt"
|
"fmt"
|
||||||
"os"
|
|
||||||
"os/exec"
|
"os/exec"
|
||||||
"strings"
|
"strings"
|
||||||
)
|
)
|
||||||
|
|||||||
@@ -72,7 +72,7 @@ func TestQueryOSVWithMockedServer(t *testing.T) {
|
|||||||
// Note: In actual implementation, we'd need to inject the base URL
|
// Note: In actual implementation, we'd need to inject the base URL
|
||||||
// For now, this test validates the response parsing logic
|
// For now, this test validates the response parsing logic
|
||||||
t.Run("parse_valid_response", func(t *testing.T) {
|
t.Run("parse_valid_response", func(t *testing.T) {
|
||||||
pkg := inventory.Package{
|
_ = inventory.Package{
|
||||||
Name: "requests",
|
Name: "requests",
|
||||||
Version: "2.28.0",
|
Version: "2.28.0",
|
||||||
Source: "pip",
|
Source: "pip",
|
||||||
|
|||||||
@@ -105,7 +105,7 @@ for go_mod in ~/go/src/*/go.mod ~/.config/*/go.mod /tmp/*/go.mod; do
|
|||||||
dir=$(dirname "$go_mod")
|
dir=$(dirname "$go_mod")
|
||||||
if command -v go &> /dev/null; then
|
if command -v go &> /dev/null; then
|
||||||
while IFS= read -r line; do
|
while IFS= read -r line; do
|
||||||
if [[ "$line" =~ ^require\ ]]; then
|
if [[ "$line" =~ ^require[[:space:]] ]]; then
|
||||||
continue
|
continue
|
||||||
fi
|
fi
|
||||||
if [ -z "$line" ] || [[ "$line" == ")" ]] || [[ "$line" =~ ^\/\/ ]]; then
|
if [ -z "$line" ] || [[ "$line" == ")" ]] || [[ "$line" =~ ^\/\/ ]]; then
|
||||||
|
|||||||
Reference in New Issue
Block a user