vgo: Index | Files

package cfg

import ""

Package cfg holds configuration shared by multiple parts of the go command.


Package Files

cfg.go zdefaultcc.go zosarch.go


const DefaultPkgConfig = `pkg-config`


var (
    BuildA                 bool   // -a flag
    BuildBuildmode         string // -buildmode flag
    BuildContext           = defaultContext()
    BuildMod               string             // -mod flag
    BuildI                 bool               // -i flag
    BuildLinkshared        bool               // -linkshared flag
    BuildMSan              bool               // -msan flag
    BuildN                 bool               // -n flag
    BuildO                 string             // -o flag
    BuildP                 = runtime.NumCPU() // -p flag
    BuildPkgdir            string             // -pkgdir flag
    BuildRace              bool               // -race flag
    BuildToolexec          []string           // -toolexec flag
    BuildToolchainName     string
    BuildToolchainCompiler func() string
    BuildToolchainLinker   func() string
    BuildV                 bool // -v flag
    BuildWork              bool // -work flag
    BuildX                 bool // -x flag

    CmdName string // "build", "install", "list", etc.

    DebugActiongraph string // -debug-actiongraph flag (undocumented, unstable)

These are general "build flags" used by build and other commands.

var (
    Goarch    = BuildContext.GOARCH
    Goos      = BuildContext.GOOS
    ExeSuffix string
    Gopath    = filepath.SplitList(BuildContext.GOPATH)

    // ModulesEnabled specifies whether the go command is running
    // in module-aware mode (as opposed to GOPATH mode).
    // It is equal to modload.Enabled, but not all packages can import modload.
    ModulesEnabled bool

    // GoModInGOPATH records whether we've found a go.mod in GOPATH/src
    // in GO111MODULE=auto mode. In that case, we don't use modules
    // but people might expect us to, so 'go get' warns.
    GoModInGOPATH string

Global build parameters (used during package load)

var (
    GOROOT       = findGOROOT()
    GOBIN        = os.Getenv("GOBIN")
    GOROOTbin    = filepath.Join(GOROOT, "bin")
    GOROOTpkg    = filepath.Join(GOROOT, "pkg")
    GOROOTsrc    = filepath.Join(GOROOT, "src")

    // Used in envcmd.MkEnv and build ID computations.
    GOARM, GO386, GOMIPS, GOMIPS64 = objabi()

    // C and C++ compilers
    CC, CXX = compilers()
var CmdEnv []EnvVar

CmdEnv is the new environment for running go tool commands. User binaries (during go test or go run) are run with OrigEnv, not CmdEnv.

var OSArchSupportsCgo = map[string]bool{
    "android/386":     true,
    "android/amd64":   true,
    "android/arm":     true,
    "android/arm64":   true,
    "darwin/386":      true,
    "darwin/amd64":    true,
    "darwin/arm":      true,
    "darwin/arm64":    true,
    "dragonfly/amd64": true,
    "freebsd/386":     true,
    "freebsd/amd64":   true,
    "freebsd/arm":     false,
    "js/wasm":         false,
    "linux/386":       true,
    "linux/amd64":     true,
    "linux/arm":       true,
    "linux/arm64":     true,
    "linux/mips":      true,
    "linux/mips64":    true,
    "linux/mips64le":  true,
    "linux/mipsle":    true,
    "linux/ppc64":     false,
    "linux/ppc64le":   true,
    "linux/riscv64":   true,
    "linux/s390x":     true,
    "nacl/386":        false,
    "nacl/amd64p32":   false,
    "nacl/arm":        false,
    "netbsd/386":      true,
    "netbsd/amd64":    true,
    "netbsd/arm":      true,
    "openbsd/386":     true,
    "openbsd/amd64":   true,
    "openbsd/arm":     false,
    "plan9/386":       false,
    "plan9/amd64":     false,
    "plan9/arm":       false,
    "solaris/amd64":   true,
    "windows/386":     true,
    "windows/amd64":   true,
var OrigEnv []string

OrigEnv is the original environment of the program at startup.

func DefaultCC Uses

func DefaultCC(goos, goarch string) string

func DefaultCXX Uses

func DefaultCXX(goos, goarch string) string

type EnvVar Uses

type EnvVar struct {
    Name  string
    Value string

An EnvVar is an environment variable Name=Value.

Package cfg imports 8 packages (graph). Updated 2018-10-15. Refresh now. Tools for package owners.