Problem importing local go packages into the chaincode #fabric


Prasanth Sundaravelu
 

That's exactly how I did it!. Thank you Tom :)


TomXuCNXA
 

Hi Prasanth
You can try govendor, or simply put all packages under proj/vendor folder, it should work, likes:

src/proj/
______chaincode.go
______vendor/
__________[other packages]

Thanks,
Tom Xu


Nye Liu <nye@...>
 

Golang does not allow relative imports.

On 3/4/2019 10:01 AM, Prasanth Sundaravelu wrote:
Hi guys,

I have a problem when I try to import a local go file into the main chaincode file.
This is my project structure:
- Main file: $GOPATH/src/proj/chaincode.go
- File that I want to import: $GOPATH/src/proj/util/util.go

util.go has been updated with package name: "util" and in chaincode.go,
Tried:
- import "proj/util"
- import "src/proj/util"
-import "./util"

When I try to install this, I get this error:

"Error: could not assemble transaction, err proposal response was
not successful, error code 500, msg cannot get package for
chaincode (mycc:1.0)"


Any help really appreciated. Thanks.


Prasanth Sundaravelu
 

Hi guys,

I have a problem when I try to import a local go file into the main chaincode file.
This is my project structure:
- Main file: $GOPATH/src/proj/chaincode.go
- File that I want to import: $GOPATH/src/proj/util/util.go

util.go has been updated with package name: "util" and in chaincode.go,
Tried:
- import "proj/util"
- import "src/proj/util"
-import "./util"

When I try to install this, I get this error: 
"Error: could not assemble transaction, err proposal response was not successful, error code 500, msg cannot get package for chaincode (mycc:1.0)"

Any help really appreciated. Thanks.