hyperledger / hyperledger/fabric-contract-api-go

If the chaincode input and output functions have different packages but the same structure name then variable conflict issue in the chaincode

Open
#109 4 comments 0 reactions 0 assignees View on GitHub
Dominant language
Go
Stars
250
Forks
111
Avg merge
4h 48m
Merged PRs (30d)
7

Description

Using spec

- Mac Book Pro M1 Ventura v13.5.1
- Docker v24.0.6
- Hyperledger Fabric v2.5.3
- fabric-sdk-go v1.0.0
- fabric-contract-api-go v1.2.1
- fabric-chaincode-go v0.0.0-20230228194215-b84622ba6a7a

Literally, If the chaincode input and output functions have different packages but the same structure name then variable conflict issue in the chaincode.

Example

test1.go

```
package test1

type Test struct {
A string `json:”a”`
}
```

test.go

```
package test

import (
/test1
)

type Test struct {
B int `json:”b”`
}

func(s *Contract) Test1(ctx contranctapi. TranscationContextInterface) (test1.Test) {}
func(s *Contract) Test2(ctx contranctapi. TranscationContextInterface) (Test) {}
```

In the case above, if Test2 is called after calling Test1, ‘Test’, the output of Test2, is recognized as ‘test1.Test’

If the structure name is different, no conflict will occur.

Please reply after confirmantion.

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.