Hostname: Difference between revisions

→‎{{header|Go}}: instead of ignoring errors, just simplify by switching from Printf to Println and dump both the result and any error.
(new Pari/GP)
(→‎{{header|Go}}: instead of ignoring errors, just simplify by switching from Printf to Println and dump both the result and any error.)
Line 186:
 
=={{header|Go}}==
Use [https://golang.org/pkg/os/#Hostname <code>os.Hostname</code>].
<lang go>package main
 
Line 194 ⟶ 195:
 
func main() {
host, _ := fmt.Println(os.Hostname())
fmt.Printf("hostname: %s\n", host)
}</lang>
 
Anonymous user