sys

package
v0.3.5 Latest Latest
Warning

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

Go to latest
Published: Mar 27, 2017 License: Apache-2.0 Imports: 6 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	// CanOpenTerminal indicates if the current platform supports opening
	// Terminal/command-line applications to a specific directory.
	CanOpenTerminal bool
)

Functions

func AbsPath

func AbsPath(pkg string) string

AbsPath returns the absolute path to a package from it's name.

func Gopath

func Gopath() []string

Gopath returns the system GOPATH(s), defaulting to $HOME/go if the environment variable is not set.

func OpenBrowser

func OpenBrowser(url string)

OpenBrowser opens the default browser to the url provided.

func OpenFileExplorer

func OpenFileExplorer(pkg string)

OpenFileExplorer opens the system file explorer application to the specified package.

func OpenTerminal

func OpenTerminal(pkg string)

OpenTerminal opens the system terminal (command line) application to the specified package.

func RawGopath added in v0.3.1

func RawGopath() string

RawGopath returns the system GOPATH, defaulting to $HOME/go if the environment variable is not set, as a string regardless of how many GOPATHs are actually set.

func SetGopath added in v0.2.0

func SetGopath(gopath string)

SetGopath sets the $GOPATH environment variable to the value provided.

func Srcdir

func Srcdir() []string

Srcdir returns the source directory(s) for go packages.

Types

type CmdRunner

type CmdRunner struct{}

CmdRunner runs system commands.

func (CmdRunner) Run

func (CmdRunner) Run(cmd string, args ...string) ([]byte, error)

Run executes a system command.

type Runner

type Runner interface {
	Run(string, ...string) ([]byte, error)
}

Runner defines a type that can run system commands.

var DefaultRunner Runner = CmdRunner{}

DefaultRunner is the default command runner used by the sys package.

Jump to

Keyboard shortcuts

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