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

x/vgo: OS specific requirements don't appear to be added to the go.mod #24367

Closed
IngCr3at1on opened this issue Mar 13, 2018 · 1 comment
Closed
Milestone

Comments

@IngCr3at1on
Copy link

IngCr3at1on commented Mar 13, 2018

What version of Go are you using (go version)?

go1.10

What operating system and processor architecture are you using (go env)?

linux/amd64

What did you do?

I added a go.mod file to an existing project and ran vgo build. The following require lines were added to the .mod file as expected:

require (
	"github.com/labstack/echo" v1.4.4
	"github.com/sirupsen/logrus" v1.0.5
	"golang.org/x/crypto" v0.0.0-20180312195533-182114d58262
)

and vgo attempted to compile the application

What did you expect to see?

the application to be compiled into a binary

What did you see instead?

# golang.org/x/crypto/ssh/terminal
../../../../v/golang.org/x/crypto@v0.0.0-20180312195533-182114d58262/ssh/terminal/util.go:30:12: undefined: unix.IoctlGetTermios
../../../../v/golang.org/x/crypto@v0.0.0-20180312195533-182114d58262/ssh/terminal/util.go:38:18: undefined: unix.IoctlGetTermios
../../../../v/golang.org/x/crypto@v0.0.0-20180312195533-182114d58262/ssh/terminal/util.go:54:12: undefined: unix.IoctlSetTermios
../../../../v/golang.org/x/crypto@v0.0.0-20180312195533-182114d58262/ssh/terminal/util.go:64:18: undefined: unix.IoctlGetTermios
../../../../v/golang.org/x/crypto@v0.0.0-20180312195533-182114d58262/ssh/terminal/util.go:75:9: undefined: unix.IoctlSetTermios
../../../../v/golang.org/x/crypto@v0.0.0-20180312195533-182114d58262/ssh/terminal/util.go:80:13: undefined: unix.IoctlGetWinsize
../../../../v/golang.org/x/crypto@v0.0.0-20180312195533-182114d58262/ssh/terminal/util.go:98:18: undefined: unix.IoctlGetTermios
../../../../v/golang.org/x/crypto@v0.0.0-20180312195533-182114d58262/ssh/terminal/util.go:107:12: undefined: unix.IoctlSetTermios
../../../../v/golang.org/x/crypto@v0.0.0-20180312195533-182114d58262/ssh/terminal/util.go:111:8: undefined: unix.IoctlSetTermios

I can get around this error obviously by running vgo get golang.org/x/sys

@gopherbot gopherbot added this to the vgo milestone Mar 13, 2018
@rsc
Copy link
Contributor

rsc commented Mar 30, 2018

This is a "garbage in" problem, not a problem in vgo itself.

github.com/labstack/echo has https://github.com/labstack/echo/blob/master/Gopkg.lock which asks for a specific commit of x/sys. golang.org/x/crypto does not declare its dependencies at all, but it turns out to need a newer version of x/sys than the one requested by labstack/echo. Since the requirement on the newer version is unstated, vgo obviously doesn't know about it, so it keeps using the older one, leading to the missing IoctlGet* symbols.

This is a fundamental problem: if packages depend on something they don't mention in their requirements lists, then they might not get the right version of that thing. There's not much we can do about it once it happens. In the long term, once everything is being built with vgo (when it becomes "go"), everything will declare its requirements, since go.mod is updated automatically, and the problem will not happen anymore.

@rsc rsc closed this as completed Mar 30, 2018
@golang golang locked and limited conversation to collaborators Mar 30, 2019
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

No branches or pull requests

3 participants