Skip to content

Instantly share code, notes, and snippets.

@asm-jaime
Created April 17, 2016 14:07
Show Gist options
  • Save asm-jaime/ddc7d40d042720aa74a23f724bca7428 to your computer and use it in GitHub Desktop.
Save asm-jaime/ddc7d40d042720aa74a23f724bca7428 to your computer and use it in GitHub Desktop.
test scanner writer interface bufio package
package main
import (
"bufio"
"fmt"
"os"
)
var scanner *bufio.Scanner = bufio.NewScanner(os.Stdin)
var writer *bufio.Writer = bufio.NewWriter(os.Stdout)
func main() {
defer writer.Flush()
scanner.Scan()
str_slice := scanner.Text()
writer.WriteString(str_slice + "\n")
fmt.Print(str_slice)
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment