Changed the version variable to be var#1686
Conversation
WalkthroughChanged exported Changes
Estimated code review effort🎯 2 (Simple) | ⏱️ ~10 minutes Tip 🔌 Remote MCP (Model Context Protocol) integration is now available!Pro plan users can now connect to remote MCP servers from the Integrations page. Connect with popular remote MCPs such as Notion and Linear to add more context to your reviews and chats. 📜 Recent review detailsConfiguration used: Path: .coderabbit.yaml Review profile: CHILL Plan: Pro 💡 Knowledge Base configuration:
You can enable these sources in your CodeRabbit configuration. 📒 Files selected for processing (1)
🚧 Files skipped from review as they are similar to previous changes (1)
⏰ Context from checks skipped due to timeout of 90000ms. You can increase the timeout in your CodeRabbit configuration to a maximum of 15 minutes (900000ms). (13)
✨ Finishing Touches
🧪 Generate unit tests
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. 🪧 TipsChatThere are 3 ways to chat with CodeRabbit:
SupportNeed help? Create a ticket on our support page for assistance with any issues or questions. CodeRabbit Commands (Invoked using PR/Issue comments)Type Other keywords and placeholders
Status, Documentation and Community
|
There was a problem hiding this comment.
Actionable comments posted: 0
🧹 Nitpick comments (1)
version/version.go (1)
3-6: Add explicit type, usage doc, and a nolint for globalsMinor polish to make intent explicit and avoid common lint noise (e.g., gochecknoglobals). Also document the expected ldflags usage and discourage runtime mutation.
Apply this diff:
var ( - // Version is the noobaa-operator version (semver) - Version = "5.20.0" + // Version is the noobaa-operator version (semver). + // It is intended to be overridden at build time via -ldflags -X. + // Example (module path auto-detected in release tooling): + // go build -ldflags "-X 'MODULE_PATH/version.Version=5.20.1+downstream'" + // Do not mutate at runtime. + //nolint:gochecknoglobals // Global to enable ldflags -X injection by downstream builds. + Version string = "5.20.0" )
📜 Review details
Configuration used: Path: .coderabbit.yaml
Review profile: CHILL
Plan: Pro
💡 Knowledge Base configuration:
- MCP integration is disabled by default for public repositories
- Jira integration is disabled by default for public repositories
- Linear integration is disabled by default for public repositories
You can enable these sources in your CodeRabbit configuration.
📒 Files selected for processing (1)
version/version.go(1 hunks)
⏰ Context from checks skipped due to timeout of 90000ms. You can increase the timeout in your CodeRabbit configuration to a maximum of 15 minutes (900000ms). (13)
- GitHub Check: run-admission-test
- GitHub Check: run-kms-tls-sa-test
- GitHub Check: run-kms-dev-test
- GitHub Check: run-kms-kmip-test
- GitHub Check: run-cli-tests
- GitHub Check: run-core-config-map-tests
- GitHub Check: run-hac-test
- GitHub Check: run-azure-vault-test
- GitHub Check: run-kms-tls-token-test
- GitHub Check: run-operator-tests
- GitHub Check: golangci-lint
- GitHub Check: run-kms-key-rotate-test
- GitHub Check: cnpg-deployment-test
🔇 Additional comments (2)
version/version.go (2)
3-6: LDFlags -X friendly: switching Version from const to var is correctThis achieves the PR objective: Go’s -ldflags "-X pkg.var=value" works only with package-level string variables (not constants). Keeping the same initializer preserves current behavior while allowing downstreams to inject a version at build time.
3-6: Audit complete: no breaking constant references or unintended writes detectedI ran the suggested audit script against the repo and confirmed:
- No
const … = version.Versiondeclarations (single-line or grouped) were found- No
case version.Versionlabels in anyswitchstatements- No runtime assignments to
version.Versionoutside of its own declarationModule path and ldflags example were also verified:
- Module path:
github.com/noobaa/noobaa-operator/v5- Example override:
go build -ldflags "-X 'github.com/noobaa/noobaa-operator/v5/version.Version=5.20.1+downstream'" ./...Since there are no compile-time uses of
version.Versionand no unintended writes, no further changes are required.
- Changed the version variable to be var We are doing that, so in the downstream build, we will be able to edit it at build time Signed-off-by: liranmauda <liran.mauda@gmail.com>
9d8724e to
4dd4d3a
Compare
Explain the changes
We are doing that, so in the downstream build, we will be able to edit it at build time
Summary by CodeRabbit