indexserver: add debug subcommand #288
Merged
+318
−158
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
This adds a subcommand "debug" to indexserver.
The new subcommand contains all debug commands that were previously
handled as flags. This means that this PR changes the API of indexserver
but only for the debug commands. There is no change in how we start indexserver.
The debug commands now live in a separate file "debug.go" and don't polute the
defintion of the server anymore. I used the vistor pattern as described
here peterbourgon/ff#76 to reuse the root flags for some of the debug commands.
Other changes:
How to review:
The diff is actually more readable than it appears at first glance. I
recommend to start at the bottom of main.go. Most of the changes in
main.go come from deleting things related to debug commands and
changing the parameters from pointers to values.
Test Plan:
this PR.
production instance and tried out all debug commands.