Skip to content

High-performance browser automation bridge and multi-instance orchestrator with advanced stealth injection and real-time dashboard.

fix: require golangci-lint in local checks

Luigi Agosti87e509acbde2
diff --git a/cmd/pinchtab/cmd_cli_test.go b/cmd/pinchtab/cmd_cli_test.go
index 5c003b91..c28e7872 100644
--- a/cmd/pinchtab/cmd_cli_test.go
+++ b/cmd/pinchtab/cmd_cli_test.go
@@ -41,6 +41,7 @@ func TestMouseCommandGroupRegistered(t *testing.T) {
m := findCommand(rootCmd, "mouse")
if m == nil {
t.Fatal("expected mouse command to be registered")
+ return
}
if m.GroupID != "browser" {
t.Fatalf("expected mouse command group browser, got %q", m.GroupID)
@@ -51,6 +52,7 @@ func TestMouseSubCommandsRegistered(t *testing.T) {
m := findCommand(rootCmd, "mouse")
if m == nil {
t.Fatal("expected mouse command to be registered")
+ return
}
for _, name := range []string{"move", "down", "up", "wheel"} {
if findCommand(m, name) == nil {
@@ -75,6 +77,7 @@ func TestTabHandoffCommandsRegistered(t *testing.T) {
tabCmd := findCommand(rootCmd, "tab [id]")
if tabCmd == nil {
t.Fatal("expected tab command to be registered")
+ return
}
for _, name := range []string{"handoff [id]", "resume [id]", "handoff-status [id]"} {
if findCommand(tabCmd, name) == nil {
diff --git a/internal/autosolver/challenge_detection_test.go b/internal/autosolver/challenge_detection_test.go
index c13959d9..704f8533 100644
--- a/internal/autosolver/challenge_detection_test.go
+++ b/internal/autosolver/challenge_detection_test.go
@@ -10,6 +10,7 @@ func TestDetectChallengeIntent_Turnstile(t *testing.T) {
)
if intent == nil {
t.Fatal("expected challenge intent")
+ return
}
if intent.Type != IntentCaptcha {
t.Fatalf("expected captcha intent, got %q", intent.Type)
@@ -28,6 +29,7 @@ func TestDetectChallengeIntent_RecaptchaV2(t *testing.T) {
)
if intent == nil {
t.Fatal("expected challenge intent")
+ return
}
if intent.ChallengeType != "recaptcha-v2" {
t.Fatalf("expected recaptcha-v2 challenge type, got %q", intent.ChallengeType)
@@ -43,6 +45,7 @@ func TestDetectChallengeIntent_RecaptchaV3(t *testing.T) {
)
if intent == nil {
t.Fatal("expected challenge intent")
+ return
}
if intent.ChallengeType != "recaptcha-v3" {
t.Fatalf("expected recaptcha-v3 challenge type, got %q", intent.ChallengeType)
@@ -58,6 +61,7 @@ func TestDetectChallengeIntent_HCaptcha(t *testing.T) {
)
if intent == nil {
t.Fatal("expected challenge intent")
+ return
}
if intent.ChallengeType != "hcaptcha" {
t.Fatalf("expected hcaptcha challenge type, got %q", intent.ChallengeType)
@@ -72,6 +76,7 @@ func TestDetectChallengeIntent_CustomJS(t *testing.T) {
)
if intent == nil {
t.Fatal("expected challenge intent")
+ return
}
if intent.ChallengeType != "custom-js" {
t.Fatalf("expected custom-js challenge type, got %q", intent.ChallengeType)
diff --git a/scripts/check.sh b/scripts/check.sh
index 624eaca4..30ca8288 100755
--- a/scripts/check.sh
+++ b/scripts/check.sh
@@ -92,16 +92,18 @@ elif [ -x "/usr/local/bin/golangci-lint" ]; then
LINT_CMD="/usr/local/bin/golangci-lint"
fi
-if [ -n "$LINT_CMD" ]; then
- if ! $LINT_CMD run ./...; then
- fail "golangci-lint"
- exit 1
- fi
- ok "golangci-lint"
-else
- echo -e " ${ACCENT}·${NC} golangci-lint not installed — skipping"
+if [ -z "$LINT_CMD" ]; then
+ fail "golangci-lint" "Required locally because CI runs golangci-lint."
hint "Install: brew install golangci-lint"
+ hint "Or: go install github.com/golangci/golangci-lint/v2/cmd/golangci-lint@latest"
+ exit 1
+fi
+
+if ! $LINT_CMD run; then
+ fail "golangci-lint"
+ exit 1
fi
+ok "golangci-lint"
# ── Summary ──────────────────────────────────────────────────────────
diff --git a/scripts/pre-commit b/scripts/pre-commit
index a6e16385..daad84d1 100755
--- a/scripts/pre-commit
+++ b/scripts/pre-commit
@@ -21,7 +21,7 @@ if [ -n "$staged_go" ]; then
exit 1
fi
- # golangci-lint (if available)
+ # golangci-lint
GOLANGCI_LINT=""
if command -v golangci-lint &>/dev/null; then
GOLANGCI_LINT="golangci-lint"
@@ -31,15 +31,16 @@ if [ -n "$staged_go" ]; then
GOLANGCI_LINT="$HOME/go/bin/golangci-lint"
fi
- if [ -n "$GOLANGCI_LINT" ]; then
- dirs=$(echo "$staged_go" | xargs -n1 dirname | sort -u | sed 's|$|/...|')
- if ! $GOLANGCI_LINT run --timeout=5m $dirs; then
- echo "❌ golangci-lint: issues found"
- exit 1
- fi
- else
- echo "⚠️ golangci-lint not found, skipping Go lint"
+ if [ -z "$GOLANGCI_LINT" ]; then
+ echo "❌ golangci-lint not found"
echo " Install: go install github.com/golangci/golangci-lint/v2/cmd/golangci-lint@latest"
+ exit 1
+ fi
+
+ dirs=$(echo "$staged_go" | xargs -n1 dirname | sort -u | sed 's|$|/...|')
+ if ! $GOLANGCI_LINT run --timeout=5m $dirs; then
+ echo "❌ golangci-lint: issues found"
+ exit 1
fi
echo "✅ Go checks passed"