Skip to content

Commit

Permalink
[FAB-10518] Printf missing new lines
Browse files Browse the repository at this point in the history
Change-Id: If53d31c73088fcc5d83378c01683dc3ebdbf013c
Signed-off-by: Troy Ronda <troy@troyronda.com>
  • Loading branch information
troyronda committed Jun 1, 2018
1 parent 81694dd commit df181da
Show file tree
Hide file tree
Showing 11 changed files with 76 additions and 76 deletions.
6 changes: 3 additions & 3 deletions pkg/client/channel/example_test.go
Expand Up @@ -22,7 +22,7 @@ func Example() {

response, err := c.Query(Request{ChaincodeID: "testCC", Fcn: "invoke", Args: [][]byte{[]byte("query"), []byte("data")}})
if err != nil {
fmt.Printf("failed to query chaincode: %s", err)
fmt.Printf("failed to query chaincode: %s\n", err)
}

fmt.Println(string(response.Payload))
Expand Down Expand Up @@ -58,7 +58,7 @@ func ExampleClient_Query() {

response, err := c.Query(Request{ChaincodeID: "testCC", Fcn: "invoke", Args: [][]byte{[]byte("query"), []byte("b")}})
if err != nil {
fmt.Printf("failed to query chaincode: %s", err)
fmt.Printf("failed to query chaincode: %s\n", err)
}

if len(response.Payload) > 0 {
Expand Down Expand Up @@ -113,7 +113,7 @@ func ExampleClient_InvokeHandler() {

response, err := c.InvokeHandler(&exampleHandler{}, Request{ChaincodeID: "testCC", Fcn: "invoke", Args: [][]byte{[]byte("query"), []byte("data")}})
if err != nil {
fmt.Printf("failed to query chaincode: %s", err)
fmt.Printf("failed to query chaincode: %s\n", err)
}

fmt.Println(string(response.Payload))
Expand Down
2 changes: 1 addition & 1 deletion pkg/client/event/example_test.go
Expand Up @@ -28,7 +28,7 @@ func Example() {

select {
case ccEvent := <-notifier:
fmt.Printf("received chaincode event %v", ccEvent)
fmt.Printf("received chaincode event %v\n", ccEvent)
case <-time.After(time.Second * 5):
fmt.Println("timeout while waiting for chaincode event")
}
Expand Down
26 changes: 13 additions & 13 deletions pkg/client/ledger/example_test.go
Expand Up @@ -27,7 +27,7 @@ func Example() {

block, err := c.QueryBlock(1)
if err != nil {
fmt.Printf("failed to query block: %v", err)
fmt.Printf("failed to query block: %s\n", err)
}

if block != nil {
Expand Down Expand Up @@ -98,7 +98,7 @@ func ExampleWithParentContext() {

bci, err := c.QueryInfo(WithParentContext(parentContext))
if err != nil {
fmt.Printf("failed to query for blockchain info: %v", err)
fmt.Printf("failed to query for blockchain info: %s\n", err)
}

if bci != nil {
Expand All @@ -117,11 +117,11 @@ func ExampleWithTargets() {

cfg, err := c.QueryConfig(WithTargets(mockPeerWithConfigBlock()))
if err != nil {
fmt.Printf("failed to query config with target peer: %v", err)
fmt.Printf("failed to query config with target peer: %s\n", err)
}

if cfg != nil {
fmt.Printf("Retrieved config from target peer")
fmt.Println("Retrieved config from target peer")
}

// Output: Retrieved config from target peer
Expand All @@ -136,7 +136,7 @@ func ExampleWithTargetFilter() {

block, err := c.QueryBlock(1, WithTargetFilter(&urlTargetFilter{url: "example.com"}))
if err != nil {
fmt.Printf("failed to query block: %v", err)
fmt.Printf("failed to query block: %s\n", err)
}

if block != nil {
Expand All @@ -155,7 +155,7 @@ func ExampleClient_QueryInfo() {

bci, err := c.QueryInfo()
if err != nil {
fmt.Printf("failed to query for blockchain info: %v", err)
fmt.Printf("failed to query for blockchain info: %s\n", err)
}

if bci != nil {
Expand All @@ -174,7 +174,7 @@ func ExampleClient_QueryBlock() {

block, err := c.QueryBlock(1)
if err != nil {
fmt.Printf("failed to query block: %v", err)
fmt.Printf("failed to query block: %s\n", err)
}

if block != nil {
Expand All @@ -193,7 +193,7 @@ func ExampleClient_QueryBlockByHash() {

block, err := c.QueryBlockByHash([]byte("hash"))
if err != nil {
fmt.Printf("failed to query block by hash: %v", err)
fmt.Printf("failed to query block by hash: %s\n", err)
}

if block != nil {
Expand All @@ -212,7 +212,7 @@ func ExampleClient_QueryBlockByTxID() {

block, err := c.QueryBlockByTxID("123")
if err != nil {
fmt.Printf("failed to query block by transaction ID: %v", err)
fmt.Printf("failed to query block by transaction ID: %s\n", err)
}

if block != nil {
Expand All @@ -231,11 +231,11 @@ func ExampleClient_QueryTransaction() {

t, err := c.QueryTransaction("123")
if err != nil {
fmt.Printf("failed to query transaction: %v", err)
fmt.Printf("failed to query transaction: %s\n", err)
}

if t != nil {
fmt.Printf("Retrieved transaction")
fmt.Println("Retrieved transaction")
}

// Output: Retrieved transaction
Expand All @@ -250,11 +250,11 @@ func ExampleClient_QueryConfig() {

cfg, err := c.QueryConfig(WithTargets(mockPeerWithConfigBlock()))
if err != nil {
fmt.Printf("failed to query config: %v", err)
fmt.Printf("failed to query config: %s\n", err)
}

if cfg != nil {
fmt.Printf("Retrieved channel configuration")
fmt.Println("Retrieved channel configuration")
}

// Output: Retrieved channel configuration
Expand Down
46 changes: 23 additions & 23 deletions pkg/client/msp/example_test.go
Expand Up @@ -28,13 +28,13 @@ func Example() {

enrollmentSecret, err := c.Register(&RegistrationRequest{Name: username})
if err != nil {
fmt.Printf("Register return error %s", err)
fmt.Printf("Register return error %s\n", err)
return
}

err = c.Enroll(username, WithSecret(enrollmentSecret))
if err != nil {
fmt.Printf("failed to enroll user: %s", err)
fmt.Printf("failed to enroll user: %s\n", err)
return
}
fmt.Println("enroll user is completed")
Expand Down Expand Up @@ -92,7 +92,7 @@ func ExampleWithSecret() {

err = c.Enroll(randomUsername(), WithSecret("enrollmentSecret"))
if err != nil {
fmt.Printf("failed to enroll user: %s", err)
fmt.Printf("failed to enroll user: %s\n", err)
return
}
fmt.Println("enroll user is completed")
Expand All @@ -114,7 +114,7 @@ func ExampleClient_Register() {

_, err = c.Register(&RegistrationRequest{Name: randomUsername()})
if err != nil {
fmt.Printf("Register return error %s", err)
fmt.Printf("Register return error %s\n", err)
return
}
fmt.Println("register user is completed")
Expand All @@ -135,7 +135,7 @@ func ExampleClient_Enroll() {

err = c.Enroll(randomUsername(), WithSecret("enrollmentSecret"))
if err != nil {
fmt.Printf("failed to enroll user: %s", err)
fmt.Printf("failed to enroll user: %s\n", err)
return
}
fmt.Println("enroll user is completed")
Expand All @@ -158,13 +158,13 @@ func ExampleClient_Reenroll() {

err = c.Enroll(username, WithSecret("enrollmentSecret"))
if err != nil {
fmt.Printf("failed to enroll user: %s", err)
fmt.Printf("failed to enroll user: %s\n", err)
return
}

err = c.Reenroll(username)
if err != nil {
fmt.Printf("failed to reenroll user: %s", err)
fmt.Printf("failed to reenroll user: %s\n", err)
return
}

Expand All @@ -189,17 +189,17 @@ func ExampleClient_GetSigningIdentity() {

err = c.Enroll(username, WithSecret("enrollmentSecret"))
if err != nil {
fmt.Printf("failed to enroll user: %s", err)
fmt.Printf("failed to enroll user: %s\n", err)
return
}
enrolledUser, err := c.GetSigningIdentity(username)
if err != nil {
fmt.Printf("user not found %s", err)
fmt.Printf("user not found %s\n", err)
return
}

if enrolledUser.Identifier().ID != username {
fmt.Printf("Enrolled user name doesn't match")
fmt.Println("Enrolled user name doesn't match")
return
}

Expand All @@ -221,7 +221,7 @@ func ExampleClient_Revoke() {

_, err = c.Revoke(&RevocationRequest{Name: "testuser"})
if err != nil {
fmt.Printf("revoke return error %s", err)
fmt.Printf("revoke return error %s\n", err)
}
fmt.Println("revoke user is completed")

Expand All @@ -239,10 +239,10 @@ func ExampleWithCA() {

results, err := c.GetAllIdentities(WithCA("CA"))
if err != nil {
fmt.Printf("Get identities return error %s", err)
fmt.Printf("Get identities return error %s\n", err)
return
}
fmt.Printf("%d identities retrieved", len(results))
fmt.Printf("%d identities retrieved\n", len(results))

// Output: 2 identities retrieved
}
Expand All @@ -259,10 +259,10 @@ func ExampleClient_CreateIdentity() {
identity, err := c.CreateIdentity(&IdentityRequest{ID: "123", Affiliation: "org2",
Attributes: []Attribute{{Name: "attName1", Value: "attValue1"}}})
if err != nil {
fmt.Printf("Create identity return error %s", err)
fmt.Printf("Create identity return error %s\n", err)
return
}
fmt.Printf("identity '%s' created", identity.ID)
fmt.Printf("identity '%s' created\n", identity.ID)

// Output: identity '123' created
}
Expand All @@ -278,10 +278,10 @@ func ExampleClient_ModifyIdentity() {

identity, err := c.ModifyIdentity(&IdentityRequest{ID: "123", Affiliation: "org2", Secret: "top-secret"})
if err != nil {
fmt.Printf("Modify identity return error %s", err)
fmt.Printf("Modify identity return error %s\n", err)
return
}
fmt.Printf("identity '%s' modified", identity.ID)
fmt.Printf("identity '%s' modified\n", identity.ID)

// Output: identity '123' modified
}
Expand All @@ -297,10 +297,10 @@ func ExampleClient_RemoveIdentity() {

identity, err := c.RemoveIdentity(&RemoveIdentityRequest{ID: "123"})
if err != nil {
fmt.Printf("Remove identity return error %s", err)
fmt.Printf("Remove identity return error %s\n", err)
return
}
fmt.Printf("identity '%s' removed", identity.ID)
fmt.Printf("identity '%s' removed\n", identity.ID)

// Output: identity '123' removed
}
Expand All @@ -316,10 +316,10 @@ func ExampleClient_GetIdentity() {

identity, err := c.GetIdentity("123")
if err != nil {
fmt.Printf("Get identity return error %s", err)
fmt.Printf("Get identity return error %s\n", err)
return
}
fmt.Printf("identity '%s' retrieved", identity.ID)
fmt.Printf("identity '%s' retrieved\n", identity.ID)

// Output: identity '123' retrieved
}
Expand All @@ -335,10 +335,10 @@ func ExampleClient_GetAllIdentities() {

results, err := c.GetAllIdentities()
if err != nil {
fmt.Printf("Get identities return error %s", err)
fmt.Printf("Get identities return error %s\n", err)
return
}
fmt.Printf("%d identities retrieved", len(results))
fmt.Printf("%d identities retrieved\n", len(results))

// Output: 2 identities retrieved
}
Expand Down

0 comments on commit df181da

Please sign in to comment.