aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMáximo Cuadros <mcuadros@gmail.com>2020-07-14 06:11:20 +0200
committerGitHub <noreply@github.com>2020-07-14 06:11:20 +0200
commitef33fff761a2fabb7f0daf0c1779d2dfac1056da (patch)
treead7fbeef0f652e7f9aa0c6615360da31b76d4279
parente626226dea1d1e843b5295519f40cecdaa21004c (diff)
parent5c4c24b7d4ebc43a2a68bcf9f2f7aa1f96f43050 (diff)
downloadgo-git-ef33fff761a2fabb7f0daf0c1779d2dfac1056da.tar.gz
Merge pull request #128 from cristaloleg/minor-perf-fixes
Use EqualFold for comparison
-rw-r--r--plumbing/format/config/option.go2
-rw-r--r--plumbing/format/config/section.go2
2 files changed, 2 insertions, 2 deletions
diff --git a/plumbing/format/config/option.go b/plumbing/format/config/option.go
index d4775e4..218f992 100644
--- a/plumbing/format/config/option.go
+++ b/plumbing/format/config/option.go
@@ -19,7 +19,7 @@ type Options []*Option
// IsKey returns true if the given key matches
// this option's key in a case-insensitive comparison.
func (o *Option) IsKey(key string) bool {
- return strings.ToLower(o.Key) == strings.ToLower(key)
+ return strings.EqualFold(o.Key, key)
}
func (opts Options) GoString() string {
diff --git a/plumbing/format/config/section.go b/plumbing/format/config/section.go
index 4a17e3b..f743da6 100644
--- a/plumbing/format/config/section.go
+++ b/plumbing/format/config/section.go
@@ -61,7 +61,7 @@ func (s Subsections) GoString() string {
// IsName checks if the name provided is equals to the Section name, case insensitive.
func (s *Section) IsName(name string) bool {
- return strings.ToLower(s.Name) == strings.ToLower(name)
+ return strings.EqualFold(s.Name, name)
}
// Option return the value for the specified key. Empty string is returned if