Skip to content

Refactor: Move constants.go to dedicated constants package #6713

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 4 commits into from
Mar 24, 2025

Conversation

timl3136
Copy link
Member

@timl3136 timl3136 commented Mar 6, 2025

What changed?
Move common/constants.go -> common/constants/constants.go and refractor relevant code
We also changed some .tmpl files in responding to this change.

Why?
Currently. constants.go does not refer to any additional package since it only contains constant. Therefore, we should move it to it's dedicated package so that we won't be restricted due to dependency cycle.
It also makes imports more semantically clear with constants.SomeConstant vs common.SomeConstant

How did you test it?
Unit tests, it's only refractoring

Potential risks
only code referring to constants.go is changed, any incompatible part will be caught by unit tests.

Release notes

Documentation Changes

Move common/constants.go -> common/constants/constants.go
@@ -772,11 +773,11 @@ func createVisibilityMessage(
executionTimeUnixNano int64,
taskID int64,
memo []byte,
encoding common.EncodingType,
encoding constants.EncodingType,
Copy link
Member

Choose a reason for hiding this comment

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

No action: comment only:

I think its not great we have a type in that file, but I also understand we need it declared there in order to have constants use it, so

@davidporter-id-au
Copy link
Member

ping me if you need a stamp once the conflicts are resolved, PRs like this are hard to merge unless you get a fast approval

@timl3136 timl3136 merged commit 6d4ff3b into cadence-workflow:master Mar 24, 2025
22 checks passed
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