Source file src/net/cgo_stub.go

     1  // Copyright 2011 The Go Authors. 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  // This file holds stub versions of the cgo functions called on Unix systems.
     6  // We build this file:
     7  // - if using the netgo build tag on a Unix system
     8  // - on a Unix system without the cgo resolver functions
     9  //   (Darwin always provides the cgo functions, in cgo_unix_syscall.go)
    10  // - on wasip1, where cgo is never available
    11  
    12  //go:build (netgo && unix) || (unix && !cgo && !darwin) || js || wasip1
    13  
    14  package net
    15  
    16  import "context"
    17  
    18  // cgoAvailable set to false to indicate that the cgo resolver
    19  // is not available on this system.
    20  const cgoAvailable = false
    21  
    22  func cgoLookupHost(ctx context.Context, name string) (addrs []string, err error) {
    23  	panic("cgo stub: cgo not available")
    24  }
    25  
    26  func cgoLookupPort(ctx context.Context, network, service string) (port int, err error) {
    27  	panic("cgo stub: cgo not available")
    28  }
    29  
    30  func cgoLookupIP(ctx context.Context, network, name string) (addrs []IPAddr, err error) {
    31  	panic("cgo stub: cgo not available")
    32  }
    33  
    34  func cgoLookupCNAME(ctx context.Context, name string) (cname string, err error, completed bool) {
    35  	panic("cgo stub: cgo not available")
    36  }
    37  
    38  func cgoLookupPTR(ctx context.Context, addr string) (ptrs []string, err error) {
    39  	panic("cgo stub: cgo not available")
    40  }
    41  

View as plain text