Code Monkey home page Code Monkey logo

Comments (16)

danielvladco avatar danielvladco commented on September 27, 2024 1

I was able to reproduce the issue with go 1.16. I will fix it the following days.

Please use this command outside go module directory for now

 go install github.com/danielvladco/go-proto-gql/[email protected]

from go-proto-gql.

danielvladco avatar danielvladco commented on September 27, 2024 1

@DBL-Lee Please try the steps above and check if your issue is solved, if yes please close the issue

from go-proto-gql.

DBL-Lee avatar DBL-Lee commented on September 27, 2024 1

when I delete go.mod and go.sum and run go mod init on my existing directory, the following is what is in my go.mod.

go 1.16

require (
	google.golang.org/grpc v1.33.2
	google.golang.org/protobuf v1.26.0
)

Then I get the error:

 go get -t github.com/danielvladco/go-proto-gql/[email protected]
github.com/danielvladco/go-proto-gql/protoc-gen-gogql imports
	github.com/danielvladco/go-proto-gql/pkg/generator imports
	github.com/danielvladco/go-proto-gql/pb: ambiguous import: found package github.com/danielvladco/go-proto-gql/pb in multiple modules:
	github.com/danielvladco/go-proto-gql v0.8.2 (/Users/zichuan/go/pkg/mod/github.com/danielvladco/[email protected]/pb)
	github.com/danielvladco/go-proto-gql/pb v0.6.0 (/Users/zichuan/go/pkg/mod/github.com/danielvladco/go-proto-gql/[email protected])

However, after I manually delete the requires, the go get -t github.com/danielvladco/go-proto-gql/[email protected] succeeds! Even after adding back the two lines, it still works ๐ŸŽ‰

from go-proto-gql.

danielvladco avatar danielvladco commented on September 27, 2024

Can you show your go.mod?

from go-proto-gql.

DBL-Lee avatar DBL-Lee commented on September 27, 2024

Sure!

go 1.16

require (
	github.com/fullstorydev/grpcui v1.1.0 // indirect
	google.golang.org/grpc v1.36.1 // indirect
	google.golang.org/grpc/cmd/protoc-gen-go-grpc v1.1.0 // indirect
	google.golang.org/protobuf v1.26.0 // indirect
)

Thank you for the quick response

from go-proto-gql.

DBL-Lee avatar DBL-Lee commented on September 27, 2024

Running that still returns the same error. I will wait for your fix!

from go-proto-gql.

danielvladco avatar danielvladco commented on September 27, 2024

I pushed a new version today, check if it works with v0.8.1

from go-proto-gql.

danielvladco avatar danielvladco commented on September 27, 2024

If it still fails try:

go get -t github.com/danielvladco/go-proto-gql/protoc-gen-gogql
go install github.com/danielvladco/go-proto-gql/protoc-gen-gogql

from go-proto-gql.

DBL-Lee avatar DBL-Lee commented on September 27, 2024

Thank you for your updatee!

now go get fails with the following error:

go get -t github.com/danielvladco/go-proto-gql/protoc-gen-gogql

github.com/danielvladco/go-proto-gql/protoc-gen-gogql imports
	github.com/danielvladco/go-proto-gql/pkg/generator imports
	github.com/danielvladco/go-proto-gql/pb: ambiguous import: found package github.com/danielvladco/go-proto-gql/pb in multiple modules:
	github.com/danielvladco/go-proto-gql v0.8.2 (/Users/zichuan/go/pkg/mod/github.com/danielvladco/[email protected]/pb)
	github.com/danielvladco/go-proto-gql/pb v0.6.0 (/Users/zichuan/go/pkg/mod/github.com/danielvladco/go-proto-gql/[email protected])

from go-proto-gql.

danielvladco avatar danielvladco commented on September 27, 2024

for some reason your go compiler tries to find github.com/danielvladco/go-proto-gql/pb v0.6.0 which is a older package and no longer used in version 8.

Try cleaning all your cache:

go clean
go clean -modcache

from go-proto-gql.

DBL-Lee avatar DBL-Lee commented on September 27, 2024

Still facing the similar error after cleaning the mod cache๐Ÿค”

go get -t github.com/danielvladco/go-proto-gql/protoc-gen-gogql

go: downloading github.com/danielvladco/go-proto-gql v0.8.2
go: downloading google.golang.org/protobuf v1.26.0
go: downloading github.com/vektah/gqlparser v1.1.2
go: downloading github.com/jhump/protoreflect v1.8.2
go: downloading github.com/danielvladco/go-proto-gql/pb v0.6.0
go: downloading github.com/vektah/gqlparser/v2 v2.1.0
go: downloading github.com/golang/protobuf v1.5.2
go: downloading github.com/danielvladco/go-proto-gql/pb v0.6.1
github.com/danielvladco/go-proto-gql/protoc-gen-gogql imports
	github.com/danielvladco/go-proto-gql/pkg/generator imports
	github.com/danielvladco/go-proto-gql/pb: ambiguous import: found package github.com/danielvladco/go-proto-gql/pb in multiple modules:
	github.com/danielvladco/go-proto-gql v0.8.2 (/Users/zichuan/go/pkg/mod/github.com/danielvladco/[email protected]/pb)
	github.com/danielvladco/go-proto-gql/pb v0.6.0 (/Users/zichuan/go/pkg/mod/github.com/danielvladco/go-proto-gql/[email protected])

from go-proto-gql.

danielvladco avatar danielvladco commented on September 27, 2024

@DBL-Lee, this is weird, I cannot reproduce this issue... looks like it's a go mod problem

Check this issue, maybe it will help.
golang/go#44129

Also you can try using go 1.14 or 1.15 to see if the issue goes away

from go-proto-gql.

danielvladco avatar danielvladco commented on September 27, 2024

I am 90% sure this is because of a weird cache problem.
It tries to download an old package github.com/danielvladco/go-proto-gql/[email protected] that is no longer used.

if you install it on a fresh system if will not show you this error.

For example you could try to install it in docker and you will not see this error

$ docker run -it golang sh
$ mkdir test
$ cd test
$ go mod init test
$ go get -t github.com/danielvladco/go-proto-gql/[email protected]
$ go install github.com/danielvladco/go-proto-gql/protoc-gen-gogql

2 more things you can try

  • Delete ~/go/pkg/mod
  • Delete and regenerate go.sum

from go-proto-gql.

DBL-Lee avatar DBL-Lee commented on September 27, 2024

There appears to be a go.mod in my root directory which is causing this problem. Deleting it would make
go get -t github.com/danielvladco/go-proto-gql/protoc-gen-gogql succeed in a directory without go.mod.

But go install fails with

go install github.com/danielvladco/go-proto-gql/protoc-gen-gogql@master: github.com/danielvladco/[email protected]
	The go.mod file for the module providing named packages contains one or
	more replace directives. It must not contain directives that would cause
	it to be interpreted differently than if it were the main module.

I will try your suggestions! Thanks

from go-proto-gql.

DBL-Lee avatar DBL-Lee commented on September 27, 2024

I couldn't figure out how to solve this. I even deleted the entire ~/go/pkg and the error still persists. Since it works in docker, I guess I will build my protos in docker.

from go-proto-gql.

danielvladco avatar danielvladco commented on September 27, 2024

There appears to be a go.mod in my root directory which is causing this problem. Deleting it would make
go get -t github.com/danielvladco/go-proto-gql/protoc-gen-gogql succeed in a directory without go.mod.

But go install fails with

go install github.com/danielvladco/go-proto-gql/protoc-gen-gogql@master: github.com/danielvladco/[email protected]
	The go.mod file for the module providing named packages contains one or
	more replace directives. It must not contain directives that would cause
	it to be interpreted differently than if it were the main module.

I will try your suggestions! Thanks

This error is expected since I am using replacements but if you run go get -t github.com/danielvladco/go-proto-gql/[email protected] it will go away

Regenerating your go.sum might help, and make sure you don't have github.com/danielvladco/go-proto-gql/pb in your go.mod

from go-proto-gql.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.