mod

package
v0.2.1 Latest Latest
Warning

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

Go to latest
Published: Jun 12, 2022 License: BSD-3-Clause Imports: 12 Imported by: 0

Documentation

Overview

Package mod provides helpers for querying module information.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Root

func Root(path string) (root string, ok bool, err error)

Root returns the root directory of the module in the given path and whether a go.mod file can be found. It returns an error if the go tool is not running is module-aware mode.

Types

type Info

type Info struct {
	Path    string // module path
	Version string // module version
	Dir     string // directory holding files for this module, if any
	GoMod   string // path to go.mod file for this module, if any
}

Info holds module information. It is a subset of the information returned by "go list -json" in the Module struct. See go help list for details.

func Module

func Module(path string) (Info, error)

Module returns module information for the given directory path. If the path is in the standard library, the Info Path field will be GOROOT and Version will be the Go version.

type License

type License struct {
	// Path is the path to the license relative
	// to the root of the repository.
	Path string

	// Text is the text of the license.
	Text []byte

	// Cover is the license check information
	// for the license.
	Cover licensecheck.Coverage
}

License holds a package's license information.

func Licenses

func Licenses(root string, candidate *regexp.Regexp, verbose bool) ([]License, error)

Licenses returns all detected licenses under the specified root path. If verbose is true, Licenses will log additional information to os.Stderr.

Jump to

Keyboard shortcuts

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