github.com/wolfi-dev/wolfictl@v0.16.11/pkg/dag/graph_options.go (about) 1 package dag 2 3 type graphOptions struct { 4 allowUnresolved bool 5 repos []string 6 keys []string 7 arch string 8 } 9 10 type GraphOptions func(*graphOptions) error 11 12 func WithAllowUnresolved() GraphOptions { 13 return func(o *graphOptions) error { 14 o.allowUnresolved = true 15 return nil 16 } 17 } 18 19 // WithRepos add repos for resolution of the 20 // buildtime graph, i.e. environments.contents.packages. 21 // Always includes packages in the local repository in which 22 // this package is defined. Optionally, you can add 23 // other repositories. 24 func WithRepos(repos ...string) GraphOptions { 25 return func(o *graphOptions) error { 26 o.repos = repos 27 return nil 28 } 29 } 30 31 // WithKeys add keys for validating 32 // repositories referenced in the 33 // buildtime graph, i.e. environments.contents.packages. 34 // The local repository in which this package is defined does not 35 // need additional keys. Normally used in concert with WithRepos. 36 func WithKeys(keys ...string) GraphOptions { 37 return func(o *graphOptions) error { 38 o.keys = keys 39 return nil 40 } 41 } 42 43 // WithArch sets the architecture for which the graph is built. 44 func WithArch(arch string) GraphOptions { 45 return func(o *graphOptions) error { 46 o.arch = arch 47 return nil 48 } 49 }