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 /config/config.go | |
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 'config/config.go')
-rw-r--r-- | config/config.go | 11 |
1 files changed, 3 insertions, 8 deletions
diff --git a/config/config.go b/config/config.go index 477eb35..fc4cd28 100644 --- a/config/config.go +++ b/config/config.go @@ -65,8 +65,8 @@ type Config struct { // NewConfig returns a new empty Config. func NewConfig() *Config { return &Config{ - Remotes: make(map[string]*RemoteConfig, 0), - Submodules: make(map[string]*Submodule, 0), + Remotes: make(map[string]*RemoteConfig), + Submodules: make(map[string]*Submodule), Raw: format.New(), } } @@ -290,13 +290,8 @@ func (c *RemoteConfig) unmarshal(s *format.Subsection) error { fetch = append(fetch, rs) } - var urls []string - for _, f := range c.raw.Options.GetAll(urlKey) { - urls = append(urls, f) - } - c.Name = c.raw.Name - c.URLs = urls + c.URLs = append([]string(nil), c.raw.Options.GetAll(urlKey)...) c.Fetch = fetch return nil |