mirror of
https://github.com/golang/go
synced 2024-11-19 16:44:43 -07:00
fc9c69a693
It's apparent from the file names or build tags to which OS the code in question applies. Change-Id: I628ee2bf1d29a6bc30ca5fa6f9eecf809e78a182 Reviewed-on: https://go-review.googlesource.com/110815 Run-TryBot: Tobias Klauser <tobias.klauser@gmail.com> TryBot-Result: Gobot Gobot <gobot@golang.org> Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
18 lines
432 B
Go
18 lines
432 B
Go
// Copyright 2009 The Go Authors. All rights reserved.
|
|
// Use of this source code is governed by a BSD-style
|
|
// license that can be found in the LICENSE file.
|
|
|
|
// +build darwin dragonfly freebsd nacl netbsd openbsd
|
|
|
|
package os
|
|
|
|
import "syscall"
|
|
|
|
func hostname() (name string, err error) {
|
|
name, err = syscall.Sysctl("kern.hostname")
|
|
if err != nil {
|
|
return "", NewSyscallError("sysctl kern.hostname", err)
|
|
}
|
|
return name, nil
|
|
}
|