goshell

command module
v0.0.0-...-32cfaa9 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Sep 2, 2016 License: MIT Imports: 10 Imported by: 0

README

Build Status

goshell

run go as shell

Why

Try some basic idea without creating a file, compiling, running.
Just like what python does.

Installation

Requirements:
  1. golang 1.6 (if you are using golang 1.6-, go get github.com/chzyer/readline is required)
  2. goimports(strongly recommend which help you import package you are using)
Installation:

go get github.com/kuangchanglang/goshell

Basic Usage

$ goshell 
>>> sum := 0   
>>> for i:=0; i<=100; i++{
>>> 	sum += i
>>> }
>>> import "fmt"
>>> fmt.Println(sum)
5050
>>> 
$ goshell
>>> func fi(n int) int{
>>> 	if n < 0 {
>>> 		return 0
>>> 	}
>>> 	if n <= 2{
>>> 		return 1
>>> 	}
>>> 	return fi(n-1) + fi(n-2)
>>> }
>>> fmt.Println(10)
10
>>> fmt.Println(3)
3
>>> for i:=0;i<10;i++{
>>> 	fmt.Println(fi(i))
>>> }
1
1
1
2
3
5
8
13
21
34
hint
  • type "quit" to exit
  • run stty erase ^h to enable backspace, run stty erase ^? to recover

Reference

gosh

Documentation

The Go Gopher

There is no documentation for this package.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL