Skip to content

uppet/goscript

 
 

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

28 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

goscript

goscript allows to use Go like if were a script language.

Internally, it compiles and links the script file whose executable is saved in the subdirectory ".go", then it is run. If that executable does not exist or its modified time is different than script's, then it's compiled again.

There is not obligation to use an extension, but if it's used then you could use ".go" if you want syntax highlighting in your editor. Another extension to use could be ".gos" (Go Script); see directory misc for ".gos" syntax in editor gedit.

The use of Go scripts is especially useful:

  • During learning
  • For administration issues
  • Boot init of operating systems
  • Web developing; by example for the routing
  • Interfaces of database models

Installation

$ git clone git://github.com/kless/goscript.git
$ cd goscript && ./Install.sh && cd -

Since the command env doesn't allow to pass any option to the interpreter, then the solution has been to create a link in /usr/bin/goscript. That link is created when installing with Install.sh.

Operating instructions

Insert in the head of the Go Script:

#!/usr/bin/goscript

And set its executable bit:

$ chmod +x file.go

An example of Go script:

#!/usr/bin/goscript

package main

import (
	"fmt"
)

func main() {
	fmt.Println("Take it on the other side")
}

Use in shared filesystem

A special case is when there is any Go script into a shared filesystem with access from a heterogeneous network. Then, there is to call the Go script from your system so it can takes values about the system where is going to run:

$ /usr/bin/goscript -shared /path/to/shared-fs/file.go

Copyright and licensing

Copyright 2010 The "goscript" Authors
See file AUTHORS and CONTRIBUTORS (if any).

Licensed under Simplified BSD License.
See file LICENSE.

Contact

To contact, send e-mail through github.

Known bugs

To reporting bugs, please login and create a new issue here.

Credits and acknowledgments

For credits, see file AUTHORS and CONTRIBUTORS (if any).

ChangeLog

For changes between the commits, see the commit history.


Generated by gowizard

About

Tool to run Go scripts

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Languages

  • Go 98.6%
  • Shell 1.4%