shared

package
v1.14.0 Latest Latest
Warning

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

Go to latest
Published: Jun 11, 2023 License: MIT Imports: 10 Imported by: 0

Documentation

Overview

package paths to filesystem directories and vice versa.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Dir

func Dir(env vos.Env, packagePath string) (string, error)

Dir returns the filesystem path for the directory corresponding to the go package path provided.

func Dirs

func Dirs(env vos.Env, packagePath string) (map[string]string, error)

Dirs returns the filesystem path for all packages under the directory corresponding to the go package path provided.

func Name

func Name(env vos.Env, packagePath string, srcDir string) (string, error)

Name returns the package name for a given path and src dir. Note that the src dir (e.g. working dir) is required because multiple vendored packages can correspond to the same path when accessed from different dirs.

func Path

func Path(env vos.Env, packageDir string) (string, error)

Path returns the go package path corresponding to the filesystem directory provided.

Types

type Cache

type Cache struct {
	// contains filtered or unexported fields
}

Cache supports patsy.Dir and patsy.Path, but cached so they can be used in tight loops without hammering the filesystem.

func NewCache

func NewCache(env vos.Env) *Cache

NewCache returns a new *Cache, allowing cached access to patsy utility functions.

func (*Cache) Dir

func (c *Cache) Dir(ppath string) (string, error)

Dir does the same as patsy.Dir but cached.

func (*Cache) Dirs

func (c *Cache) Dirs(ppath string) (map[string]string, error)

Dirs does the same as patsy.Dirs but cached.

func (*Cache) FilePath

func (c *Cache) FilePath(gpath string) (string, error)

FilePath converts a package path and filename to a full filepath:

github.com/dave/foo.go -> /Users/dave/go/src/github.com/dave/foo.go

func (*Cache) GoName

func (c *Cache) GoName(fpath string) (string, error)

GoName converts a full filepath to a package path and filename:

/Users/dave/go/src/github.com/dave/foo.go -> github.com/dave/foo.go

func (*Cache) Name

func (c *Cache) Name(packagePath, srcDir string) (string, error)

Name does the same as patsy.Name but cached.

func (*Cache) Path

func (c *Cache) Path(dir string) (string, error)

Path does the same as patsy.Path but cached.

type ExcludeType added in v1.9.0

type ExcludeType byte
const (
	Notestall ExcludeType = iota
	Notest
	Notestdept
)

type PackageSpec

type PackageSpec struct {
	Dir  string
	Path string
}

PackageSpec identifies a package by dir and path

type Setup

type Setup struct {
	Env        vos.Env
	Paths      *Cache
	Enforce    bool
	Verbose    bool
	Short      bool
	Notest     bool
	Notestdept bool
	Timeout    string
	Load       string
	Output     string
	TestArgs   []string
	Packages   []PackageSpec
}

Setup holds globals, environment and command line flags for the courtney command

func (*Setup) Parse

func (s *Setup) Parse(args []string) error

Parse parses a slice of strings into the Packages slice

Directories

Path Synopsis
package builder can be used in testing to create a temporary go module or gopath, src, namespace and package directory, and populate it with source files.
package builder can be used in testing to create a temporary go module or gopath, src, namespace and package directory, and populate it with source files.
vos
Package vos is a virtual os tool.
Package vos is a virtual os tool.
os

Jump to

Keyboard shortcuts

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