[Bug]
I'm not able to go get the package running the most recent go version
It's related to this commit https://github.com/pkg/term/commit/7d3cb3e73c47035ffe75de8cfc3a1d569b66c6be that comes with pkg/term v1.2.0-beta.1. go-prompt uses v1.1.0 as pinned in the go.mod file, so I'm wondering why new builds fail 🤔
I have worked out a simple solution locally by upgrading to v1.2.0-beta.1 and changing the getOriginalTermios function in internal/term/term.go, but I still don't think we should upgrade to a beta version.
func getOriginalTermios(fd int) (unix.Termios, error) {
var (
origTermiosPtr *unix.Termios
err error
)
saveTermiosOnce.Do(func() {
saveTermiosFD = fd
origTermiosPtr, err = termios.Tcgetattr(uintptr(fd))
saveTermios = *origTermiosPtr
})
return saveTermios, err
}
I had this exact same error while trying to run the example program, and found it very strange!
After a bit of investigation, I think the compilation fails unless the build is run in "module mode". To enable this, I just did
go mod init example.com/x
next to the example file to generate a go.mod file, and then did the go build. I presume this then uses the proper (1.1.0) module version, and hence builds ok. My guess is that when go build is using non-module mode, it ignores the module versions (and hence uses latest?) and fails (FYI: I'm using go version go1.15.6 ).
Not sure what the proper fix is for this. Maybe currently, just make it clear in the docs? Also, I think that the plan is for go to use the module mode by default (can't remember when this is planned for, but I think it's coming soon: maybe next version?)
Hope this helps! :)