@@ -7,21 +7,41 @@ package initrd
77import (
88 "context"
99 "fmt"
10+
11+ "kraftkit.sh/log"
1012)
1113
1214// New attempts to return the builder for a supplied path which
1315// will allow the provided ...
1416func New (ctx context.Context , path string , opts ... InitrdOption ) (Initrd , error ) {
1517 if builder , err := NewFromDockerfile (ctx , path , opts ... ); err == nil {
1618 return builder , nil
17- } else if builder , err := NewFromTarball (ctx , path , opts ... ); err == nil {
19+ } else {
20+ log .G (ctx ).Tracef ("could not build initrd from Dockerfile: %s" , err )
21+ }
22+
23+ if builder , err := NewFromTarball (ctx , path , opts ... ); err == nil {
1824 return builder , nil
19- } else if builder , err := NewFromFile (ctx , path , opts ... ); err == nil {
25+ } else {
26+ log .G (ctx ).Tracef ("could not build initrd from tarball: %s" , err )
27+ }
28+
29+ if builder , err := NewFromFile (ctx , path , opts ... ); err == nil {
2030 return builder , nil
21- } else if builder , err := NewFromDirectory (ctx , path , opts ... ); err == nil {
31+ } else {
32+ log .G (ctx ).Tracef ("could not build initrd from file: %s" , err )
33+ }
34+
35+ if builder , err := NewFromDirectory (ctx , path , opts ... ); err == nil {
2236 return builder , nil
23- } else if builder , err := NewFromOCIImage (ctx , path , opts ... ); err == nil {
37+ } else {
38+ log .G (ctx ).Tracef ("could not build initrd from directory: %s" , err )
39+ }
40+
41+ if builder , err := NewFromOCIImage (ctx , path , opts ... ); err == nil {
2442 return builder , nil
43+ } else {
44+ log .G (ctx ).Tracef ("could not build initrd from OCI image: %s" , err )
2545 }
2646
2747 return nil , fmt .Errorf ("could not determine how to build initrd from: %s" , path )
0 commit comments