Skip to content

Conversation

@ainsleyclark
Copy link
Contributor

No description provided.

claude and others added 5 commits October 23, 2025 08:06
This commit replaces the goreleaser ldflags injection approach with a code
generation strategy for version information. This makes local development
easier as the version is now set via generated code rather than build-time
flags.

Changes:
- Added Code() method to scaffold.Generator interface for writing Go code
- Created version.GenerateVersionFile() to generate version.gen.go
- Created cmd/genversion tool for generating version information
- Updated version.go to read from generated constants with fallback defaults
- Modified .goreleaser.yaml to use genversion pre-build hook
- Removed ldflags for version injection from .goreleaser.yaml
- Added comprehensive tests for Code() method and version generator

The version.gen.go file now contains the version constants that are used
by the application. During local development, default values are used,
and during release builds, goreleaser calls genversion to inject proper
version information.

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude <noreply@anthropic.com>
This commit refines the version generation approach based on feedback:

Changes:
- Removed internal/version/generate.go and generate_test.go
- Moved all generation logic into cmd/genversion/main.go directly
- Converted TestFileGenerator_Code from test table to subtests pattern
- Integrated version generation into cmd/tag for pre-tag commits
- Tag command now generates version file, commits it, then creates tag
- Added gitCommitVersionFile() and gitPushCommit() helpers to tag cmd

Benefits:
- Version package now only contains one generated file (version.gen.go)
- Generation logic is centralised in the cmd package
- Tag creation flow: generate -> commit -> tag -> push (proper ordering)
- Cleaner separation of concerns

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude <noreply@anthropic.com>
…onstant only

This commit implements a cleaner version strategy based on feedback:

Changes:
- Code() method now includes the WebKit notice (removed WithoutNotice)
- Updated tests to expect notice in Code() output
- Simplified version generation to only include Version constant
- Removed Commit, Date, and BuiltBy fields entirely
- Renamed version.gen.go to version.go (single generated file)
- Updated cmd/genversion to generate simplified format
- Updated cmd/tag to generate simplified format
- Updated internal/cmd/version.go to use version.Version directly
- Updated .goreleaser.yaml to only pass version flag
- Removed unused imports (time) from cmd packages
- Deleted version_test.go (no longer needed)

The generated version.go now has this simple format:
```go
// Code generated by webkit; DO NOT EDIT.
package version

const Version = "v0.0.1-dev"
```

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude <noreply@anthropic.com>
@codecov
Copy link

codecov bot commented Oct 23, 2025

Codecov Report

❌ Patch coverage is 2.19780% with 89 lines in your changes missing coverage. Please review.
✅ Project coverage is 63.71%. Comparing base (7f6b060) to head (ae3bcab).
⚠️ Report is 12 commits behind head on main.

Files with missing lines Patch % Lines
cmd/tag/main.go 0.00% 57 Missing ⚠️
cmd/genversion/main.go 0.00% 31 Missing ⚠️
internal/cmd/version.go 0.00% 1 Missing ⚠️
Additional details and impacted files
@@            Coverage Diff             @@
##             main      #38      +/-   ##
==========================================
- Coverage   64.59%   63.71%   -0.88%     
==========================================
  Files         154      154              
  Lines        6064     6163      +99     
==========================================
+ Hits         3917     3927      +10     
- Misses       2064     2153      +89     
  Partials       83       83              

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

@ainsleyclark ainsleyclark merged commit a115659 into main Oct 23, 2025
2 of 4 checks passed
@ainsleyclark ainsleyclark deleted the claude/refactor-version-strategy-011CUPn5CYfsKbdRrLvnteWc branch October 23, 2025 10:09
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.

3 participants