-
Notifications
You must be signed in to change notification settings - Fork 7
docs: add examples for NewStoreFromDocker and NewStoreWithFallbacks #55
Conversation
Codecov Report
📣 This organization is not using Codecov’s GitHub App Integration. We recommend you install it so Codecov can continue to function properly for your repositories. Learn more @@ Coverage Diff @@
## main #55 +/- ##
=======================================
Coverage 81.13% 81.13%
=======================================
Files 6 6
Lines 371 371
=======================================
Hits 301 301
Misses 48 48
Partials 22 22
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM
example_test.go
Outdated
) | ||
|
||
func ExampleNewStoreFromDocker() { | ||
ds, err := credentials.NewStoreFromDocker(credentials.StoreOptions{AllowPlaintextPut: true}) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Let's format the code in standard go style.
ds, err := credentials.NewStoreFromDocker(credentials.StoreOptions{AllowPlaintextPut: true}) | |
ds, err := credentials.NewStoreFromDocker(credentials.StoreOptions{ | |
AllowPlaintextPut: true, | |
}) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
same for the other example
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
changed.
example_test.go
Outdated
err = ds.Put(context.Background(), "localhost:8080", | ||
auth.Credential{ | ||
Username: "username-example", | ||
Password: "password-example"}) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
err = ds.Put(context.Background(), "localhost:8080", | |
auth.Credential{ | |
Username: "username-example", | |
Password: "password-example"}) | |
err = ds.Put(context.Background(), "localhost:8080", auth.Credential{ | |
Username: "username-example", | |
Password: "password-example", | |
}) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
same for the other example
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
changed.
example_test.go
Outdated
// get credentials from the store | ||
cred, err := sf.Get(context.Background(), "localhost:8080") | ||
if err != nil { | ||
panic(err) | ||
} | ||
fmt.Println(cred) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Getting from fallback store is not demonstrated.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Changed the function name to ExampleNewStoreWithFallbacks_configAsPrimaryStoreDockerAsFallback
to demonstrate the scenario.
Signed-off-by: Xiaoxuan Wang <[email protected]>
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM
Resolves #49