Files
weave-scope/common/hostname/hostname.go
Tom Wilkie 4444a405e0 Fix comment
2015-12-04 15:33:12 +01:00

16 lines
268 B
Go

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