• Stars
    star
    599
  • Rank 74,745 (Top 2 %)
  • Language
    Go
  • License
    GNU General Publi...
  • Created about 10 years ago
  • Updated over 6 years ago

Reviews

There are no reviews yet. Be the first to send feedback to the community and the maintainers!

Repository Details

interactive shell for Golang

Gosh: interactive shell for golang

Gosh is the interactive Golang shell. The goal is to provide an easy-to-use interactive execution environment.

https://secure.travis-ci.org/mkouhei/gosh.png https://coveralls.io/repos/mkouhei/gosh/badge.png?branch=master Documentation Status

Documentation

http://gosh.readthedocs.org/

Features

  • Interactive shell
  • Enable to omit the main function
  • Enable to omit package statement
  • Enable to omit the import statement of standard library
  • Enable to Import libraries of non-standard library
  • Enable to re-declare function, type
  • Ignoring duplicate import package
  • Ignoring unused import package

Requirements

  • Golang >= 1.2
  • goimports command
    • We recommend that you install goimports to $PATH in advance.
    • Installing automatically if the command is not found in $PATH (>= v0.3.0).
    • However, the time until the installation is complete in this case,
      you will be waiting for the launch of "Gosh" process.

for documentation

  • libpython2.7-dev
  • libjpeg9-dev

Installation

Debian

Install the following packages

  • golang
  • golang-go.tools (recommended)

Set GOPATH:

$ install -d /path/to/gopath
$ export GOPATH=/path/to/gopath

If you install goimports in advance (recommended):

$ sudo apt-get install -y golang-go.tools

Install Gosh to GOPATH:

$ go get github.com/mkouhei/gosh

OS X

Install the follow packages with Homebrew.

  • Go
  • Mercurial (with Homebrew)

Set GOPATH:

$ install -d /path/to/gopath
$ export GOPATH=/path/to/gopath

If you install goimports in advance (recommend):

$ export PATH=${GOPATH}/bin:$PATH
$ go get golang.org/x/tools/cmd/goimports

Install the Gosh:

$ go get github.com/mkouhei/gosh

Basic usage

Examples:

$ $GOPATH/bin/gosh
>>> import "fmt"
>>> func main() {
>>> fmt.Println("hello")
>>> }
hello
>>>

or:

$ $GOPATH/bin/gosh
>>> func main() {
>>> fmt.Println("hello")
>>> }
hello
>>>

Note

Enabled to omit import statement for standard packages.

Enabled to import non-standard packages

Example of using non-standard package:

>>> import "net/http"
>>> import "example.org/somepkg"
>>> func main() {
>>> r, _ := http.Get("http://example.org/some")
>>> defer r.Body.Close()
>>> p, _ := somepkg.Reader(r.Body)
>>> fmt.Println(p)
>>> }
(print some payload)

Usage when omitting main function declarations

Example:

$ $GOPATH/bin/gosh
>>> i := 1
>>> i++
>>> fmt.Println(i)
2
>>>

Terminate Gosh to reset main declarations or declare func main() without body:

$ $GOSH/bin/gosh
>>> i := i
>>> fmt.Println(i)
1
>>> func main() {}
>>> fmt.Println(i)
[error] # command-line-arguments
./gosh_tmp.go:8: undefined: i
>>>

Limitations

  • fmt.Print* are executed only once.

Known issues

Fail to evaluate when there are declared and not used valiables.:

$ $GOPATH/bin/gosh
>>> i := 1
>>> fmt.Println("hello")
>>>

Roadmap

  • Tab completion
  • Enable to omit import statement for global(system) installed packages

License

Gosh is licensed under GPLv3.

More Repositories

1

iori

deploying and config management tool for LXC
Python
18
star
2

bootstrap-py

Bootstrap Python package
Python
12
star
3

tonicdnscli

TonicDNS client tool
Python
12
star
4

openssh-ldap-pubkey

Provides command for OpenSSH with LDAP public key; using OpenSSH AuthorizedKeysCommand
Go
11
star
5

backup2swift

Data backup to OpenStack Swift
Python
8
star
6

Genenga

Generate Nengajo(Japanese new year card) pdf, from address list.
Python
7
star
7

ansible-role-includecsv

Load variables from a CSV file, dynamically within a task.
Python
7
star
8

makefile-go

Makefile for Golang
Makefile
6
star
9

tacacs-plus

from Debian source package of tacacs+, and upstream is http://www.shrubbery.net/tac_plus/
C
6
star
10

shiori

bookmarking tool based on Web UI and JSON REST API
Python
6
star
11

playbook-slapd

example playbook with ansible-ldap module
5
star
12

swiftsc

Simple client library of OpenStack Swift
Python
5
star
13

mustache-couchdb-sample

JavaScript
5
star
14

golang-ajstarks-svgo-debian

Go
4
star
15

pgraph

Drawing graph of the dependencies of Python packages
Python
4
star
16

scripts

Shell
4
star
17

watchrepo

Shell
4
star
18

hatena2rest

Convert Hatena Diary XML exported data to Tinkerer (reST format).
Python
3
star
19

practice-GitPython

Python
2
star
20

golang-armon-mdns-debian

Go
2
star
21

pydebsign

Python
2
star
22

serf-debian

Go
2
star
23

py-deps

parsing the Python deps and generating graph data
Python
2
star
24

golang-msbranco-goconfig-debian

Go
1
star
25

presen-archive

1
star
26

playbook-yrmcds

Ansible Playbook for yrmcds cluster
1
star
27

godebbuild

Go
1
star
28

ihealthcheck

JavaScript
1
star
29

make-sid

HTML
1
star
30

nwcli

control network equipments
1
star
31

pguard

Guard like Haskell for Python.
Python
1
star
32

testapp-couchdb

sample application for CouchDB on Android.
JavaScript
1
star
33

linux-sgx-driver-debian

interl/linux-sgx-driver (https://github.com/intel/linux-sgx-driver) for (unofficial) debian package
C
1
star
34

hiki2rest

Converter of hiki to reST with tinkerer and Sphinx
1
star
35

palmtb.net

my web site
Python
1
star
36

glaneuses

Go
1
star
37

ahum

Go
1
star