hyperledger / fabric-sdk-go

https://wiki.hyperledger.org/display/fabric
Apache License 2.0
910 stars 510 forks source link

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

Closed JungHyeokChoi closed 8 months ago

JungHyeokChoi commented 8 months ago

Using spec

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 (
   <path to>/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.

JungHyeokChoi commented 8 months ago

I’m so sorrry. i’m mistake project.