which

package module
v0.0.0-...-adcb5d5 Latest Latest
Warning

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

Go to latest
Published: Oct 26, 2014 License: MIT Imports: 10 Imported by: 1

README

which GoDoc Build Status Build Status Build status Coverage Status

Package which shows the import path of Go executables.

Installation

~ $ go get -u github.com/rjeczalik/which

Documentation

godoc.org/github.com/rjeczalik/which

cmd/gowhich GoDoc

Installation

~ $ go get -u github.com/rjeczalik/which/cmd/gowhich
~ $ go install github.com/rjeczalik/which/cmd/gowhich

Documentation

godoc.org/github.com/rjeczalik/which/cmd/gowhich

Example usage

~ $ gowhich godoc
code.google.com/p/go.tools/cmd/godoc
~ $ gowhich ~/bin/godoc
code.google.com/p/go.tools/cmd/godoc

cmd/gofile GoDoc

Installation

~ $ go get -u github.com/rjeczalik/which/cmd/gofile
~ $ go install github.com/rjeczalik/which/cmd/gofile

Documentation

godoc.org/github.com/rjeczalik/which/cmd/gofile

Example usage

~ $ gofile godoc
darwin_amd64
~ $ gofile ~/bin/godoc
darwin_amd64

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	// ErrNotGoExec is an error.
	ErrNotGoExec = errors.New("which: not a Go executable")
	// ErrGuessFail is an error.
	ErrGuessFail = errors.New("which: unable to guess an import path of the main package")
)
View Source
var (
	// PlatformDarwin386 represents the darwin_386 target arch.
	PlatformDarwin386 = &PlatformType{"darwin", "386"}
	// PlatformDarwinAMD64 represents the darwin_amd64 target arch.
	PlatformDarwinAMD64 = &PlatformType{"darwin", "amd64"}
	// PlatformFreeBSD386 represents the freebsd_386 target arch.
	PlatformFreeBSD386 = &PlatformType{"freebsd", "386"}
	// PlatformFreeBSDAMD64 represents the freebsd_amd64 target arch.
	PlatformFreeBSDAMD64 = &PlatformType{"freebsd", "amd64"}
	// PlatformLinux386 represents the linux_386 target arch.
	PlatformLinux386 = &PlatformType{"linux", "386"}
	// PlatformLinuxAMD64 represents the linux_amd64 target arch.
	PlatformLinuxAMD64 = &PlatformType{"linux", "amd64"}
	// PlatformWindows386 represents the windows_386 target arch.
	PlatformWindows386 = &PlatformType{"windows", "386"}
	// PlatformWindowsAMD64 represents the windows_amd64 target arch.
	PlatformWindowsAMD64 = &PlatformType{"windows", "amd64"}
)

Functions

func Import

func Import(path string) (string, error)

Import reads the import path of main package of the Go executable given by the path.

Types

type Exec

type Exec struct {
	Path string        // Path to the executable.
	Type *PlatformType // Fileutable file format.
	// contains filtered or unexported fields
}

Exec represents a single Go executable file.

func NewExec

func NewExec(path string) (*Exec, error)

NewExec tries to detect executable type for the given path and returns a new executable. It fails if file does not exist, is not a Go executable or it's unable to parse the file format.

func (*Exec) Import

func (ex *Exec) Import() (string, error)

Import gives the import path of main package of given executable. It returns non-nil error when it fails to guess the exact path.

type PlatformType

type PlatformType struct {
	GOOS   string // target operating system
	GOARCH string // target architecture
}

PlatformType represents the target platform of the executable.

func (PlatformType) String

func (typ PlatformType) String() string

String gives Go platform string.

Directories

Path Synopsis
cmd
gofile
cmd/gofile shows the platform string of Go executables cmd/gofile takes one argument, which is either program name or abosolute or relative path to an executable; when a program name is provided, it's looked up up in the $PATH.
cmd/gofile shows the platform string of Go executables cmd/gofile takes one argument, which is either program name or abosolute or relative path to an executable; when a program name is provided, it's looked up up in the $PATH.
gowhich
cmd/gowhich shows the import path of Go executables cmd/gowhich takes one argument, which is either program name or abosolute or relative path to an executable; when a program name is provided, it's looked up up in the $PATH.
cmd/gowhich shows the import path of Go executables cmd/gowhich takes one argument, which is either program name or abosolute or relative path to an executable; when a program name is provided, it's looked up up in the $PATH.

Jump to

Keyboard shortcuts

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