Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Commit 14a3e5e

Browse files
author
anonx
committed
Removed unreachable fragment of code from LoadContext
1 parent 0c34111 commit 14a3e5e

File tree

1 file changed

+4
-7
lines changed

1 file changed

+4
-7
lines changed

config/config.go

Lines changed: 4 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,6 @@
11
package config
22

33
import (
4-
"errors"
54
"path"
65
"strings"
76

@@ -18,20 +17,18 @@ type Context struct {
1817
}
1918

2019
func NewContext() *Context {
21-
return &Context{config.NewDefault(), ""}
20+
return &Context{config: config.NewDefault()}
2221
}
2322

2423
func LoadContext(confName string, confPaths []string) (*Context, error) {
2524
var err error
25+
var conf *config.Config
2626
for _, confPath := range confPaths {
27-
conf, err := config.ReadDefault(path.Join(confPath, confName))
27+
conf, err = config.ReadDefault(path.Join(confPath, confName))
2828
if err == nil {
29-
return &Context{conf, ""}, nil
29+
return &Context{config: conf}, nil
3030
}
3131
}
32-
if err == nil {
33-
err = errors.New("not found")
34-
}
3532
return nil, err
3633
}
3734

0 commit comments

Comments
 (0)