File tree Expand file tree Collapse file tree 1 file changed +9
-2
lines changed Expand file tree Collapse file tree 1 file changed +9
-2
lines changed Original file line number Diff line number Diff line change @@ -23,8 +23,15 @@ type MetaConfig struct {
23
23
24
24
// Load config from file then from environment variables
25
25
func Load (box * packr.Box , config interface {}) error {
26
- _ , filename , _ , _ := runtime .Caller (1 )
27
- resolverRoot := path .Clean (path .Join (path .Dir (filename ), box .Path ))
26
+
27
+ var resolverRoot string
28
+ // when debugging a main package, the Box path will be a full path
29
+ if strings .HasPrefix (box .Path , "/" ) {
30
+ resolverRoot = box .Path
31
+ } else { // the Box path is relative, append to the config file's path
32
+ _ , filename , _ , _ := runtime .Caller (1 )
33
+ resolverRoot = path .Clean (path .Join (path .Dir (filename ), box .Path ))
34
+ }
28
35
box .DefaultResolver = & resolver.Disk {Root : resolverRoot }
29
36
30
37
configType := "json"
You can’t perform that action at this time.
0 commit comments