33 lines
817 B
Go
33 lines
817 B
Go
|
|
package httpclient
|
||
|
|
|
||
|
|
import (
|
||
|
|
"runtime/debug"
|
||
|
|
|
||
|
|
"code.nochebuena.dev/einherjar/contracts/observability"
|
||
|
|
)
|
||
|
|
|
||
|
|
// Module identifies this package to observability systems.
|
||
|
|
// httpclient is a stateless provider — it is not registered with the launcher as a
|
||
|
|
// lifecycle component. Register Module manually with any version registry if needed.
|
||
|
|
var Module observability.Identifiable = &moduleID{}
|
||
|
|
|
||
|
|
type moduleID struct{}
|
||
|
|
|
||
|
|
const modulePath = "code.nochebuena.dev/einherjar/httpclient"
|
||
|
|
|
||
|
|
func (m *moduleID) ModulePath() string { return modulePath }
|
||
|
|
|
||
|
|
func (m *moduleID) ModuleVersion() string {
|
||
|
|
if info, ok := debug.ReadBuildInfo(); ok {
|
||
|
|
for _, dep := range info.Deps {
|
||
|
|
if dep.Path == modulePath {
|
||
|
|
return dep.Version
|
||
|
|
}
|
||
|
|
}
|
||
|
|
if info.Main.Path == modulePath {
|
||
|
|
return info.Main.Version
|
||
|
|
}
|
||
|
|
}
|
||
|
|
return "(devel)"
|
||
|
|
}
|