Created
June 28, 2014 20:45
-
-
Save taotetek/1d122b684ef57fe49fb3 to your computer and use it in GitHub Desktop.
gopher_example.go
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
func TestGopherDirToJSON(t *testing.T) { | |
gd, err := NewGopherDir("gopher://gopher.quux.org:70") | |
if err != nil { | |
t.Fatal(err) | |
} | |
jsonBytes, err := gd.ToJSON() | |
if err != nil { | |
t.Fatal(err) | |
} | |
fmt.Print(string(jsonBytes)) | |
} | |
/* | |
{"Path":"gopher://gopher.quux.org:70","GopherMap":[{"ItemType":"i","DisplayString":"Welcome to gopher at quux.org!","Selector":"fake","HostName":"(NULL)","Port":"0"},{"ItemType":"i","DisplayString":"","Selector":"fake","HostName":"(NULL)","Port":"0"},{"ItemType":"i","DisplayString":"This server has a lot of information of historic interest,","Selector":"fake","HostName":"(NULL)","Port":"0"},{"ItemType":"i","DisplayString":"funny, or just plain entertaining -- all presented in Gopher.","Selector":"fake","HostName":"(NULL)","Port":"0"},{"ItemType":"i","DisplayString":"There are many mirrors here of rare or valuable files with the","Selector":"fake","HostName":"(NULL)","Port":"0"},{"ItemType":"i","DisplayString":"aim to preserve them in case their host disappears. PLEASE READ","Selector":"fake","HostName":"(NULL)","Port":"0"},{"ItemType":"i","DisplayString":"\"About This Server\" FOR IMPORTANT NOTES AND LEGAL INFORMATION.","Selector":"fake","HostName":"(NULL)","Port":"0"},{"ItemType":"i","DisplayString":"","Selector":"fake","HostName":"(NULL)","Port":"0"}]} | |
*/ |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment