I'm pasting the method I'm having trouble with below. Thank you for any insight.
// Writes key value pairs to a tag file.
func (tf *TagFile) Create() {
// Create directory if needed.
basepath := path.Dir(tf.Filepath)
filename := path.Base(tf.Filepath)
if os.MkdirAll(basepath, 0666) != nil {
panic("Unable to create directory for tagfile!")
}
// Create the tagfile.
fileOut, err := os.Create(strings.Join([]string{basepath, filename}, "/"))
if err != nil {
panic("Unable to create tag file!")
}
defer fileOut.Close()
// Write fields and data to the file.
for key, data := range tf.Data {
_, err := io.WriteString(fileOut, fmt.Sprintln(formatField(key, data)))
if err != nil {
panic("Unable to write data to tagfile.")
}
}
}
--
You received this message because you are subscribed to the Google Groups "golang-nuts" group.
To unsubscribe from this group and stop receiving emails from it, send an email to golang-nuts+unsubscribe@googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.