Reputation: 213
I am getting this error when i am packaging my smart contract project in VS code IBM extendion
The Go smart contract is not a subdirectory of the path specified by the environment variable GOPATH. Please correct the environment variable GOPATH.
This is the image of my error and my path variables
https://i.sstatic.net/Hqbq1.jpg
Upvotes: 0
Views: 1074
Reputation: 5868
First you should confirm that vscode is picking up your GOPATH. If you open the terminal view in vscode and type
echo $GOPATH
to confirm the gopath matches. Then you need to open VSCode to the location of your Go chaincode which must be in the src
directory in your go workspace pointed to by your go path. For example here is my go chaincode project called testcc and the actual chaincode source is in mycc
└── testcc
├── bin
├── pkg
│ └── linux_amd64
└── src
├── github.com
├── golang.org
└── mycc
located at ~/mycode
. Therefore I would have a GOPATH of ~/mycode/testcc
and I would open vscode up at the mycc directory. For example I would launch vscode as follows
$ GOPATH=~/mycode/testcc code ~/mycode/testcc/src/mycc
Upvotes: 4