code: func (a *Agent) writeTagsFile(tags map[string]string) error {
  	encoded, err := json.MarshalIndent(tags, "", "  ")
  	if err != nil {
  		return fmt.Errorf("Failed to encode tags: %s", err)
  	}
  
  	// Use 0600 for permissions, in case tag data is sensitive
  	if err = ioutil.WriteFile(a.agentConf.TagsFile, encoded, 0600); err != nil {
  		return fmt.Errorf("Failed to write tags file: %s", err)
  	}
  
  	// Success!
  	return nil
  }
docs: // writeTagsFile will write the current tags to the configured tags file.