github.com/annwntech/go-micro/v2@v2.9.5/config/source/file/options.go (about)

     1  package file
     2  
     3  import (
     4  	"context"
     5  
     6  	"github.com/annwntech/go-micro/v2/config/source"
     7  )
     8  
     9  type filePathKey struct{}
    10  
    11  // WithPath sets the path to file
    12  func WithPath(p string) source.Option {
    13  	return func(o *source.Options) {
    14  		if o.Context == nil {
    15  			o.Context = context.Background()
    16  		}
    17  		o.Context = context.WithValue(o.Context, filePathKey{}, p)
    18  	}
    19  }