Created
July 14, 2017 09:24
-
-
Save nasitra/3e26c284dc5aa08a1da1ec47da4e43fe to your computer and use it in GitHub Desktop.
Golang repl template
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
package main | |
import ( | |
"bufio" | |
"fmt" | |
"os" | |
) | |
func main() { | |
fmt.Print("> ") | |
s := bufio.NewScanner(os.Stdin) | |
for s.Scan() { | |
t := s.Text() | |
if t == "exit" || t == "quit" { | |
break | |
} | |
exec(t) | |
fmt.Print("> ") | |
} | |
} | |
func exec(t string) { | |
fmt.Println("input: " + t) | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment