Skip to content

fix: Conditionally set GOFLAGS for git worktrees#1986

Merged
aknysh merged 3 commits intomainfrom
osterman/makefile-worktree-goflags
Jan 17, 2026
Merged

fix: Conditionally set GOFLAGS for git worktrees#1986
aknysh merged 3 commits intomainfrom
osterman/makefile-worktree-goflags

Conversation

@osterman
Copy link
Copy Markdown
Member

@osterman osterman commented Jan 17, 2026

what

Automatically detect git worktrees and set GOFLAGS="-buildvcs=false" to prevent build failures. In worktrees, the .git directory is in a different location (.git/worktrees/<name>), causing the VCS build metadata to fail unless explicitly disabled.

why

Developers using git worktrees were experiencing build failures or unexpected behavior. This change makes the build process worktree-aware without affecting non-worktree repositories.

references

Related to git worktree development workflow improvements.

Summary by CodeRabbit

Release Notes

  • Chores
    • Improved build system configuration for enhanced compatibility with development environments.

✏️ Tip: You can customize this high-level summary in your review settings.

Automatically detect git worktrees and set GOFLAGS="-buildvcs=false" to prevent build failures when the VCS metadata is in a different location. Non-worktree repos are unaffected.

Co-Authored-By: Claude Haiku 4.5 <noreply@anthropic.com>
@osterman osterman requested a review from a team as a code owner January 17, 2026 16:33
@coderabbitai
Copy link
Copy Markdown
Contributor

coderabbitai bot commented Jan 17, 2026

📝 Walkthrough

Walkthrough

The Makefile now detects when the build is running within a Git worktree and automatically sets the GOFLAGS environment variable with -buildvcs=false to disable VCS metadata inclusion during builds. This involves adding an IS_WORKTREE variable and a conditional export block.

Changes

Cohort / File(s) Summary
Git worktree detection
Makefile
Added Git worktree detection logic with IS_WORKTREE variable and conditional GOFLAGS export to disable build version control tracking (-buildvcs=false) when building in a worktree environment

Estimated code review effort

🎯 2 (Simple) | ⏱️ ~8 minutes

Suggested labels

patch

🚥 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 accurately describes the main change: conditionally setting GOFLAGS for git worktrees, which directly matches the Makefile modifications and PR objectives.
Docstring Coverage ✅ Passed No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check.

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

✨ Finishing touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Post copyable unit tests in a comment
  • Commit unit tests in branch osterman/makefile-worktree-goflags

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

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

@github-actions github-actions bot added the size/xs Extra small size PR label Jan 17, 2026
@mergify
Copy link
Copy Markdown

mergify bot commented Jan 17, 2026

Important

Cloud Posse Engineering Team Review Required

This pull request modifies files that require Cloud Posse's review. Please be patient, and a core maintainer will review your changes.

To expedite this process, reach out to us on Slack in the #pr-reviews channel.

@mergify mergify bot added the needs-cloudposse Needs Cloud Posse assistance label Jan 17, 2026
@github-actions
Copy link
Copy Markdown

github-actions bot commented Jan 17, 2026

Dependency Review

✅ No vulnerabilities or license issues found.

Scanned Files

None

@osterman osterman added the no-release Do not create a new release (wait for additional code changes) label Jan 17, 2026
@codecov
Copy link
Copy Markdown

codecov bot commented Jan 17, 2026

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 74.91%. Comparing base (372cae1) to head (3b4de02).
⚠️ Report is 1 commits behind head on main.

Additional details and impacted files

Impacted file tree graph

@@            Coverage Diff             @@
##             main    #1986      +/-   ##
==========================================
- Coverage   74.93%   74.91%   -0.02%     
==========================================
  Files         777      777              
  Lines       71302    71302              
==========================================
- Hits        53428    53417      -11     
- Misses      14394    14406      +12     
+ Partials     3480     3479       -1     
Flag Coverage Δ
unittests 74.91% <ø> (-0.02%) ⬇️

Flags with carried forward coverage won't be shown. Click here to find out more.
see 2 files with indirect coverage changes

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

@aknysh aknysh merged commit bd75dba into main Jan 17, 2026
56 checks passed
@aknysh aknysh deleted the osterman/makefile-worktree-goflags branch January 17, 2026 23:44
@mergify mergify bot removed the needs-cloudposse Needs Cloud Posse assistance label Jan 17, 2026
@github-actions
Copy link
Copy Markdown

These changes were released in v1.204.1-rc.2.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

no-release Do not create a new release (wait for additional code changes) size/xs Extra small size PR

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants