Skip to content

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

Open
@JungHyeokChoi

Description

@JungHyeokChoi

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 (
   <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.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions