awesome-gocui / gocui

Minimalist Go package aimed at creating Console User Interfaces.
BSD 3-Clause "New" or "Revised" License
350 stars 39 forks source link

Can not run Example in Docker [BUG] #31

Closed EldoranDev closed 5 years ago

EldoranDev commented 5 years ago

Describe the bug When running the example in Docker it crashes with the error

fatal error: unexpected signal during runtime execution

To Reproduce Steps to reproduce the behavior:

  1. Compile readme example in docker container
  2. Run docker-container

Expected behavior Running example

Environment (please complete the following information):

Additional context File compiled with

CGO_ENABLED=0 GOOS=linux go build -a -installsuffix "static" -o main .
glvr182 commented 5 years ago

Hi thank you for submitting this bug. The example in the readme is a bit behind the _examples folder, I shall look at that, in the mean time you might be able to solve this bug by running one from the _examples folder

EldoranDev commented 5 years ago

Running demo.go from _example results in the same error.

fatal error: unexpected signal during runtime execution
[signal SIGSEGV: segmentation violation code=0x1 addr=0x17 pc=0x411326]

looks like its related to some channel stuff:

goroutine 5 [syscall]:
os/signal.signal_recv(0x0)
    /usr/local/go/src/runtime/sigqueue.go:139 +0x9c
os/signal.loop()
    /usr/local/go/src/os/signal/signal_unix.go:23 +0x22
created by os/signal.init.0
    /usr/local/go/src/os/signal/signal_unix.go:29 +0x41

goroutine 17 [select]:
github.com/awesome-gocui/termbox-go.Init.func1()
    /go/src/github.com/awesome-gocui/termbox-go/api.go:95 +0x332
created by github.com/awesome-gocui/termbox-go.Init
    /go/src/github.com/awesome-gocui/termbox-go/api.go:92 +0x739
skanehira commented 5 years ago

@EldoranDev Sorry, I'm late. Can you let me know Go's version ?

EldoranDev commented 5 years ago

I used the following image:

golang:latest / golang:1.12.8

So it should be go version 1.12.8

skanehira commented 5 years ago

@EldoranDev Thank you :) How did you run _example/demo.go ? like this?

cd _example
GO111MODULE=on go run demo.go
EldoranDev commented 5 years ago
FROM golang:latest as build

ADD . /go/src/cui-test
WORKDIR /go/src/cui-test
RUN go get -d ./...
RUN CGO_ENABLED=0 GOOS=linux go build -a -installsuffix "static" -o main .

FROM scratch as prod

COPY --from=build /go/src/cui-test/main /bin/main

CMD ["/bin/main"]
skanehira commented 5 years ago

It did not reproduce on the Mac. I think it may be a problem with the OS. I'll continue to investigate.


procedure

$ cd _example
$ make Dockerfile
$ docker build -t gocui-sample .
$ docker run --rm -it gocui-sample

Dockerfile

FROM golang:1.12.8 as build

ADD ./hello.go /go/src/cui-test/
WORKDIR /go/src/cui-test
RUN go get -d ./...
RUN CGO_ENABLED=0 GOOS=linux go build -a -installsuffix "static" -o main .

FROM scratch as prod

COPY --from=build /go/src/cui-test/main /bin/main

CMD ["/bin/main"]
skanehira commented 5 years ago

@EldoranDev does the same panic happen with other samples?

EldoranDev commented 5 years ago

Okay, I do not know why. But I can not reproduce this as well.

So sorry for wasting your time, seems like a can't reproduce issue to me.

glvr182 commented 5 years ago

No problem, thanks for the update!