diff options
author | ferhat elmas <elmas.ferhat@gmail.com> | 2017-11-29 02:24:31 +0100 |
---|---|---|
committer | ferhat elmas <elmas.ferhat@gmail.com> | 2017-11-29 13:01:32 +0100 |
commit | 18e6f9daa3899318d36b525b068837f49bc2c1cf (patch) | |
tree | a797b79d0a750972ba9809eb52691cb09f9b6383 /plumbing/format/config | |
parent | c07c778ed043429427533e2fd7549a3d54b903f1 (diff) | |
download | go-git-18e6f9daa3899318d36b525b068837f49bc2c1cf.tar.gz |
all: simplification
- no length for map initialization
- don't check for boolean/error return
- don't format string
- use string method of bytes buffer instead of converting bytes to
string
- use `strings.Contains` instead of `strings.Index`
- use `bytes.Equal` instead of `bytes.Compare`
Diffstat (limited to 'plumbing/format/config')
-rw-r--r-- | plumbing/format/config/encoder.go | 8 |
1 files changed, 2 insertions, 6 deletions
diff --git a/plumbing/format/config/encoder.go b/plumbing/format/config/encoder.go index 6d17a5a..4eac896 100644 --- a/plumbing/format/config/encoder.go +++ b/plumbing/format/config/encoder.go @@ -53,17 +53,13 @@ func (e *Encoder) encodeSubsection(sectionName string, s *Subsection) error { return err } - if err := e.encodeOptions(s.Options); err != nil { - return err - } - - return nil + return e.encodeOptions(s.Options) } func (e *Encoder) encodeOptions(opts Options) error { for _, o := range opts { pattern := "\t%s = %s\n" - if strings.Index(o.Value, "\\") != -1 { + if strings.Contains(o.Value, "\\") { pattern = "\t%s = %q\n" } |