goenv

package
v0.1.4 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Jan 4, 2022 License: MIT Imports: 15 Imported by: 0

Documentation

Overview

Package goenv returns environment variables that are used in various parts of the compiler. You can query it manually with the `nanogo env` subcommand.

Index

Constants

This section is empty.

Variables

View Source
var Keys = []string{
	"GOOS",
	"GOARCH",
	"GOROOT",
	"GOPATH",
	"GOCACHE",
	"CGO_ENABLED",
	"NANOGOROOT",
}

Keys is a slice of all available environment variable keys.

View Source
var NANOGOROOT string

NANOGOROOT is the path to the final location for checking nanogo files. If unset (by a -X ldflag), then sourceDir() will fallback to the original build directory.

Functions

func Get

func Get(name string) string

Get returns a single environment variable, possibly calculating it on-demand. The empty string is returned for unknown environment variables.

func GetCachedGoroot

func GetCachedGoroot() (string, error)

GetCachedGoroot creates a new GOROOT by merging both the standard GOROOT and the GOROOT from nanogo using lots of symbolic links.

func GetGorootVersion

func GetGorootVersion(goroot string) (major, minor int, err error)

GetGorootVersion returns the major and minor version for a given GOROOT path. If the goroot cannot be determined, (0, 0) is returned.

func GorootVersionString

func GorootVersionString(goroot string) (string, error)

GorootVersionString returns the version string as reported by the Go toolchain for the given GOROOT path. It is usually of the form `go1.x.y` but can have some variations (for beta releases, for example).

Types

This section is empty.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL