Logrus: Cant install on windows

Created on 18 Aug 2017  路  8Comments  路  Source: sirupsen/logrus

go get github.com/sirupsen/logrus
# golang.org/x/crypto/ssh/terminal
..\..\..\golang.org\x\crypto\ssh\terminal\util_windows.go:42: undefined: windows.ENABLE_ECHO_INPUT
..\..\..\golang.org\x\crypto\ssh\terminal\util_windows.go:42: undefined: windows.ENABLE_PROCESSED_INPUT
..\..\..\golang.org\x\crypto\ssh\terminal\util_windows.go:42: undefined: windows.ENABLE_LINE_INPUT
..\..\..\golang.org\x\crypto\ssh\terminal\util_windows.go:42: undefined: windows.ENABLE_PROCESSED_OUTPUT
..\..\..\golang.org\x\crypto\ssh\terminal\util_windows.go:43: undefined: windows.SetConsoleMode
..\..\..\golang.org\x\crypto\ssh\terminal\util_windows.go:62: undefined: windows.SetConsoleMode
..\..\..\golang.org\x\crypto\ssh\terminal\util_windows.go:67: undefined: windows.ConsoleScreenBufferInfo
..\..\..\golang.org\x\crypto\ssh\terminal\util_windows.go:68: undefined: windows.GetConsoleScreenBufferInfo
..\..\..\golang.org\x\crypto\ssh\terminal\util_windows.go:91: undefined: windows.ENABLE_ECHO_INPUT
..\..\..\golang.org\x\crypto\ssh\terminal\util_windows.go:92: undefined: windows.ENABLE_PROCESSED_INPUT
..\..\..\golang.org\x\crypto\ssh\terminal\util_windows.go:92: too many errors

Most helpful comment

馃帀

All 8 comments

Do you have an old version of x/crypto/ssh/terminal? Could you try updating it?

I also faced this issue after updating to logrus v1.0.3. I am also able to reproduce the issue in a fresh project:

glide.yaml:

package: playground
import:
- package: github.com/Sirupsen/logrus
  version: ^1.0.3

glide.lock:

hash: 63379b39e56eb058f5db6ba5e8a6fdba655701f90c3f11e6b7651d089cf31556
updated: 2017-08-21T15:35:36.2560978+05:30
imports:
- name: github.com/Sirupsen/logrus
  version: f006c2ac4710855cf0f916dd6b77acf6b048dc6e
- name: golang.org/x/crypto
  version: eb71ad9bd329b5ac0fd0148dd99bd62e8be8e035
  subpackages:
  - ssh/terminal
- name: golang.org/x/sys
  version: c4489faa6e5ab84c0ef40d6ee878f7a030281f0f
  subpackages:
  - unix
  - windows
testImports: []

main.go:

package main

import log "github.com/Sirupsen/logrus"

func main() {
    log.WithFields(log.Fields{
        "animal": "walrus",
    }).Info("A walrus appears")
}

Error:

$ go build .
# playground/vendor/golang.org/x/crypto/ssh/terminal
vendor\golang.org\x\crypto\ssh\terminal\util_windows.go:42: undefined: windows.ENABLE_ECHO_INPUT
vendor\golang.org\x\crypto\ssh\terminal\util_windows.go:42: undefined: windows.ENABLE_PROCESSED_INPUT
vendor\golang.org\x\crypto\ssh\terminal\util_windows.go:42: undefined: windows.ENABLE_LINE_INPUT
vendor\golang.org\x\crypto\ssh\terminal\util_windows.go:42: undefined: windows.ENABLE_PROCESSED_OUTPUT
vendor\golang.org\x\crypto\ssh\terminal\util_windows.go:43: undefined: windows.SetConsoleMode
vendor\golang.org\x\crypto\ssh\terminal\util_windows.go:62: undefined: windows.SetConsoleMode
vendor\golang.org\x\crypto\ssh\terminal\util_windows.go:67: undefined: windows.ConsoleScreenBufferInfo
vendor\golang.org\x\crypto\ssh\terminal\util_windows.go:68: undefined: windows.GetConsoleScreenBufferInfo
vendor\golang.org\x\crypto\ssh\terminal\util_windows.go:91: undefined: windows.ENABLE_ECHO_INPUT
vendor\golang.org\x\crypto\ssh\terminal\util_windows.go:92: undefined: windows.ENABLE_PROCESSED_INPUT
vendor\golang.org\x\crypto\ssh\terminal\util_windows.go:92: too many errors

Again (especially since you can't reproduce this on a new project), does the project you're updating has the latest crypto library?

@dmathieu This _is_ in a completely new project. Additionally, from the glide.lock file, you can see that the version for crypto library is eb71ad9bd329b5ac0fd0148dd99bd62e8be8e035 which is the latest. I apologise for wrongly assuming that you would be familiar with glide. All I have done in the project is glide init and glide up. The contents of the main.go included is above is the only source code present in the project.

Looking further into this, it appears to be error only within the terminal package, when calling the windows one.
Do you have the latest version of that package? What version of Go are you using?

Are you able to use that terminal package outside of logrus?
Sorry for all the questions. But I don't have any windows system available, and therefore cannot test this myself.

No problem and no need to apologise 馃槃. Turns out I did _not_ have the latest version for package golang.org/x/sys/windows. The version that glide installed automatically for me was c4489faa6e5ab84c0ef40d6ee878f7a030281f0f. Not entirely sure why glide installed this particular version. However, there has been activity in the package after the issue was reported here. Now if I do a fresh install for logrus, the latest version is fetched which fixes the build/run errors. Furthermore, I can also fix the issue by manually updating the lock file to the latest version(07c182904dbd53199946ba614a412c61d3c548f5).

Just for completeness,

位 go version
go version go1.8.3 windows/amd64

If @StarpTech can confirm the same, the issue can be closed.

It also fixed it. Thanks all.

馃帀

Was this page helpful?
0 / 5 - 0 ratings