Files
weave-scope/probe/hostname.go
2015-11-09 16:25:28 +00:00

16 lines
275 B
Go

package probe
import "os"
// Hostname returns the hostname of this host.
func Hostname() string {
if hostname := os.Getenv("SCOPE_HOSTNAME"); hostname != "" {
return hostname
}
hostname, err := os.Hostname()
if err != nil {
return "(unknown)"
}
return hostname
}