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

feat: Make goose annotations case-insensitive #704

Merged
merged 4 commits into from
Mar 4, 2024

Conversation

obalunenko
Copy link
Contributor

@obalunenko obalunenko commented Feb 23, 2024

This PR does two things:

Closes #678

@obalunenko
Copy link
Contributor Author

@mfridman please take a look, when you have a chance

@obalunenko
Copy link
Contributor Author

@mfridman, Could you please run the pipeline? I fixed linter warning

@mfridman
Copy link
Collaborator

Thanks for putting this together, I'll try my best to get a review within a week.

// Allowed annotations: Up, Down, StatementBegin, StatementEnd, NO TRANSACTION, ENVSUB ON, ENVSUB OFF
func extractAnnotation(line string) (annotation, error) {
// Remove leading and trailing whitespace from line.
cmd := strings.TrimSpace(line)
Copy link
Collaborator

@mfridman mfridman Mar 1, 2024

Choose a reason for hiding this comment

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

I've been going back and forth on whether we should do this.

I.e., a goose annotation must begin with -- +goose, with no leading white space.

If we do, we'll need to update the blog (I want to move some of this "blog" content into formal docs)

https://pressly.github.io/goose/blog/2022/overview-sql-file/#quick-start

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I can remove this line and add a check if the line has a leading space and throw an appropriate error.

Copy link
Collaborator

@mfridman mfridman Mar 1, 2024

Choose a reason for hiding this comment

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

That's probably the right thing:

  1. Only allow -- +goose <annotation> without leading space
  2. Raise an error if we detect a -- +goose annotation with leading whitespace like \s+-- \+goose

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I'll add changes to cover this logic

Copy link
Contributor Author

Choose a reason for hiding this comment

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

@mfridman I refactored PR to allow annotations only without leading whitespace

Copy link
Collaborator

@mfridman mfridman left a comment

Choose a reason for hiding this comment

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

lgtm. 🎉

@obalunenko
Copy link
Contributor Author

@mfridman Thank you for your review!
Unfortunately, I don't have write access to this repository to merge my PR

@mfridman mfridman merged commit 48100ea into pressly:master Mar 4, 2024
10 checks passed
@obalunenko obalunenko deleted the develop/gh-678 branch March 4, 2024 14:36
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.

Make goose annotations case-insensitive
2 participants