Skip to content

Simple wrapper around `go run` to use go as a scripting language

License

Notifications You must be signed in to change notification settings

euforic/goscript

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

2 Commits
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

goscript

Simple wrapper around go run to use go as a scripting language

CLI Usage

$ goscript "fmt.Println("packages will automatically be imported from your $GOPATH")

goscript.go

GoScipt Type

type GoScript struct {
    *exec.Cmd
}

NewFromFile takes in a filePath of golang source and converts it into a GoScript type with an embedded exec.Cmd

func NewFromFile(sourcePath string, args ...string) (*GoScript, error)

NewFromString takes in a string of golang source and converts into a GoScript type with an embedded exec.Cmd

func NewFromString(source string, args ...string) (*GoScript, error)

func (GoScript) Clean

Clean deletes the generated goscript tempfile

func (gs GoScript) Clean() error

func (GoScript) FilePath

FilePath returns the current GoScript's file path

func (gs GoScript) FilePath() string

About

Simple wrapper around `go run` to use go as a scripting language

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages