github.com/searKing/golang/go@v1.2.117/net/resolver/picker.pickfirst.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 (
     8  	"context"
     9  	"os"
    10  )
    11  
    12  func PickFirst(ctx context.Context, addrs []Address, opts ...PickOption) (Address, error) {
    13  	if len(addrs) == 0 {
    14  		return Address{}, os.ErrNotExist
    15  	}
    16  	return addrs[0], nil
    17  }