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 


Comments

Post a Comment

Popular posts from this blog

resizing Telegram inline keyboard -

command line - How can a Python program background itself? -

php - "cURL error 28: Resolving timed out" on Wordpress on Azure App Service on Linux -