Skip to content
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

gowrap fault injection #7056

Merged
merged 2 commits into from
Jan 14, 2025
Merged

gowrap fault injection #7056

merged 2 commits into from
Jan 14, 2025

Conversation

stephanos
Copy link
Contributor

@stephanos stephanos commented Jan 7, 2025

What changed?

Use gowrap for generating fault injection code. Similar to #7050.

Why?

Less code to maintain.

Before: 238 LOC.

After: 34 line Go Template.

How did you test it?

Existing tests + eyeballing the output.

Potential risks

Documentation

Is hotfix candidate?

@printf $(COLOR) "Process go:generate directives..."
@go generate ./...
$(MAKE) copyright
Copy link
Contributor Author

@stephanos stephanos Jan 7, 2025

Choose a reason for hiding this comment

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

Without this addition, the generated code has no copyright header. Fortunately, this step is idempotent (and fast).

Copy link
Contributor

Choose a reason for hiding this comment

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

thoughts:

  1. should we copyright generated code?
  2. If we do - should we add it to the template? Otherwise it will still be "Uber 2020"
  3. I remember we have this discussion about "do we even need copyright at every file"? Where does it go?

Copy link
Contributor Author

@stephanos stephanos Jan 10, 2025

Choose a reason for hiding this comment

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

All good questions.

(1) The other generated code does, so I followed that here. (not a lawyer)
(2) Same as for (1)
(3) I'm told @alexshtin wants to follow up internally on that question.

Copy link
Member

Choose a reason for hiding this comment

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

I am on it. Let this line be there for now.

@@ -95,31 +94,3 @@ func inject0(f *fault, op func() error) error {
}
return f.err
}
Copy link
Contributor Author

Choose a reason for hiding this comment

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

Simpler!

@stephanos stephanos force-pushed the gen-failinject branch 6 times, most recently from 67cbcdb to ae4621b Compare January 7, 2025 23:15
@stephanos stephanos marked this pull request as ready for review January 7, 2025 23:22
@stephanos stephanos requested a review from a team as a code owner January 7, 2025 23:22
@stephanos stephanos requested a review from alexshtin January 7, 2025 23:22
@printf $(COLOR) "Process go:generate directives..."
@go generate ./...
$(MAKE) copyright
Copy link
Contributor

Choose a reason for hiding this comment

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

thoughts:

  1. should we copyright generated code?
  2. If we do - should we add it to the template? Otherwise it will still be "Uber 2020"
  3. I remember we have this discussion about "do we even need copyright at every file"? Where does it go?

Copy link
Member

@alexshtin alexshtin left a comment

Choose a reason for hiding this comment

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

I am sorry to see my baby go but this is a good change!

@stephanos stephanos merged commit 1bb6bfc into temporalio:main Jan 14, 2025
49 checks passed
@stephanos stephanos deleted the gen-failinject branch January 14, 2025 19:19
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