Skip to content

Instantly share code, notes, and snippets.

@nasitra
Created July 14, 2017 09:24
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save nasitra/3e26c284dc5aa08a1da1ec47da4e43fe to your computer and use it in GitHub Desktop.
Save nasitra/3e26c284dc5aa08a1da1ec47da4e43fe to your computer and use it in GitHub Desktop.
Golang repl template
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