Documentation
¶
Overview ¶
Package host provides information about the host.
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func PodName ¶ added in v0.12.0
func PodName() string
PodName returns the name of the pod this process runs in: POD_NAME, which the Kubernetes downward API sets, else the host name, which is the pod name in Kubernetes. It returns "" only when both are unknown.
func TimeZoneName ¶ added in v0.12.0
func TimeZoneName() string
TimeZoneName returns the IANA name of the host's local time zone, such as "Asia/Shanghai", or an empty string when the real name cannot be determined. An empty name means "unknown": callers comparing two hosts must treat it as a mismatch rather than as agreement. The answer is resolved once and reused.
There is no portable way to ask for this. The Go runtime resolves the local zone but never exposes its name — time.Local.String() reports the literal "Local" whenever TZ is unset, which is the normal state inside a container, so two hosts in different zones would look identical. Each platform therefore resolves the name the same way its own runtime resolves the zone: see localZoneName in timezone_unix.go and timezone_windows.go.
Types ¶
This section is empty.