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

go mod error #115

Open
rew1nter opened this issue Jul 26, 2023 · 2 comments
Open

go mod error #115

rew1nter opened this issue Jul 26, 2023 · 2 comments

Comments

@rew1nter
Copy link

This is the error Im getting upon running go mod tidy:

go: found github.com/smacker/go-tree-sitter/javascript in github.com/smacker/go-tree-sitter/javascript v0.0.1
xd imports
        github.com/smacker/go-tree-sitter/javascript: ambiguous import: found package github.com/smacker/go-tree-sitter/javascript in multiple modules:
        github.com/smacker/go-tree-sitter v0.0.0-20230720070738-0d0a9f78d8f8 (/drive/go/pkg/mod/github.com/smacker/go-tree-sitter@v0.0.0-20230720070738-0d0a9f78d8f8/javascript)
        github.com/smacker/go-tree-sitter/javascript v0.0.1 (/drive/go/pkg/mod/github.com/smacker/go-tree-sitter/javascript@v0.0.1)

@natb1
Copy link

natb1 commented Feb 6, 2024

I had to pin the first option in the go.mod (add the line github.com/smacker/go-tree-sitter v0.0.0-20230720070738-0d0a9f78d8f8 in your example). This might be common go knowledge but I hadn't run into it before either.

@rubencaro
Copy link

I get the same error:

github.com/smacker/go-tree-sitter/javascript: ambiguous import: found package github.com/smacker/go-tree-sitter/javascript in multiple modules:
github.com/smacker/go-tree-sitter v0.0.0-20240514083259-c5d1f3f5f99e (/home/ruben/.asdf/installs/golang/1.22.2/packages/pkg/mod/github.com/smacker/go-tree-sitter@v0.0.0-20240514083259-c5d1f3f5f99e/javascript)
github.com/smacker/go-tree-sitter/javascript v0.0.1 (/home/ruben/.asdf/installs/golang/1.22.2/packages/pkg/mod/github.com/smacker/go-tree-sitter/javascript@v0.0.1)

The problem is that a module for the javascript parser for version 0.0.1 exists in the proxy service (see here https://pkg.go.dev/github.com/smacker/go-tree-sitter/javascript), so go mod tidy will see that one too. The source for that module is not there anymore (now it's just a package), but it looks like it was there at some point, and it is still cached in the proxy.

A workaround is just to deactivate the proxy and go directly to the source (github in this case):

$ GOPROXY=direct go mod tidy
go: finding module for package github.com/smacker/go-tree-sitter/javascript
go: finding module for package github.com/smacker/go-tree-sitter
go: found github.com/smacker/go-tree-sitter in github.com/smacker/go-tree-sitter v0.0.0-20240514083259-c5d1f3f5f99e
go: found github.com/smacker/go-tree-sitter/javascript in github.com/smacker/go-tree-sitter v0.0.0-20240514083259-c5d1f3f5f99e

@smacker do you know the way to get that module out of the proxy? It will be there annoying forever...

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants