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
fmt: format load strings in tests #282
base: main
Are you sure you want to change the base?
fmt: format load strings in tests #282
Conversation
c1f52bb
to
ba092b5
Compare
Signed-off-by: Michael Hoffmann <mhoffm@posteo.de>
ba092b5
to
daeac04
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Nice!
We should probably hook this into our CI as well, by adding it to format
target.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Maybe we can just put this in scripts
dir?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
can do!
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Maybe making this into its own module, so that it is separately installable might be better, in case we want to upstream it for use in prometheus/prometheus at some point? 🙂
return true | ||
} | ||
cont := s.Value[1 : len(s.Value)-1] | ||
if !strings.HasPrefix(cont, "load") { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think there are other directives as well like clear
and eval
: https://github.com/prometheus/prometheus/blob/main/promql/test.go#L252
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
i was intending it only to format our tests for now; to do it properly we would need to be able to parse those load directives.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Maybe we can to run this during CI and error out if there are any changes after running this tool?
Running it in the CI seems like a good idea 👍 |
Adds a small tool so we can auto-format indentation for load statements.