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

Moves the main.go into cmd/expvarmon folder to make it go gettable to… #21

Open
wants to merge 1 commit into
base: gcpauses
Choose a base branch
from

Conversation

arsham
Copy link

@arsham arsham commented Dec 8, 2016

Moves the main.go into cmd/expvarmon. This way people can install different versions of executables and use expvarmon as a library. It also fixed undefined DefaultEndpoint when I tried to run the main. Also I would create another cmd/expvardummon (or any other names you like) to separate the dummy prints with the normal ones.

Please note that I passed the interval to constructors for the following reasons:

  • It is a configuration value
  • Once it is set, it is not supposed to be changed, hence unexported variable.

@divan
Copy link
Owner

divan commented Dec 8, 2016

Hey @arsham. Thanks, I will review it in details next week, but can you please elaborate on the reasons of moving to cmd/ folder? I'm totally aware of this practice, but so far expvarmon is not supposed to be used as a library. Can you show any examples how it can be useful? And also I didn't quite get how it can help to install different versions of executables. Thanks in advance.

@arsham
Copy link
Author

arsham commented Dec 8, 2016

No problem.

Well, you spoiled the surprise mate! I am planninng to add a few Writers to the mix and have this library to be used for streaming the data to ElasticSearch/influxdb. I'm sure people will come up with other nice usages if this was a library.

On the other hand (the other question), you could have another binary called expvarmon-es and bootstrap it with additional elasticsearch location setting. If you do that with your current setup, the main function will get poluted by many if statements.

In my opinion (I might be wrong), a main.go file should be used for reading the input and bootstrap an application, nothing more. @ardan-bkennedy I would appreciate your input on this.

We can further this conversation if more clarification is needed.

Cheers,
Arsham

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