(opts Options)
| 60 | } |
| 61 | |
| 62 | func (e *Encoder) encodeOptions(opts Options) error { |
| 63 | for _, o := range opts { |
| 64 | var value string |
| 65 | if strings.ContainsAny(o.Value, "#;\"\t\n\\") || strings.HasPrefix(o.Value, " ") || strings.HasSuffix(o.Value, " ") { |
| 66 | value = `"`+valueReplacer.Replace(o.Value)+`"` |
| 67 | } else { |
| 68 | value = o.Value |
| 69 | } |
| 70 | |
| 71 | if err := e.printf("\t%s = %s\n", o.Key, value); err != nil { |
| 72 | return err |
| 73 | } |
| 74 | } |
| 75 | |
| 76 | return nil |
| 77 | } |
| 78 | |
| 79 | func (e *Encoder) printf(msg string, args ...interface{}) error { |
| 80 | _, err := fmt.Fprintf(e.w, msg, args...) |
no test coverage detected