xo / usql

Universal command-line interface for SQL databases
MIT License
8.94k stars 352 forks source link

Cannot build usql #256

Closed msvitok77 closed 3 years ago

msvitok77 commented 3 years ago

I'm getting an error while trying to build usql 0.9.0 $ go get github.com/xo/usql go get: github.com/xo/usql@v0.6.0 updating to github.com/xo/usql@v0.9.0 requires sqlflow.org/gomaxcompute@v0.0.0-20200410041603-30fa752b7593 requires github.com/myesui/uuid@v1.0.0: reading github.com/myesui/uuid/go.mod at revision v1.0.0: unknown revision v1.0.0

can you fix it please? Thanks.

nineinchnick commented 3 years ago

Looks like a duplicate of #250

msvitok77 commented 3 years ago

Well I did remove the go.mod, go.sum, but after that you need to do go mod init xxxx. Even though I'm still getting: $ go build go: sqlflow.org/gomaxcompute@v0.0.0-20200410041603-30fa752b7593 requires github.com/myesui/uuid@v1.0.0: reading github.com/myesui/uuid/go.mod at revision v1.0.0: unknown revision v1.0.0

nineinchnick commented 3 years ago

I found similar issues in other repositories where people report that github.com/myesui/uuid has been removed. The most similar one is this: https://github.com/ProtonMail/proton-bridge/issues/163 We should report this issue to https://github.com/sql-machine-learning/gomaxcompute so they can fix their dependencies.

nineinchnick commented 3 years ago

When you call go build, you could add -tags 'no_maxcompute'.

msvitok77 commented 3 years ago

Hmm it's weird. I can seen that tag in maxcompute.go: // +build all,!no_maxcompute most,!no_maxcompute maxcompute,!no_maxcompute it's generated code... however is it correct? Anyway it didn't help: $ go build -tags no_maxcompute go: sqlflow.org/gomaxcompute@v0.0.0-20200410041603-30fa752b7593 requires github.com/myesui/uuid@v1.0.0: reading github.com/myesui/uuid/go.mod at revision v1.0.0: unknown revision v1.0.0

kenshaw commented 3 years ago

@yshadow You likely need to update your Go version, as well as make sure you're not doing that from within a directory that has a go.mod file. If you are seeing this issue, you should be able to do go get github.com/xo/usql@latest and then a go mod tidy to fix the module entries. If those don't work, please check your other environment variables, by using the go env command. There's a chance you have some configuration there that is causing a conflict.

nineinchnick commented 3 years ago

@kenshaw I don't think we should close this one. github.com/myesui/uuid is gone but it's still being cached in proxy.golang.org. I don't know if it has a TTL, but it will become a problem for all users at some point.

This is reproducible if you set export GOPROXY=direct and remove that package from ~/go/pkg/mod.

For the time being, can we make maxcompute optional?

nineinchnick commented 3 years ago

I also just noticed that there's no LICENSE in https://github.com/sql-machine-learning/gomaxcompute. I'm not sure if we care, but I wouldn't use such module.

Reported as https://github.com/sql-machine-learning/gomaxcompute/issues/63

msvitok77 commented 3 years ago

@kenshaw I don't think we should close this one. github.com/myesui/uuid is gone but it's still being cached in proxy.golang.org. I don't know if it has a TTL, but it will become a problem for all users at some point.

This is reproducible if you set export GOPROXY=direct and remove that package from ~/go/pkg/mod.

For the time being, can we make maxcompute optional?

Hello @nineinchnick that was exactly my case. I have GOPROXY=direct for my current development env. I don't have GOPRIVATE or GONOSUMDB set, as majority of my devependecies are from the private repos. I think this might be the case for many developers. Nevertheless, if I set GOPROXY, GOPRIVATE and GONOSUMDB to "correct" values, I'm able to build usql. I'd fix the uuid dependency, if I were you.

kenshaw commented 3 years ago

Sorry, I should apologize that I should have specifically mentioned the GOPROXY environment variable as being the likely culprit.

I don't really see a way of preventing others from encountering with this if they have changed their go env settings, and I don't think it would be prudent to try to document this. The documentation that usql has should support both the latest versions of Go and usql are packaged "out of the box."

We could demote the maxcompute driver down to the all build tag and remove it from the most tag, but this wouldn't have prevented this problem.

For what it's worth, I initially did not like the concept of GOPROXY and almost always set GOPROXY=direct as well in my local configuration. But as many projects started to adopt Go modules, I realized that GOPROXY solves a very real headache in a much better way than pretty much any other programming language's dependency management solution does.

We could remove drivers that break over time from usql, but I think what's done with the proxies is the best balance between usability and archivability over time. It also ensures, at build time, that a bad actor isn't able to slip in malicious code if they happen to overtake a repository.

kenshaw commented 3 years ago

Also -- https://github.com/sql-machine-learning/gomaxcompute may not have a LICENSE file, but it specifically has tagged the project as being Apache 2 licensed in the README.md.