package main import ( "fmt" "os" "syscall" ) // GetFullHostname returns the hostname + domain name (if set). func getFullHostname() (string, error) { host, err := os.Hostname() if err != nil { return "", fmt.Errorf("failed to get hostname: %w", err) } domain, err := getDomainName() if err != nil || domain == "" { return host, nil // fallback to short hostname } return fmt.Sprintf("%s.%s", host, domain), nil }