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

opencensus dependency issue with Go 1.13 #449

Closed
vcabbage opened this issue Aug 13, 2019 · 5 comments
Closed

opencensus dependency issue with Go 1.13 #449

vcabbage opened this issue Aug 13, 2019 · 5 comments

Comments

@vcabbage
Copy link

vcabbage commented Aug 13, 2019

When using this library with Go 1.13 (currently in beta), the following error is presented:

go: github.com/Azure/go-autorest/autorest@v0.8.0 requires
        github.com/Azure/go-autorest/tracing@v0.4.0 requires
        contrib.go.opencensus.io/exporter/ocagent@v0.4.6 requires
        github.com/census-instrumentation/opencensus-proto@v0.1.0-0.20181214143942-ba49f56771b8: invalid pseudo-version: version before v0.1.0 would have negative patch number

The pseudo-version referenced in contrib.go.opencensus.io/exporter/ocagent@v0.4.6's go.mod is considered invalid, but Go 1.12 and earlier don't check for it.

contrib.go.opencensus.io/exporter/ocagent v0.4.7 does reference a valid version for github.com/census-instrumentation/opencensus-proto.

If the dependency has already been cached by Go 1.12 the error doesn't present itself. To reproduce you can clear your module cache or use the golang:1.13beta1 docker container.

docker run -it --rm golang:1.13beta1
mkdir /test && cd /test && go mod init test
cat << EOF > main.go
package main

import _ "github.com/Azure/go-autorest/autorest"

func main() {}
EOF
go run .

I'm currently working around this by using a replace:

replace contrib.go.opencensus.io/exporter/ocagent => contrib.go.opencensus.io/exporter/ocagent v0.4.7
@vcabbage
Copy link
Author

vcabbage commented Aug 13, 2019

For anyone who happens across this issue, a more conservative replace would be:

replace github.com/census-instrumentation/opencensus-proto v0.1.0-0.20181214143942-ba49f56771b8 => github.com/census-instrumentation/opencensus-proto v0.0.3-0.20181214143942-ba49f56771b8

Which only fixes up the specific incorrect pseudo-version instead of upgrading a dependency.

@bcmills
Copy link

bcmills commented Aug 13, 2019

Note that you could achieve an effect equivalent to the ocagent replacement more robustly with:

require contrib.go.opencensus.io/exporter/ocagent v0.4.7

replace github.com/census-instrumentation/opencensus-proto v0.1.0-0.20181214143942-ba49f56771b8 => github.com/census-instrumentation/opencensus-proto v0.0.3-0.20181214143942-ba49f56771b8

That way, your build won't break if some future go get or import adds a (transitive) dependency on a feature added in ocagent v0.5.0 or later.

@jhendrixMSFT
Copy link
Member

jhendrixMSFT commented Aug 15, 2019

The dependencies on the various opencensus modules have been moved to the opencensus module which is not included by default, making it pay-for-play (see the CHANGELOG for details). If you don't need/want these opencensus dependencies can you please move to the latest version of the autorest module (and any others you're consuming from this repo)?

@vcabbage
Copy link
Author

@jhendrixMSFT Thank you! (btw, there's a small typo in CHANGELOG, should be import instead of include.)

@jhendrixMSFT
Copy link
Member

Oops I'll fix that in my next change. This should now be fixed, please let me know if you have further problems.

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