With the line above, prometheus::NewGaugeVec. I know it's related to the Prometheus module, NewGaurgeVec subroutine.
I'm not a programmer, I'm a systems admin who job is to take requests of such "we need a vmware exporter, I have this. Make it work".
I think you'd probably have enjoyed Go more in the "old" days when $GOPATH was required and all modules were downloaded into your $GOPATH as it was more explicit were modules were and in a way it felt a little more like Perl with the file system being a more prominent part of modules. This was a very unpopular pattern for developers so things have moved on somewhat with modules now being pulled into a package directory. Personally I preferred the $GOPATH days too but it's fair to say the modules are still on disk.
> I understand all of that. Power_state, display the help, power status description etc, but prometheus.NewGaugeVec -- great. What is it? Where do I find this?
It's a function in the module `prometheus`: "github.com/prometheus/client_golang/prometheus"
It's the same thing as the following Perl code:
As you can see the code is actually really similar between the two languages in that regard. Bare in mind I'm not suggesting that the languages themselves are similar, eg how modules are created, methods written and arrays are handled are clearly different. But the concept of reusable imported modules and properties in a struct/hash are ostensibly the same.Disclaimer: I've not written much Perl in the last 3 years so I might have gotten some of the syntax slightly wrong. But it should be close enough for demo purposes.