Skip to content

Commit c604f4f

Browse files
committed
Remove explicit exclusion of chaincode, protos
FAB-15732 Change-Id: I0fcc10151c61c909aa5ce415f20b3bc8b143e1e8 Signed-off-by: Matthew Sykes <sykesmat@us.ibm.com>
1 parent b54bd65 commit c604f4f

File tree

2 files changed

+10
-22
lines changed

2 files changed

+10
-22
lines changed

core/chaincode/platforms/golang/platform.go

Lines changed: 0 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -254,26 +254,12 @@ func (p *Platform) GetDeploymentPayload(path string) ([]byte, error) {
254254
return nil, fmt.Errorf("Error obtaining imports: %s", err)
255255
}
256256

257-
// --------------------------------------------------------------------------------------
258-
// Remove any imports that are provided by the ccenv or system
259-
// --------------------------------------------------------------------------------------
260-
var provided = map[string]bool{
261-
"github.com/hyperledger/fabric/core/chaincode/shim": true,
262-
"github.com/hyperledger/fabric/protos/peer": true,
263-
}
264-
265257
// Golang "pseudo-packages" - packages which don't actually exist
266258
var pseudo = map[string]bool{
267259
"C": true,
268260
}
269261

270262
imports = filter(imports, func(pkg string) bool {
271-
// Drop if provided by CCENV
272-
if _, ok := provided[pkg]; ok == true {
273-
logger.Debugf("Discarding provided package %s", pkg)
274-
return false
275-
}
276-
277263
// Drop pseudo-packages
278264
if _, ok := pseudo[pkg]; ok == true {
279265
logger.Debugf("Discarding pseudo-package %s", pkg)

core/chaincode/platforms/golang/platform_test.go

Lines changed: 10 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -236,7 +236,9 @@ func updateGopath(t *testing.T, path string) func() {
236236
}
237237

238238
func TestGetDeploymentPayload(t *testing.T) {
239-
testdataPath, err := filepath.Abs("testdata")
239+
const testdata = "github.com/hyperledger/fabric/core/chaincode/platforms/golang/testdata/src/"
240+
241+
gopath, err := getGopath()
240242
require.NoError(t, err)
241243

242244
platform := &Platform{}
@@ -246,13 +248,13 @@ func TestGetDeploymentPayload(t *testing.T) {
246248
path string
247249
succ bool
248250
}{
249-
{gopath: testdataPath, path: "chaincodes/noop", succ: true},
250-
{gopath: testdataPath, path: "bad/chaincodes/noop", succ: false},
251-
{gopath: testdataPath, path: "chaincodes/BadImport", succ: false},
252-
{gopath: testdataPath, path: "chaincodes/BadMetadataInvalidIndex", succ: false},
253-
{gopath: testdataPath, path: "chaincodes/BadMetadataUnexpectedFolderContent", succ: false},
254-
{gopath: testdataPath, path: "chaincodes/BadMetadataIgnoreHiddenFile", succ: true},
255-
{gopath: testdataPath, path: "chaincodes/empty/", succ: false},
251+
{gopath: gopath, path: testdata + "chaincodes/noop", succ: true},
252+
{gopath: gopath, path: testdata + "bad/chaincodes/noop", succ: false},
253+
{gopath: gopath, path: testdata + "chaincodes/BadImport", succ: false},
254+
{gopath: gopath, path: testdata + "chaincodes/BadMetadataInvalidIndex", succ: false},
255+
{gopath: gopath, path: testdata + "chaincodes/BadMetadataUnexpectedFolderContent", succ: false},
256+
{gopath: gopath, path: testdata + "chaincodes/BadMetadataIgnoreHiddenFile", succ: true},
257+
{gopath: gopath, path: testdata + "chaincodes/empty/", succ: false},
256258
}
257259

258260
for _, tst := range tests {

0 commit comments

Comments
 (0)