Skip to content

Commit

Permalink
docs: improve examples
Browse files Browse the repository at this point in the history
  • Loading branch information
mrinalwadhwa committed Nov 10, 2018
1 parent e1bdb0c commit 5e426a2
Showing 1 changed file with 6 additions and 6 deletions.
12 changes: 6 additions & 6 deletions example_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -12,26 +12,26 @@ func ExampleParse() {
if err != nil {
log.Fatal(err)
}
fmt.Printf("%#v", d)
// Output: &did.DID{Method:"example", ID:"q7ckgxeq1lxmra0r", IDStrings:[]string{"q7ckgxeq1lxmra0r"}, Path:"", PathSegments:[]string(nil), Fragment:""}
fmt.Printf("Method - %s, ID - %s", d.Method, d.ID)
// Output: Method - example, ID - q7ckgxeq1lxmra0r
}

func ExampleParse_withPath() {
d, err := did.Parse("did:example:q7ckgxeq1lxmra0r/a/b")
if err != nil {
log.Fatal(err)
}
fmt.Printf("%#v", d)
// Output: &did.DID{Method:"example", ID:"q7ckgxeq1lxmra0r", IDStrings:[]string{"q7ckgxeq1lxmra0r"}, Path:"a/b", PathSegments:[]string{"a", "b"}, Fragment:""}
fmt.Printf("Method - %s, ID - %s, Path - %s", d.Method, d.ID, d.Path)
// Output: Method - example, ID - q7ckgxeq1lxmra0r, Path - a/b
}

func ExampleParse_withFragment() {
d, err := did.Parse("did:example:q7ckgxeq1lxmra0r#keys-1")
if err != nil {
log.Fatal(err)
}
fmt.Printf("%#v", d)
// Output: &did.DID{Method:"example", ID:"q7ckgxeq1lxmra0r", IDStrings:[]string{"q7ckgxeq1lxmra0r"}, Path:"", PathSegments:[]string(nil), Fragment:"keys-1"}
fmt.Printf("Method - %s, ID - %s, Fragment - %s", d.Method, d.ID, d.Fragment)
// Output: Method - example, ID - q7ckgxeq1lxmra0r, Fragment - keys-1
}

func ExampleDID_String() {
Expand Down

0 comments on commit 5e426a2

Please sign in to comment.