mirror of
https://github.com/weaveworks/scope.git
synced 2026-03-03 18:20:27 +00:00
16 lines
268 B
Go
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
|
|
}
|