...

Package gopath

import "simonwaldherr.de/go/golibs/gopath"
Overview
Index

Overview ▾

gopath provides an easy way to get system information

func Compiled

func Compiled() bool

Compiled returns a boolean which tells if you run a already compiled binary or "go run" the source.

func Compiler

func Compiler() string

Compiler returns the name of the used compiler

func Dir

func Dir() string

Dir returns the directory in which the binary or source file is stored. This is useful if you have config files in the same folder.

func GOARCH

func GOARCH() string

GOARCH returns the system architecture

func GOOS

func GOOS() string

GOOS returns the name of the Operating System

func GOPATH

func GOPATH() string

GOPATH returns the $GOPATH environment variable

func GOROOT

func GOROOT() string

GOROOT returns the $GOROOT environment variable

func Name

func Name() string

Name returns the filename of the binary or source file which is currently running.

func Path

func Path() string

Path returns the full path of the binary or source file which is currently running.

func WD

func WD() string

WD returns the working directory, this is the folder where you were last.

type FileType

type FileType int
const (
    DontExist FileType = iota
    Directory
    ASCII
    Binary
)

func GetFileType

func GetFileType(name string) FileType

GetFileType returns the type of a given file. The return values can be Directory, ASCII, Binary or DontExist.