Skip to content

Commit ff82bfb

Browse files
committed
Renamed internal function. Small makeup.
1 parent 05afb50 commit ff82bfb

File tree

1 file changed

+5
-4
lines changed

1 file changed

+5
-4
lines changed

properties.go

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -68,7 +68,7 @@ func Load(filepath string) (Map, error) {
6868
properties := make(Map)
6969

7070
for lineNum, line := range strings.Split(text, "\n") {
71-
if err := properties.loadSingleLine(line); err != nil {
71+
if err := properties.parseLine(line); err != nil {
7272
return nil, fmt.Errorf("Error reading file (%s:%d): %s", filepath, lineNum, err)
7373
}
7474
}
@@ -80,17 +80,18 @@ func LoadFromSlice(lines []string) (Map, error) {
8080
properties := make(Map)
8181

8282
for lineNum, line := range lines {
83-
if err := properties.loadSingleLine(line); err != nil {
83+
if err := properties.parseLine(line); err != nil {
8484
return nil, fmt.Errorf("Error reading from slice (index:%d): %s", lineNum, err)
8585
}
8686
}
8787

8888
return properties, nil
8989
}
9090

91-
func (properties Map) loadSingleLine(line string) error {
91+
func (m Map) parseLine(line string) error {
9292
line = strings.TrimSpace(line)
9393

94+
// Skip empty lines or comments
9495
if len(line) == 0 || line[0] == '#' {
9596
return nil
9697
}
@@ -103,7 +104,7 @@ func (properties Map) loadSingleLine(line string) error {
103104
value := strings.TrimSpace(lineParts[1])
104105

105106
key = strings.Replace(key, "."+osSuffix, "", 1)
106-
properties[key] = value
107+
m[key] = value
107108

108109
return nil
109110
}

0 commit comments

Comments
 (0)