Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

support ImportMap from go list -json' output #146

Closed
pagran opened this issue Sep 27, 2020 · 7 comments
Closed

support ImportMap from go list -json' output #146

pagran opened this issue Sep 27, 2020 · 7 comments
Assignees
Labels
bug Something isn't working

Comments

@pagran
Copy link
Member

pagran commented Sep 27, 2020

Part of #134

typecheck error: C:\Go\src\vendor\golang.org\x\crypto\chacha20\chacha_generic.go:15:2: could not import golang.org/x/crypto/internal/subtle (path not found in listed packages: golang.org/x/crypto/internal/subtle)

I suppose this error appears when the output `go list -json -deps' appears:

	"Imports": [
		"crypto/cipher",
		"encoding/binary",
		"...",
		"vendor/golang.org/x/crypto/internal/subtle",
		"math/bits",
		"runtime"
	],
	"ImportMap": {
		"golang.org/x/crypto/internal/subtle": "vendor/golang.org/x/crypto/internal/subtle". # important line
	},

Full output: https://gist.github.com/pagran/d2da864552406f3667f685baaa6deeac

@pagran pagran added the bug Something isn't working label Sep 27, 2020
@mvdan
Copy link
Member

mvdan commented Sep 27, 2020

Nice catch, I wasn't aware of ImportMap. Adding support for that shouldn't be too difficult, and we should be able to add a vendor.txt with a vendored import to test this.

@pagran
Copy link
Member Author

pagran commented Sep 28, 2020

If this is fixed, most likely, I can fix #134 + increase "buildability" of large projects.

@mvdan
Copy link
Member

mvdan commented Nov 8, 2020

I first assumed I could reproduce this by just vendoring dependencies, but go list -json -deps would still not include any ImportMap field. So I'm not sure how to minimally reproduce this edge case. I've raised golang/go#42446 upstream to try to actually understand when and why ImportMap shows up.

@mvdan mvdan changed the title path not found in listed packages support ImportMap from go list -json' output Nov 8, 2020
@mvdan
Copy link
Member

mvdan commented Nov 8, 2020

OK, I was able to reproduce. The cause was a package vendored in the standard library.

@mvdan
Copy link
Member

mvdan commented Nov 8, 2020

Alright, I fixed the first issue on our end, but now we're failing due to Binject/debug#17.

@capnspacehook
Copy link
Contributor

capnspacehook commented Nov 8, 2020

The only reason garble uses goobj2's ParseImportcfg function is because Binject/debug#13 isn't fixed right? Seems like the best solution might just be to fix that

@mvdan
Copy link
Member

mvdan commented Nov 8, 2020

Indeed.

lu4p pushed a commit that referenced this issue Nov 8, 2020
We also update the "original types importer" to support ImportMap.

The test now gets further along, no longer getting stuck on "path not
found in listed packages". Instead, we get stuck on:

	error parsing importcfg: <...>/importcfg:2: unknown directive "importmap"

This bug has been filed at Binject/debug#17.
Until it's fixed, we can't really proceed on #146, so the net import in
the test file (which triggers this case) is commented out for now.

Updates #146.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Development

No branches or pull requests

3 participants