github.com/searKing/golang/go@v1.2.117/net/resolver/picker.err.go (about)

     1  // Copyright 2021 The searKing Author. All rights reserved.
     2  // Use of this source code is governed by a BSD-style
     3  // license that can be found in the LICENSE file.
     4  
     5  package resolver
     6  
     7  import "context"
     8  
     9  // NewErrPicker returns a Picker that always returns err on Pick().
    10  func NewErrPicker(err error) Picker {
    11  	return &errPicker{err: err}
    12  }
    13  
    14  type errPicker struct {
    15  	err error // Pick() always returns this err.
    16  }
    17  
    18  func (p *errPicker) Pick(ctx context.Context, addrs []Address, opts ...PickOption) (Address, error) {
    19  	return Address{}, p.err
    20  }