code: func (kc *HostKeyChecker) addrToHostPort(a string) (string, error) {
  	if !strings.Contains(a, ":") {
  		// No port, so return unadulterated
  		return a, nil
  	}
  	host, p, err := net.SplitHostPort(a)
  	if err != nil {
  		log.Debugf("Unable to parse addr %s: %v", a, err)
  		return "", err
  	}
  
  	port, err := strconv.Atoi(p)
  	if err != nil {
  		log.Debugf("Error parsing port %s: %v", p, err)
  		return "", err
  	}
  
  	// Default port should be omitted from the entry.
  	// (see `put_host_port` in openssh/misc.c)
  	if port == 0 || port == sshDefaultPort {
  		// IPv6 addresses must be enclosed in square brackets
  		if strings.Contains(host, ":") {
  			host = fmt.Sprintf("[%s]", host)
  		}
  		return host, nil
  	}
  
  	return fmt.Sprintf("[%s]:%d", host, port), nil
  }
docs: // addrToHostPort takes the given address and parses it into a string suitable
  // for use in the 'hostnames' field in a known_hosts file.  For more details,
  // see the `SSH_KNOWN_HOSTS FILE FORMAT` section of `man 8 sshd`