Thread of 2 posts

if your hostname(1) doesn't have -f (for fully qualified domain name), how do you get the fqdn?
os.Hostname() in golang would return the hostname as reported by the kernel.

package main

import (
"fmt"
"os"
)

func main() {
n, _ := os.Hostname()
fmt.Println(n)
}

-> results in: rhun

hostname -f
-> results in: rhun.klang.is

I've written a wrapper function for hostname -f, but there seems to be no go native way to get the fqdn without a lot of annoyance involved

Open thread at this post