github.com/shogo82148/std@v1.22.1-0.20240327122250-4e474527810c/internal/platform/supported.go (about)

     1  // Copyright 2018 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  //go:generate go test . -run=^TestGenerated$ -fix
     6  
     7  package platform
     8  
     9  // An OSArch is a pair of GOOS and GOARCH values indicating a platform.
    10  type OSArch struct {
    11  	GOOS, GOARCH string
    12  }
    13  
    14  func (p OSArch) String() string
    15  
    16  // RaceDetectorSupported reports whether goos/goarch supports the race
    17  // detector. There is a copy of this function in cmd/dist/test.go.
    18  // Race detector only supports 48-bit VMA on arm64. But it will always
    19  // return true for arm64, because we don't have VMA size information during
    20  // the compile time.
    21  func RaceDetectorSupported(goos, goarch string) bool
    22  
    23  // MSanSupported reports whether goos/goarch supports the memory
    24  // sanitizer option.
    25  func MSanSupported(goos, goarch string) bool
    26  
    27  // ASanSupported reports whether goos/goarch supports the address
    28  // sanitizer option.
    29  func ASanSupported(goos, goarch string) bool
    30  
    31  // FuzzSupported reports whether goos/goarch supports fuzzing
    32  // ('go test -fuzz=.').
    33  func FuzzSupported(goos, goarch string) bool
    34  
    35  // FuzzInstrumented reports whether fuzzing on goos/goarch uses coverage
    36  // instrumentation. (FuzzInstrumented implies FuzzSupported.)
    37  func FuzzInstrumented(goos, goarch string) bool
    38  
    39  // MustLinkExternal reports whether goos/goarch requires external linking
    40  // with or without cgo dependencies.
    41  func MustLinkExternal(goos, goarch string, withCgo bool) bool
    42  
    43  // BuildModeSupported reports whether goos/goarch supports the given build mode
    44  // using the given compiler.
    45  // There is a copy of this function in cmd/dist/test.go.
    46  func BuildModeSupported(compiler, buildmode, goos, goarch string) bool
    47  
    48  func InternalLinkPIESupported(goos, goarch string) bool
    49  
    50  // DefaultPIE reports whether goos/goarch produces a PIE binary when using the
    51  // "default" buildmode. On Windows this is affected by -race,
    52  // so force the caller to pass that in to centralize that choice.
    53  func DefaultPIE(goos, goarch string, isRace bool) bool
    54  
    55  // ExecutableHasDWARF reports whether the linked executable includes DWARF
    56  // symbols on goos/goarch.
    57  func ExecutableHasDWARF(goos, goarch string) bool
    58  
    59  // CgoSupported reports whether goos/goarch supports cgo.
    60  func CgoSupported(goos, goarch string) bool
    61  
    62  // FirstClass reports whether goos/goarch is considered a “first class” port.
    63  // (See https://go.dev/wiki/PortingPolicy#first-class-ports.)
    64  func FirstClass(goos, goarch string) bool
    65  
    66  // Broken reportsr whether goos/goarch is considered a broken port.
    67  // (See https://go.dev/wiki/PortingPolicy#broken-ports.)
    68  func Broken(goos, goarch string) bool