Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/mkouhei/gosh
interactive shell for Golang
https://github.com/mkouhei/gosh
Last synced: 13 days ago
JSON representation
interactive shell for Golang
- Host: GitHub
- URL: https://github.com/mkouhei/gosh
- Owner: mkouhei
- License: gpl-3.0
- Created: 2014-10-14T23:02:42.000Z (about 10 years ago)
- Default Branch: master
- Last Pushed: 2018-03-11T16:23:12.000Z (over 6 years ago)
- Last Synced: 2024-08-01T15:06:50.374Z (3 months ago)
- Language: Go
- Homepage:
- Size: 1.02 MB
- Stars: 599
- Watchers: 15
- Forks: 34
- Open Issues: 9
-
Metadata Files:
- Readme: README.rst
- License: LICENSE
Awesome Lists containing this project
README
====================================
Gosh: interactive shell for golang
====================================``Gosh`` is the interactive Golang shell.
The goal is to provide an easy-to-use interactive execution environment... image:: https://secure.travis-ci.org/mkouhei/gosh.png
:target: http://travis-ci.org/mkouhei/gosh
.. image:: https://coveralls.io/repos/mkouhei/gosh/badge.png?branch=master
:target: https://coveralls.io/r/mkouhei/gosh?branch=master
.. image:: https://readthedocs.org/projects/gosh/badge/?version=latest
:target: https://readthedocs.org/projects/gosh/?badge=latest
:alt: Documentation StatusDocumentation
=============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 packageRequirements
------------* 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-devInstallation
------------Debian
~~~~~~Install the following packages
* golang
* golang-go.tools (recommended)Set ``GOPATH``::
$ install -d /path/to/gopath
$ export GOPATH=/path/to/gopathIf 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/gopathIf you install ``goimports`` in advance (recommend)::
$ export PATH=${GOPATH}/bin:$PATH
$ go get golang.org/x/tools/cmd/goimportsInstall 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 packagesLicense
-------``Gosh`` is licensed under GPLv3.