File tree Expand file tree Collapse file tree 2 files changed +43
-7
lines changed
Expand file tree Collapse file tree 2 files changed +43
-7
lines changed Original file line number Diff line number Diff line change @@ -20,6 +20,7 @@ go get -u -v github.com/c0de8/bmfmt
2020package main
2121
2222import (
23+ " fmt"
2324 bmfmt " github.com/c0de8/bmfmt"
2425)
2526
@@ -28,26 +29,28 @@ func main() {
2829}
2930
3031func example () {
31-
32+
3233 m := map [string ][]string {
3334 " some-key" : { " response" },
3435 " Another-Hash-Key" : { " first value" , " second value" },
3536 }
36-
37+
3738 fmt.Println (m) // fmt the default formatting
3839 /*
39- map[some-key:[response] Another-Hash-Key:[first value second value]]
40+ map[some-key:[response] Another-Hash-Key:[first value second value]]
4041 */
4142
42- bmfmt.Beautify (m) // significant more friendly formatting
43+ err := bmfmt.Beautify (m) // significant more friendly formatting
44+ if err != nil {
45+ fmt.Println (" ERROR (bmfmt.Beautify): " + err.Error ())
46+ }
4347 /*
44- [ "some-key" string( 8) ]: "response" string( 8)
45- [ "Another-Hash-Key" string( 16) ]: "first value", "second value" string( 20 )
48+ [ "some-key" string( 8) ]: "response" string( 8)
49+ [ "Another-Hash-Key" string( 16) ]: "first value", "second value" string( 23 )
4650 */
4751
4852}
4953
50-
5154```
5255
5356## License
Original file line number Diff line number Diff line change 1+ package main
2+
3+ import (
4+ "fmt"
5+ bmfmt "github.com/c0de8/bmfmt"
6+ )
7+
8+ func main () {
9+ example ()
10+ }
11+
12+ func example () {
13+
14+ m := map [string ][]string {
15+ "some-key" : {"response" },
16+ "Another-Hash-Key" : {"first value" , "second value" },
17+ }
18+
19+ fmt .Println (m ) // fmt the default formatting
20+ /*
21+ map[some-key:[response] Another-Hash-Key:[first value second value]]
22+ */
23+
24+ err := bmfmt .Beautify (m ) // significant more friendly formatting
25+ if err != nil {
26+ fmt .Println ("ERROR (bmfmt.Beautify): " + err .Error ())
27+ }
28+ /*
29+ [ "some-key" string( 8) ]: "response" string( 8)
30+ [ "Another-Hash-Key" string( 16) ]: "first value", "second value" string( 23)
31+ */
32+
33+ }
You can’t perform that action at this time.
0 commit comments