go-console
go-console copied to clipboard
Syscall error when cross-compiling for windows
When using question.NewChoices() and cross-compiling the code for windows when using MacOS, the following error is created:
GOOS=windows GOARCH=amd64 go build -o ./build/windows ./cmd/console/main
# github.com/DrSmithFr/go-console/question
../../../../go/pkg/mod/github.com/!dr!smith!fr/[email protected]/question/question-helper.go:69:33: cannot use syscall.Stdin (variable of type syscall.Handle) as int value in argument to term.ReadPassword
Here's the piece of code that generated the error above:
cmd := goconsole.NewScript().Build()
qh := question.NewHelper(os.Stdin, cmd.Output)
validAnswers := []string{Random.ToString(), Pick.ToString(), Exit.ToString()}
answer := qh.Ask(question.NewChoices("Select an option by typing its correspondent number:", validAnswers).SetHidden(false))
I have forked and created a possible fix. Can you please take a look and provide feedback when possible?
https://github.com/megalypse/go-console/commit/635c66f30ad5ee346cefb6edc0c762366ae8c80f