Moves the main.go into cmd/expvarmon folder to make it go gettable to…#21
Moves the main.go into cmd/expvarmon folder to make it go gettable to…#21arsham wants to merge 1 commit intodivan:gcpausesfrom
Conversation
… be used as a library Clean ups with gofmt
|
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. |
|
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, |
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: