Skip to content

Commit 81eef4d

Browse files
Upgrade to go 1.20 and deps update
Signed-off-by: Marcus Brandenburger <[email protected]> Apply gofmt formatting Signed-off-by: Marcus Brandenburger <[email protected]>
1 parent b413ca5 commit 81eef4d

File tree

57 files changed

+3960
-3277
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

57 files changed

+3960
-3277
lines changed

Makefile

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -40,9 +40,8 @@ gotools:
4040
# in 'utils/docker/base-dev/Dockerfile')
4141
$(GO) install golang.org/x/tools/cmd/goimports
4242
$(GO) install google.golang.org/protobuf/cmd/protoc-gen-go
43-
GO111MODULE=off $(GO) get github.com/maxbrunsfeld/counterfeiter
44-
$(GO) install honnef.co/go/tools/cmd/[email protected]
45-
$(GO) get -u github.com/client9/misspell/cmd/misspell
43+
$(GO) install honnef.co/go/tools/cmd/[email protected]
44+
$(GO) install github.com/client9/misspell/cmd/misspell
4645

4746
godeps: gotools
4847
$(GO) mod download

README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -255,7 +255,7 @@ Make sure that you have the following required dependencies installed:
255255

256256
* CMake v3.5.1 or higher
257257

258-
* [Go](https://golang.org/) 1.17.5 or higher
258+
* [Go](https://golang.org/) 1.20.x or higher
259259

260260
* Docker 18.09 (or higher) and docker-compose 1.25.x (or higher)
261261
Note that version from Ubuntu 18.04 is not recent enough! To upgrade, install a recent version following the instructions from [docker.com](https://docs.docker.com/compose/install/), e.g., for version 1.25.4 execute

client_sdk/go/doc.go

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@ SPDX-License-Identifier: Apache-2.0
1010
// The main goal is to ease the interaction with a FPC chaincode and provide similar experience as offered by normal
1111
// chaincode interaction.
1212
//
13-
// Packages for end developer usage
13+
// # Packages for end developer usage
1414
//
1515
// pkg/client/resmgmt: Provides resource management capabilities such as installing FPC chaincode.
1616
// Reference: https://godoc.org/github.com/hyperledger/fabric-private-chaincode/client_sdk/go/pkg/client/resmgmt
@@ -19,9 +19,8 @@ SPDX-License-Identifier: Apache-2.0
1919
// Fabric programming model.
2020
// Reference: https://godoc.org/github.com/hyperledger/fabric-private-chaincode/client_sdk/go/pkg/gateway
2121
//
22-
// Usage samples
22+
// # Usage samples
2323
//
2424
// $FPC_PATH/samples/application: Illustrates the use of the FPC Client SDK.
2525
// The sample applications can be used with our test-network `$FPC_PATH/samples/deployment/test-network`.
26-
//
2726
package fpcclientsdk

client_sdk/go/pkg/client/resmgmt/lifecycleclient.go

Lines changed: 18 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -11,32 +11,31 @@ SPDX-License-Identifier: Apache-2.0
1111
//
1212
// Example:
1313
//
14-
// adminContext := sdk.Context(fabsdk.WithUser(orgAdmin), fabsdk.WithOrg(orgName))
14+
// adminContext := sdk.Context(fabsdk.WithUser(orgAdmin), fabsdk.WithOrg(orgName))
1515
//
16-
// client, err := resmgmt.New(adminContext)
17-
// if err != nil {
18-
// log.Fatal(err)
19-
// }
16+
// client, err := resmgmt.New(adminContext)
17+
// if err != nil {
18+
// log.Fatal(err)
19+
// }
2020
//
21-
// attestationParams, err := sgx.CreateAttestationParamsFromEnvironment()
22-
// if err != nil {
23-
// log.Fatal(err)
24-
// }
21+
// attestationParams, err := sgx.CreateAttestationParamsFromEnvironment()
22+
// if err != nil {
23+
// log.Fatal(err)
24+
// }
2525
//
26-
// initReq := resmgmt.LifecycleInitEnclaveRequest{
27-
// ChaincodeID: "my-fpc-chaincode",
28-
// EnclavePeerEndpoint: "mypeer.myorg.example.com", // define the peer where we wanna init our enclave
29-
// AttestationParams: attestationParams,
30-
// }
26+
// initReq := resmgmt.LifecycleInitEnclaveRequest{
27+
// ChaincodeID: "my-fpc-chaincode",
28+
// EnclavePeerEndpoint: "mypeer.myorg.example.com", // define the peer where we wanna init our enclave
29+
// AttestationParams: attestationParams,
30+
// }
3131
//
32-
// initTxId, err := client.LifecycleInitEnclave("mychannel", initReq)
33-
// if err != nil {
34-
// log.Fatal(err)
35-
// }
32+
// initTxId, err := client.LifecycleInitEnclave("mychannel", initReq)
33+
// if err != nil {
34+
// log.Fatal(err)
35+
// }
3636
//
3737
// See also `lifecycle_test.go` and `$FPC_PATH/integration/client_sdk/go/utils/utils.go`
3838
// for a running example.
39-
//
4039
package resmgmt
4140

4241
import (

client_sdk/go/pkg/core/contract/contract.go

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -36,12 +36,13 @@ type Provider interface {
3636
}
3737

3838
// GetContract is the factory method for creating FPC Contract objects.
39-
// Parameters:
40-
// network is an initialized Fabric network object
41-
// chaincodeID is the ID of the target chaincode
4239
//
43-
// Returns:
44-
// The contractImpl object
40+
// Parameters:
41+
// network is an initialized Fabric network object
42+
// chaincodeID is the ID of the target chaincode
43+
//
44+
// Returns:
45+
// The contractImpl object
4546
func GetContract(p Provider, chaincodeID string) *contractImpl {
4647
ercc := p.GetContract("ercc")
4748
return New(p.GetContract(chaincodeID), ercc, nil, &crypto.EncryptionProviderImpl{

client_sdk/go/pkg/core/lifecycle/client.go

Lines changed: 18 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -11,32 +11,31 @@ SPDX-License-Identifier: Apache-2.0
1111
//
1212
// Example:
1313
//
14-
// adminContext := sdk.Context(fabsdk.WithUser(orgAdmin), fabsdk.WithOrg(orgName))
14+
// adminContext := sdk.Context(fabsdk.WithUser(orgAdmin), fabsdk.WithOrg(orgName))
1515
//
16-
// client, err := lifecycle.New(adminContext)
17-
// if err != nil {
18-
// log.Fatal(err)
19-
// }
16+
// client, err := lifecycle.New(adminContext)
17+
// if err != nil {
18+
// log.Fatal(err)
19+
// }
2020
//
21-
// attestationParams, err := sgx.CreateAttestationParamsFromEnvironment()
22-
// if err != nil {
23-
// log.Fatal(err)
24-
// }
21+
// attestationParams, err := sgx.CreateAttestationParamsFromEnvironment()
22+
// if err != nil {
23+
// log.Fatal(err)
24+
// }
2525
//
26-
// initReq := lifecycle.LifecycleInitEnclaveRequest{
27-
// ChaincodeID: "my-fpc-chaincode",
28-
// EnclavePeerEndpoint: "mypeer.myorg.example.com", // define the peer where we wanna init our enclave
29-
// AttestationParams: attestationParams,
30-
// }
26+
// initReq := lifecycle.LifecycleInitEnclaveRequest{
27+
// ChaincodeID: "my-fpc-chaincode",
28+
// EnclavePeerEndpoint: "mypeer.myorg.example.com", // define the peer where we wanna init our enclave
29+
// AttestationParams: attestationParams,
30+
// }
3131
//
32-
// initTxId, err := client.LifecycleInitEnclave("mychannel", initReq)
33-
// if err != nil {
34-
// log.Fatal(err)
35-
// }
32+
// initTxId, err := client.LifecycleInitEnclave("mychannel", initReq)
33+
// if err != nil {
34+
// log.Fatal(err)
35+
// }
3636
//
3737
// See also https://github.com/hyperledger/fabric-private-chaincode/blob/main/integration/client_sdk/go/utils.go
3838
// for a running example.
39-
//
4039
package lifecycle
4140

4241
import (

client_sdk/go/pkg/fab/ccpackager/packager.go

Lines changed: 12 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -12,17 +12,17 @@ Notice: This file is based on fabric-sdk-go/pkg/fab/ccpackager/lifecycle/package
1212
// Package ccpackager provides functionality to package a FPC chaincode.
1313
//
1414
// Example:
15-
// desc := &ccpackager.Descriptor{
16-
// Path: "/my_fpc_chaincode/build/_lib",
17-
// Type: ccpackager.ChaincodeType,
18-
// Label: "my-fpc-chaincode-v1",
19-
// SGXMode: "SIM",
20-
// }
21-
// ccPkg, err := ccpackager.NewCCPackage(desc)
22-
// if err != nil {
23-
// log.Fatal(err)
24-
// }
2515
//
16+
// desc := &ccpackager.Descriptor{
17+
// Path: "/my_fpc_chaincode/build/_lib",
18+
// Type: ccpackager.ChaincodeType,
19+
// Label: "my-fpc-chaincode-v1",
20+
// SGXMode: "SIM",
21+
// }
22+
// ccPkg, err := ccpackager.NewCCPackage(desc)
23+
// if err != nil {
24+
// log.Fatal(err)
25+
// }
2626
package ccpackager
2727

2828
import (
@@ -31,7 +31,7 @@ import (
3131
"compress/gzip"
3232
"encoding/json"
3333
"fmt"
34-
"io/ioutil"
34+
"os"
3535
"path/filepath"
3636
"strings"
3737

@@ -71,7 +71,7 @@ func NewCCPackage(desc *Descriptor) ([]byte, error) {
7171

7272
// ReadMrenclave returns mrenclave for the given FPC chaincode at ccPath
7373
func ReadMrenclave(ccPath string) (string, error) {
74-
mrenclave, err := ioutil.ReadFile(filepath.Join(ccPath, mrenclaveFileName))
74+
mrenclave, err := os.ReadFile(filepath.Join(ccPath, mrenclaveFileName))
7575
if err != nil {
7676
return "", err
7777
}

client_sdk/go/pkg/fab/ccpackager/packager_test.go

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,6 @@ SPDX-License-Identifier: Apache-2.0
77
package ccpackager_test
88

99
import (
10-
"io/ioutil"
1110
"os"
1211
"path/filepath"
1312
"testing"
@@ -173,7 +172,7 @@ var _ = Describe("Go Client SDK Test", func() {
173172
Expect(err).ShouldNot(HaveOccurred())
174173
Expect(payload).ShouldNot(BeNil())
175174

176-
err = ioutil.WriteFile("/tmp/pack.tar.gz", payload, 0644)
175+
err = os.WriteFile("/tmp/pack.tar.gz", payload, 0644)
177176
Expect(err).ShouldNot(HaveOccurred())
178177
})
179178
})

client_sdk/go/pkg/gateway/contract.go

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -82,12 +82,13 @@ func (cp *contractProvider) GetContract(id string) contract.Contract {
8282
}
8383

8484
// GetContract is the factory method for creating FPC Contract objects.
85-
// Parameters:
86-
// network is an initialized Fabric network object
87-
// chaincodeID is the ID of the target chaincode
8885
//
89-
// Returns:
90-
// The contract object
86+
// Parameters:
87+
// network is an initialized Fabric network object
88+
// chaincodeID is the ID of the target chaincode
89+
//
90+
// Returns:
91+
// The contract object
9192
func GetContract(network Network, chaincodeID string) Contract {
9293
return contract.GetContract(&contractProvider{network: network}, chaincodeID)
9394
}

client_sdk/go/pkg/sgx/attestation.go

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,6 @@ package sgx
1010
import (
1111
"encoding/base64"
1212
"encoding/json"
13-
"io/ioutil"
1413
"os"
1514
"path/filepath"
1615
"strings"
@@ -117,7 +116,7 @@ func ReadSigRL(sgxCredentialsPath string) (string, error) {
117116
}
118117

119118
func readFile(path string) (string, error) {
120-
content, err := ioutil.ReadFile(path)
119+
content, err := os.ReadFile(path)
121120
if err != nil {
122121
return "", errors.Wrapf(err, "could not read %s", path)
123122
}

0 commit comments

Comments
 (0)