MCPcopy Index your code
hub / github.com/coder/coder / Hostname

Function Hostname

cli/cliutil/hostname.go:19–22  ·  view source on GitHub ↗

Hostname returns the hostname of the machine, lowercased, with any trailing domain suffix stripped. It is cached after the first call. If the hostname cannot be determined, for any reason, localhost will be returned instead.

()

Source from the content-addressed store, hash-verified

17// If the hostname cannot be determined, for any reason,
18// localhost will be returned instead.
19func Hostname() string {
20 hostnameOnce.Do(func() { hostname = getHostname() })
21 return hostname
22}
23
24func getHostname() string {
25 h, err := os.Hostname()

Callers 4

ServerMethod · 0.92
NewFunction · 0.92
NewFunction · 0.92

Calls 2

getHostnameFunction · 0.85
DoMethod · 0.65

Tested by

no test coverage detected