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

Add initial boilerplate #1

Merged
merged 7 commits into from
Feb 21, 2022

Conversation

saswatamcode
Copy link
Member

This PR adds the initial boilerplate for obsctl.

  • Adds initial go module for CLI (using kingpin)
  • Adds Makefile and bingo for tools and build
  • Adds GitHub Actions for CI

Signed-off-by: Saswata Mukherjee <saswataminsta@yahoo.com>
Makefile Show resolved Hide resolved
Makefile Show resolved Hide resolved
Makefile Outdated Show resolved Hide resolved
go.mod Outdated Show resolved Hide resolved
main.go Outdated Show resolved Hide resolved
main.go Outdated Show resolved Hide resolved
Signed-off-by: Saswata Mukherjee <saswataminsta@yahoo.com>
Copy link
Contributor

@matej-g matej-g left a comment

Choose a reason for hiding this comment

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

Looking nice 🌹 Not much to add, minus @onprem's comments

.golangci.yml Outdated Show resolved Hide resolved
.golangci.yml Show resolved Hide resolved
Signed-off-by: Saswata Mukherjee <saswataminsta@yahoo.com>
Signed-off-by: Saswata Mukherjee <saswataminsta@yahoo.com>
Signed-off-by: Saswata Mukherjee <saswataminsta@yahoo.com>
@@ -0,0 +1,19 @@
package cmd
Copy link
Contributor

Choose a reason for hiding this comment

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

What do you think about grouping all *_metrics.go under this single file, for easier access and readability? Do we need one subcommand per file?

Alternative: Put all in a cmd/metrics/* sub-directory

Copy link
Member Author

Choose a reason for hiding this comment

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

There might be subcommands of subcommands too. So I just put each logical top-level separate command in a separate file here. 🙂

Copy link
Contributor

Choose a reason for hiding this comment

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

Hm then how about the other suggestion with sub-directories? That way we could nicely represent the relationship between parent-children commands.

Copy link
Member Author

Choose a reason for hiding this comment

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

I looked into this a bit more, about how cobra-based CLIs are organized on other projects (e,g kubectl/skaffold). Let's actually go with the single metrics.go file approach for now! Creating subdirs would require new packages for each top-level command and make sharing stuff like logger much harder.

And instead of having each command as a global variable with init functions to add flags (as suggested by cobra), it'd be better to add functions for each new command and use that (like in other projects). Makes it much more organized! 🙂

Copy link
Contributor

Choose a reason for hiding this comment

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

Sounds good, thanks for addressing this!

pkg/cmd/root.go Outdated Show resolved Hide resolved
Signed-off-by: Saswata Mukherjee <saswataminsta@yahoo.com>
@saswatamcode
Copy link
Member Author

Have added all the initial commands that we plan for now! Likely this will change a lot once we actually implement the functionality. 🙂

Signed-off-by: Saswata Mukherjee <saswataminsta@yahoo.com>
Comment on lines +20 to +21
var logLevel, logFormat string
var logger log.Logger
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 not too keen on having global variables, I think we can create wrappers around the Run functions and pass loggers in there.

Copy link
Member

@onprem onprem left a comment

Choose a reason for hiding this comment

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

Just had a small non-blocking comment, but we can tackle that in future PRs. LGTM!

@onprem onprem merged commit 2124ecd into observatorium:main Feb 21, 2022
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.

4 participants