summaryrefslogtreecommitdiff
path: root/tinc.go
diff options
context:
space:
mode:
authorLuke Shumaker <lukeshu@lukeshu.com>2018-04-18 16:32:18 -0400
committerLuke Shumaker <lukeshu@lukeshu.com>2018-04-18 16:32:18 -0400
commitbab083546c3370016f911efc575259109293addc (patch)
treec482ed235133a8ad97725d428dc149fb008a44f3 /tinc.go
parent3b6279ddf21ca58b8cf9469c04a249d69ea449cb (diff)
golint
Diffstat (limited to 'tinc.go')
-rw-r--r--tinc.go11
1 files changed, 5 insertions, 6 deletions
diff --git a/tinc.go b/tinc.go
index d06a6d2..62c9100 100644
--- a/tinc.go
+++ b/tinc.go
@@ -15,11 +15,10 @@ type Error struct {
}
func (e Error) Error() string {
- if e.Line > 0 {
- return fmt.Sprintf("%v:%v: %v", e.File, e.Line, e.Err)
- } else {
+ if e.Line < 1 {
return fmt.Sprintf("%v: %v", e.File, e.Err)
}
+ return fmt.Sprintf("%v:%v: %v", e.File, e.Line, e.Err)
}
func parseConfigLine(line string) (key, val string) {
@@ -43,7 +42,7 @@ func parseConfigLine(line string) (key, val string) {
// a map of settings. Since Tinc setting names are case-insensitive,
// the keys in the map are all lower-case.
func ReadConfigFile(fname string) (map[string][]string, error) {
- config_tree := make(map[string][]string)
+ cfg := make(map[string][]string)
fp, err := os.Open(fname)
if err != nil {
@@ -83,14 +82,14 @@ func ReadConfigFile(fname string) (map[string][]string, error) {
return nil, Error{File: fname, Line: lineno, Err: err}
}
variable = strings.ToLower(variable)
- config_tree[variable] = append(config_tree[variable], value)
+ cfg[variable] = append(cfg[variable], value)
}
err = buffer.Err()
if err != nil {
return nil, Error{File: fname, Err: err}
}
- return config_tree, nil
+ return cfg, nil
}
// GetAddresses inspects a tinc host-confing settings object and