mirror of
				https://github.com/go-micro/go-micro.git
				synced 2025-10-30 23:27:41 +02:00 
			
		
		
		
	
		
			
	
	
		
			18 lines
		
	
	
		
			367 B
		
	
	
	
		
			Go
		
	
	
	
	
	
		
		
			
		
	
	
			18 lines
		
	
	
		
			367 B
		
	
	
	
		
			Go
		
	
	
	
	
	
|   | package gossip | ||
|  | 
 | ||
|  | import ( | ||
|  | 	"context" | ||
|  | 
 | ||
|  | 	"github.com/micro/go-micro/registry" | ||
|  | ) | ||
|  | 
 | ||
|  | // setRegistryOption returns a function to setup a context with given value | ||
|  | func setRegistryOption(k, v interface{}) registry.Option { | ||
|  | 	return func(o *registry.Options) { | ||
|  | 		if o.Context == nil { | ||
|  | 			o.Context = context.Background() | ||
|  | 		} | ||
|  | 		o.Context = context.WithValue(o.Context, k, v) | ||
|  | 	} | ||
|  | } |