Skip to content

Move amtool to modular structure#1321

Merged
stuartnelson3 merged 4 commits intomasterfrom
stn/modularize-amtool
Apr 13, 2018
Merged

Move amtool to modular structure#1321
stuartnelson3 merged 4 commits intomasterfrom
stn/modularize-amtool

Conversation

@stuartnelson3
Copy link
Contributor

implements #1297

Signed-off-by: Stuart Nelson <stuartnelson3@gmail.com>
@stuartnelson3 stuartnelson3 force-pushed the stn/modularize-amtool branch from b92f7f0 to a485015 Compare April 11, 2018 13:50
cli/alert.go Outdated
var (
a = &alertQueryCmd{}
alertCmd = app.Command("alert", "View and search through current alerts")
alertQueryCmd = alertCmd.Command("query", "View and search through current alerts").Default()
Copy link
Member

Choose a reason for hiding this comment

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

I find it a bit confusing to have both alertQueryCmd as a local variable here and as a global struct.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

ah didn't even notice, yes that is confusing

@@ -0,0 +1,57 @@
package cli
Copy link
Member

Choose a reason for hiding this comment

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

I've already noticed that most of the files in the cli package are missing the Apache 2 license header. This shouldn't be addressed in this PR but rather tackled once prometheus/prometheus#3904 is fixed.

Signed-off-by: Stuart Nelson <stuartnelson3@gmail.com>
A local variable within the alert subcommand was
using the name of the struct within that file.

Signed-off-by: Stuart Nelson <stuartnelson3@gmail.com>
@stuartnelson3 stuartnelson3 force-pushed the stn/modularize-amtool branch from 8f4e0fd to 0b40787 Compare April 11, 2018 16:24
@stuartnelson3
Copy link
Contributor Author

@simonpasquier any more comments/fixes?

Copy link
Member

@simonpasquier simonpasquier left a comment

Choose a reason for hiding this comment

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

one last nit...

func configureCheckConfigCmd(app *kingpin.Application, longHelpText map[string]string) {
var (
c = &checkConfigCmd{}
checkConfigCmd = app.Command("check-config", "Validate alertmanager config files")
Copy link
Member

Choose a reason for hiding this comment

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

Same confusing names with the struct declared at L12.

Signed-off-by: Stuart Nelson <stuartnelson3@gmail.com>
@stuartnelson3 stuartnelson3 force-pushed the stn/modularize-amtool branch from fc7e8a5 to 01e7258 Compare April 13, 2018 08:16
@simonpasquier
Copy link
Member

👍

@stuartnelson3 stuartnelson3 merged commit e7bc6e2 into master Apr 13, 2018
@stuartnelson3 stuartnelson3 deleted the stn/modularize-amtool branch April 13, 2018 11:34
mxinden pushed a commit to mxinden/alertmanager that referenced this pull request May 5, 2018
* Move amtool to modular structure

Signed-off-by: Stuart Nelson <stuartnelson3@gmail.com>

* Move toplevel setup back into root.go

Signed-off-by: Stuart Nelson <stuartnelson3@gmail.com>

* Remove confusing alert struct name overwriting

A local variable within the alert subcommand was
using the name of the struct within that file.

Signed-off-by: Stuart Nelson <stuartnelson3@gmail.com>

* change local var name shadowing struct name

Signed-off-by: Stuart Nelson <stuartnelson3@gmail.com>
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