...

Source file src/edge-infra.dev/pkg/f8n/warehouse/pallet/resolve/options.go

Documentation: edge-infra.dev/pkg/f8n/warehouse/pallet/resolve

     1  package resolve
     2  
     3  type Option func(*options)
     4  
     5  type options struct {
     6  	strict      bool
     7  	acceptFirst bool
     8  }
     9  
    10  // AcceptFirstDigest keeps the first digest seen in the resolved map when two or
    11  // more digests are found for the same artifact during resolve's walk.
    12  func AcceptFirstDigest() Option {
    13  	return func(o *options) {
    14  		o.strict = false
    15  		o.acceptFirst = true
    16  	}
    17  }
    18  
    19  func makeOptions(opts ...Option) options {
    20  	o := &options{}
    21  	o.strict = true
    22  	for _, opt := range opts {
    23  		opt(o)
    24  	}
    25  	return *o
    26  }
    27  

View as plain text