Skip to content
This repository has been archived by the owner on Jan 31, 2023. It is now read-only.

Extension doesn't correctly package a Go chaincode on windows #3087

Closed
davidkel opened this issue Jan 13, 2022 · 3 comments
Closed

Extension doesn't correctly package a Go chaincode on windows #3087

davidkel opened this issue Jan 13, 2022 · 3 comments
Labels
bug Something isn't working wontfix This will not be worked on

Comments

@davidkel
Copy link

davidkel commented Jan 13, 2022

Packaging a go chaincode to a tar.gz file cannot be deployed as the contents have the wrong path separators

Description

I had this problem with my own chaincode but as a test I created a new go contract using the new project command and tried to package it. exporting it to a linux system and using tar to first unpack the chaincode package to get to the code.tar.gz then unpacking the code.tar.gz you see that all the file names have been changed and everything unpacks to the root directory

src\\FixedAssetContract.go
src\\go.mod
src\\go.sum
src\\assets\\FixedAsset.go
src\\utils\\QueryResponse.go
src\\utils\\ResponseMetadata.go
src\\vendor\\google.golang.org\\grpc\\backoff.go
src\\vendor\\google.golang.org\\grpc\\balancer.go
src\\vendor\\google.golang.org\\grpc\\balancer_conn_wrappers.go
src\\vendor\\google.golang.org\\grpc\\balancer_v1_wrapper.go
src\\vendor\\google.golang.org\\grpc\\call.go
src\\vendor\\google.golang.org\\grpc\\clientconn.go
src\\vendor\\google.golang.org\\grpc\\codec.go
src\\vendor\\google.golang.org\\grpc\\dialoptions.go
src\\vendor\\google.golang.org\\grpc\\doc.go
src\\vendor\\google.golang.org\\grpc\\go.mod
src\\vendor\\google.golang.org\\grpc\\go.sum
src\\vendor\\google.golang.org\\grpc\\interceptor.go
src\\vendor\\google.golang.org\\grpc\\picker_wrapper.go
src\\vendor\\google.golang.org\\grpc\\pickfirst.go
src\\vendor\\google.golang.org\\grpc\\preloader.go
src\\vendor\\google.golang.org\\grpc\\proxy.go
src\\vendor\\google.golang.org\\grpc\\resolver_conn_wrapper.go

Expected Behavior

a package that can be deployed to a fabric network

Actual Behavior

The package is unusable

Your Environment

  • IBM Blockchain Platform Extension Version: 2.0.6
  • Visual Studio Code version: 1.63.2
  • Operating System and version: Windows 10 Enterprise
  • Extension running in windows (ie not running in a WSL2 instance)

Workaround

VSCode allows for extensions to be run inside of WSL using the remote WSL package. You can run the IBM Blockchain extension in WSL instead in order to package a Go chaincode, however that will change the dynamics of how you might run the extensions local fabric environments

@jt-nti jt-nti added the bug Something isn't working label Jan 13, 2022
@jt-nti
Copy link
Contributor

jt-nti commented Mar 18, 2022

This could be due to the use of the path module in Golang.ts - I've not tried but importing the POSIX specific path property might help.

@gsteri1
Copy link

gsteri1 commented Jun 23, 2022

I am on Windows 10. I did a fresh install. I created a local network and then created a boilerplate project. Same issue with the double \, moreover, the tar'd files that my colleagues generate do not have the 'vendor' folder (they are on a mac). None of my contracts deploy locally or remotely.

The BasePackager.ts is my suspicion on the first count:
Here is what is there:
const desc = {
name: path.join('META-INF', path.relative(filePath, entry.path)).split('\').join('/'),
fqp: entry.path
};
perhaps:
const desc = {
name: path.join('META-INF', path.relative(filePath, entry.path)).split('\').join('/'),
fqp: entry.path.split('\').join('/')
};

is what the doctor ordered for this part.

@jt-nti jt-nti added the wontfix This will not be worked on label Dec 13, 2022
@jt-nti
Copy link
Contributor

jt-nti commented Dec 13, 2022

See #3183

@jt-nti jt-nti closed this as completed Dec 13, 2022
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
bug Something isn't working wontfix This will not be worked on
Projects
None yet
Development

No branches or pull requests

3 participants