How do you find the FQDN of the local host in GO (golang)? -
how find fqdn of local host in go (golang)?
btw: net.lookupaddr() doesn't work on windows. that's not option.
by default there no short way.
os.hostname() doesn't provide qualified domain name default.
cmd := exec.command("/bin/hostname", "-f") var out bytes.buffer cmd.stdout = &out err := cmd.run() if err != nil { log.errorf(err) } fqdn := out.string() fqdn = fqdn[:len(fqdn)-1] // removing eol
Excellent Blog, I like your blog and It is very informative. Thank you
ReplyDeleteLearn ReactJs Online
Automation Anywhere Online Course