Skip to content

Instantly share code, notes, and snippets.

@peko
Created November 19, 2015 20:58
Show Gist options
  • Select an option

  • Save peko/e4422a46d5226ebe59d6 to your computer and use it in GitHub Desktop.

Select an option

Save peko/e4422a46d5226ebe59d6 to your computer and use it in GitHub Desktop.
package main
import (
"bufio"
// "fmt"
"os"
"strings"
)
var storage map[string]string
func main() {
storage = make(map[string]string)
inFile, _ := os.Open("test-data.txt")
defer inFile.Close()
scanner := bufio.NewScanner(inFile)
scanner.Split(bufio.ScanLines)
for scanner.Scan() {
var kv []string = strings.Split(scanner.Text(), "\t")
// fmt.Println(kv[0],kv[1])
storage[kv[0]] = kv[1]
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment