code: func writeFile(filePath string, data []byte) error {
  	f, err := os.OpenFile(filePath, os.O_RDWR|os.O_CREATE|os.O_TRUNC, 0600)
  	if err != nil {
  		return fmt.Errorf("opening %s: %s", filePath, err)
  	}
  	// NOTE: We don't defer f.Close here, because it may return an error.
  
  	_, writeErr := f.Write(data)
  	closeErr := f.Close()
  	if writeErr != nil {
  		return fmt.Errorf("writing %s: %s", filePath, writeErr)
  	} else if closeErr != nil {
  		return fmt.Errorf("closing %s: %s", filePath, closeErr)
  	}
  	return nil
  }
docs: // writeFile writes data to filePath. File permission is set to user only.