github.com/blend/go-sdk@v1.20220411.3/configutil/resolve.go (about)

     1  /*
     2  
     3  Copyright (c) 2022 - Present. Blend Labs, Inc. All rights reserved
     4  Use of this source code is governed by a MIT license that can be found in the LICENSE file.
     5  
     6  */
     7  
     8  package configutil
     9  
    10  import (
    11  	"context"
    12  )
    13  
    14  // ResolveAction is a step in resolution.
    15  type ResolveAction func(context.Context) error
    16  
    17  // Resolve returns the first non-nil error in a list.
    18  func Resolve(ctx context.Context, steps ...ResolveAction) (err error) {
    19  	for _, step := range steps {
    20  		if err = step(ctx); err != nil {
    21  			return err
    22  		}
    23  	}
    24  	return nil
    25  }