code: func initKeyring(path, key string) error {
  	var keys []string
  
  	if keyBytes, err := base64.StdEncoding.DecodeString(key); err != nil {
  		return fmt.Errorf("Invalid key: %s", err)
  	} else if err := memberlist.ValidateKey(keyBytes); err != nil {
  		return fmt.Errorf("Invalid key: %s", err)
  	}
  
  	// Just exit if the file already exists.
  	if _, err := os.Stat(path); err == nil {
  		return nil
  	}
  
  	keys = append(keys, key)
  	keyringBytes, err := json.Marshal(keys)
  	if err != nil {
  		return err
  	}
  
  	if err := os.MkdirAll(filepath.Dir(path), 0700); err != nil {
  		return err
  	}
  
  	fh, err := os.OpenFile(path, os.O_CREATE|os.O_WRONLY|os.O_TRUNC, 0600)
  	if err != nil {
  		return err
  	}
  	defer fh.Close()
  
  	if _, err := fh.Write(keyringBytes); err != nil {
  		os.Remove(path)
  		return err
  	}
  
  	return nil
  }
docs: // initKeyring will create a keyring file at a given path.