OLD | NEW |
1 // Copyright 2009 The Go Authors. All rights reserved. | 1 // Copyright 2009 The Go Authors. All rights reserved. |
2 // Use of this source code is governed by a BSD-style | 2 // Use of this source code is governed by a BSD-style |
3 // license that can be found in the LICENSE file. | 3 // license that can be found in the LICENSE file. |
4 | 4 |
5 // Darwin-specific | 5 // Darwin-specific |
6 | 6 |
7 package os | 7 package os |
8 | 8 |
9 import "syscall" | 9 import "syscall" |
10 | 10 |
11 func Hostname() (name string, err Error) { | 11 func Hostname() (name string, err Error) { |
12 » var errno int; | 12 » var errno int |
13 » name, errno = syscall.Sysctl("kern.hostname"); | 13 » name, errno = syscall.Sysctl("kern.hostname") |
14 if errno != 0 { | 14 if errno != 0 { |
15 return "", NewSyscallError("sysctl kern.hostname", errno) | 15 return "", NewSyscallError("sysctl kern.hostname", errno) |
16 } | 16 } |
17 » return name, nil; | 17 » return name, nil |
18 } | 18 } |
OLD | NEW |