Skip to content

fix(setup): install and check compatible Go version for TinyGo - #89

Merged
fum4 merged 2 commits into
masterfrom
fix/setup-go-version-check
Mar 20, 2026
Merged

fum4 merged 2 commits into
masterfrom
fix/setup-go-version-check

Conversation

@LunatiqueCoder

@LunatiqueCoder LunatiqueCoder commented Mar 19, 2026 •

Copy link
Copy Markdown
Collaborator

Summary

TinyGo (used to build the logger WASM/CGo targets) requires Go ≤ 1.25. Without this, a fresh setup on a machine with Go 1.26+ fails with:

requires go version 1.19 through 1.25, got go1.26
  • Install [email protected] when go is missing — changed the Homebrew formula from go (resolves to latest, currently 1.26) to [email protected]
  • Link after install — [email protected] is a keg-only formula so Homebrew does not auto-link it; without the brew link step, go would still not be in PATH after installation and the build would fail immediately after
  • Version check with warning — after all deps are resolved, checks the active go version and warns with actionable instructions if > 1.25 (covers the case where go was already installed at an incompatible version)
  • Guard against empty version parse — with set -eu at the top of the script, an empty GO_MAJOR/GO_MINOR from a broken go shim would abort the script mid-run; now guarded with a non-empty check before the comparison

Test plan

  • Machine with no Go: run pnpm setup, select go — [email protected] installs and links, build succeeds
  • Machine with Go 1.26: run pnpm setup — warning appears suggesting downgrade or mise
  • Machine with Go ≤ 1.25: run pnpm setup — no warning, build succeeds

🤖 Generated with Claude Code

Summary by CodeRabbit

  • Chores
    • Ensure Go 1.25 is installed and properly linked during setup.
    • Added a Go version check that warns if a newer Go is detected and advises downgrading or using an alternative tool.
    • Clear shell command-location cache after installing dependencies and report success/warnings when linking Go, suppressing nonessential errors.

TinyGo requires Go ≤ 1.25. Without this, the logger WASM/CGo build
fails with a "requires go version 1.19 through 1.25" error.

- Install [email protected] instead of latest go when go is missing
- Link [email protected] after install (keg-only formulae are not auto-linked,
  so without this `go` would still not be in PATH post-install)
- After all deps are installed, check the active Go version and warn
  with actionable instructions if it is > 1.25
- Guard the version comparison against empty strings to prevent
  set -eu from aborting the script if `go version` produces no output

Co-Authored-By: Claude Sonnet 4.6 <[email protected]>
@vercel

vercel Bot commented Mar 19, 2026 •

Copy link
Copy Markdown

The latest updates on your projects. Learn more about Vercel for GitHub.

1 Skipped Deployment
Project Deployment Actions Updated (UTC)
openkit Ignored Ignored Preview Mar 20, 2026 11:00am

@coderabbitai

coderabbitai Bot commented Mar 19, 2026 •

Copy link
Copy Markdown

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: defaults

Review profile: CHILL

Plan: Pro

Run ID: 3216b85b-846d-42c0-951d-963480c5cde6

📥 Commits

Reviewing files that changed from the base of the PR and between dcd1a2b and 31ecb50.

📒 Files selected for processing (1)
  • scripts/setup.sh
✅ Files skipped from review due to trivial changes (1)
  • scripts/setup.sh

📝 Walkthrough

Walkthrough

The setup script maps Homebrew's go dependency to [email protected], force-links [email protected] after installation, clears the shell command cache, and adds a Go version check that warns if the installed Go exceeds 1.25 with downgrade guidance.

Changes

Cohort / File(s) Summary
Go Version Enforcement
scripts/setup.sh
Changed Homebrew mapping from go to [email protected]; added hash -r cache clear and brew link [email protected] --force after installs (errors suppressed); added a Go version check that warns if go version reports >1.25 with downgrade/alternative guidance.

Estimated code review effort

🎯 2 (Simple) | ⏱️ ~10 minutes

Poem

🐰 I hopped into setup, found Go on the line,
I nudged it to [email protected], snug and fine,
I cleared the tracks and forced the link true,
I peeked at the version and warned what to do,
A tiny hop, a tidy fix — ready for you! 🥕

🚥 Pre-merge checks | ✅ 3
✅ Passed checks (3 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The title 'fix(setup): install and check compatible Go version for TinyGo' directly summarizes the main changes: installing Go 1.25 and checking for version compatibility with TinyGo requirements.
Docstring Coverage ✅ Passed Docstring coverage is 100.00% which is sufficient. The required threshold is 80.00%.

✏️ Tip: You can configure your own custom pre-merge checks in the settings.

✨ Finishing Touches
📝 Generate docstrings
  • Create stacked PR
  • Commit on current branch
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch fix/setup-go-version-check
📝 Coding Plan
  • Generate coding plan for human review comments

Comment @coderabbitai help to get the list of available commands and usage tips.

@github-actions

github-actions Bot commented Mar 19, 2026 •

Copy link
Copy Markdown
Contributor

Claude Review

🟢 Resolved

  1. Silent failure on brew link now surfaces a warning — scripts/setup.sh:199-202 — The brew link call now uses the || warn pattern suggested in the previous review, giving the user actionable guidance when linking fails.

  2. Go version check doesn't fire after fresh install — scripts/setup.sh:193 — hash -r is now called after install to clear the shell's command cache, and the version check has been moved outside the install block so it runs unconditionally via has_cmd go. Combined with the brew link fix, this addresses the PATH issue.

  3. Version-pinned formula will need maintenance — scripts/setup.sh:116 — A comment now documents the TinyGo compatibility constraint directly on the pinned formula line.

🟡 Minor

  1. The > 1.25 check may warn prematurely for Go 2.x — scripts/setup.sh:218
    The condition GO_MAJOR -gt 1 will warn for any Go 2+. Worth a brief comment noting this is intentional until TinyGo confirms Go 2 support, so a future maintainer doesn't wonder whether it's a bug.

  2. GO_VERSION extraction grabs only major.minor — scripts/setup.sh:214
    grep -oE '[0-9]+\.[0-9]+' picks up the first X.Y match. This works but could theoretically match a version fragment from a build tag. Very unlikely in practice — just noting for awareness, no change needed.

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🧹 Nitpick comments (1)
scripts/setup.sh (1)

191-198: Silent failure when linking fails could confuse users.

If brew link [email protected] --force fails (e.g., due to conflicts with an existing Go installation), the error is suppressed and no feedback is given. Users may not realize that go still points to an incompatible version.

Consider providing feedback on link failure so users know to manually resolve conflicts.

🔧 Proposed fix to handle link failure
     # [email protected] is keg-only (not linked by default) — link it so `go` is in PATH
     for formula in "${to_install[@]}"; do
       if [ "$formula" = "[email protected]" ]; then
-        brew link [email protected] --force 2>/dev/null && success "[email protected] linked as the active Go version."
+        if brew link [email protected] --force 2>/dev/null; then
+          success "[email protected] linked as the active Go version."
+        else
+          warn "Could not link [email protected] — you may need to unlink another Go version first (brew unlink go)."
+        fi
         break
       fi
     done
🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.

In `@scripts/setup.sh` around lines 191 - 198, The linking step in the for loop
that runs `brew link [email protected] --force` currently swallows errors (2>/dev/null)
and only prints success on success; update the block around the `brew link`
invocation to check its exit status and on failure call the existing `error` (or
`fail`) helper and print a clear message instructing the user to resolve
conflicts or unlink other Go versions (e.g., run `brew unlink` or inspect `brew
doctor`), referencing the for loop and the `brew link [email protected] --force` command
and the `success` helper so you add a failure branch that reports the error
instead of remaining silent.
🤖 Prompt for all review comments with AI agents
Verify each finding against the current code and only fix it if needed.

Nitpick comments:
In `@scripts/setup.sh`:
- Around line 191-198: The linking step in the for loop that runs `brew link
[email protected] --force` currently swallows errors (2>/dev/null) and only prints success
on success; update the block around the `brew link` invocation to check its exit
status and on failure call the existing `error` (or `fail`) helper and print a
clear message instructing the user to resolve conflicts or unlink other Go
versions (e.g., run `brew unlink` or inspect `brew doctor`), referencing the for
loop and the `brew link [email protected] --force` command and the `success` helper so you
add a failure branch that reports the error instead of remaining silent.

ℹ️ Review info
⚙️ Run configuration

Configuration used: defaults

Review profile: CHILL

Plan: Pro

Run ID: c4f1b71b-c65a-474c-aa1d-8e87c2bd7101

📥 Commits

Reviewing files that changed from the base of the PR and between 2173af1 and dcd1a2b.

📒 Files selected for processing (1)
  • scripts/setup.sh

@fum4
fum4 merged commit 36d7aae into master Mar 20, 2026
22 checks passed
@fum4
fum4 deleted the fix/setup-go-version-check branch March 20, 2026 11:11
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants