code: func (fs *FSLocalKeyStore) AddKnownHostKeys(hostname string, hostKeys []ssh.PublicKey) error {
  	fp, err := os.OpenFile(filepath.Join(fs.KeyDir, fileNameKnownHosts), os.O_CREATE|os.O_RDWR, 0640)
  	if err != nil {
  		return trace.Wrap(err)
  	}
  	defer fp.Sync()
  	defer fp.Close()
  	// read all existing entries into a map (this removes any pre-existing dupes)
  	entries := make(map[string]int)
  	output := make([]string, 0)
  	scanner := bufio.NewScanner(fp)
  	for scanner.Scan() {
  		line := scanner.Text()
  		if _, exists := entries[line]; !exists {
  			output = append(output, line)
  			entries[line] = 1
  		}
  	}
  	// add every host key to the list of entries
  	for i := range hostKeys {
  		fs.log.Debugf("Adding known host %s with key: %v", hostname, sshutils.Fingerprint(hostKeys[i]))
  		bytes := ssh.MarshalAuthorizedKey(hostKeys[i])
  		line := strings.TrimSpace(fmt.Sprintf("%s %s", hostname, bytes))
  		if _, exists := entries[line]; !exists {
  			output = append(output, line)
  		}
  	}
  	// re-create the file:
  	_, err = fp.Seek(0, 0)
  	if err != nil {
  		return trace.Wrap(err)
  	}
  	if err = fp.Truncate(0); err != nil {
  		return trace.Wrap(err)
  	}
  	for _, line := range output {
  		fmt.Fprintf(fp, "%s\n", line)
  	}
  	return nil
  }
docs: // AddKnownHostKeys adds a new entry to 'known_hosts' file