here – github.com/gobuffalo/here Index | Files | Directories

package here

import "github.com/gobuffalo/here"

Index

Constants

const Version = "v0.1.0"

Version of here

Types

type Info

type Info struct {
	Dir         string
	ImportPath  string
	Name        string
	Doc         string
	Target      string
	Root        string
	Match       []string
	Stale       bool
	StaleReason string
	GoFiles     []string
	Imports     []string
	Deps        []string
	TestGoFiles []string
	TestImports []string
	Module      Module
	GoEnv       map[string]string // go env -json
}

Info represents details about the directory/package

func Dir

func Dir(p string) (Info, error)

Dir attempts to gather info for the requested directory.

func Package

func Package(p string) (Info, error)

Package attempts to gather info for the requested package.

From the `go help list` docs:

The -find flag causes list to identify the named packages but not
resolve their dependencies: the Imports and Deps lists will be empty.

A workaround for this issue is to use the `Dir` field in the returned `Info` value and pass it to the `Dir(string) (Info, error)` function to return the complete data.

func (Info) Getenv

func (i Info) Getenv(k string) string

Getenv is a helper function to mimic os.Getenv behavior.

func (Info) GoPath

func (i Info) GoPath() string

GoPath returns the GOPATH ENV var

func (Info) Has

func (i Info) Has(k string) bool

Has checks if the ENV variable is in the GoEnv

func (Info) IsZero

func (i Info) IsZero() bool

IsZero checks if the type has been filled with rich chocolately data goodness

func (Info) Mods

func (i Info) Mods() bool

Mods returns whether Go modules are used in this directory/package.

func (Info) ModuleName

func (i Info) ModuleName() string

ModuleName returns the name of the current module, or if not using modules, the current package. These *might* not match.

func (Info) String

func (i Info) String() string

type Module

type Module struct {
	Path      string `json:"Path"`
	Main      bool   `json:"Main"`
	Dir       string `json:"Dir"`
	GoMod     string `json:"GoMod"`
	GoVersion string `json:"GoVersion"`
}

func (Module) IsZero

func (i Module) IsZero() bool

func (Module) String

func (i Module) String() string

Source Files

dir.go here.go info.go module.go pkg.go version.go

Directories

PathSynopsis
cmd
cmd/here
Version
v0.1.0
Published
Jun 15, 2019
Platform
windows/amd64
Imports
5 packages
Last checked
11 months ago

Tools for package owners.