Skip to content

Instantly share code, notes, and snippets.

@AlexMocioi
AlexMocioi / main.go
Created December 18, 2013 00:34 — forked from tonyhb/main.go
Convert struct to map
package main
import (
"fmt"
"net/url"
"reflect"
"strconv"
)
type Person struct {
@AlexMocioi
AlexMocioi / JSON.go
Created April 6, 2014 16:21
Map json to struct in GO, for direct marshal, unmarshal
package main
import "encoding/json"
import "fmt"
type Person struct {
Name string `json:"name"`
@AlexMocioi
AlexMocioi / ReadSTDIN.go
Created April 6, 2014 16:24
Read big text data from SDIN in Go
package main
import "fmt"
import "bufio"
import "os"
func main() {
f, _ := os.Create("outputgo.txt")
reader := bufio.NewReader(os.Stdin)
for {
line, err := reader.ReadString('\n')