goenv

package
v1.6.1 Latest Latest
Warning

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

Go to latest
Published: Oct 28, 2025 License: Apache-2.0 Imports: 9 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	// ErrNoGoMod is returned when no GOMOD value could be identified.
	ErrNoGoMod = errors.New("`go env GOMOD` returned a blank string")

	// ErrNoModulePath is returned when no module path could be identified.
	ErrNoModulePath = errors.New("no module path found")
)

Functions

func GOMOD

func GOMOD(dir string) (string, error)

GOMOD returns the current GOMOD environment variable (from running `go env GOMOD`).

func GoBinPath

func GoBinPath() (string, error)

GoBinPath returns the resolved path to the `go` command's binary. The result is cached to avoid looking it up multiple times. If the lookup fails, the error is returned and the result is not cached.

func RootModulePath added in v1.6.0

func RootModulePath(ctx context.Context) (string, error)

RootModulePath returns the root module path for the current working directory. This is a convenience function that calls ModulePath with the current directory.

Types

type Module added in v1.6.0

type Module struct {
	Path string `json:"Path"`
	Dir  string `json:"Dir"`
}

Module represents basic information about a Go module.

Jump to

Keyboard shortcuts

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