qiniu/goc

The command '/bin/sh -c CGO_ENABLED=0 GOOS=linux GOARCH=amd64 goc build -o main' returned a non-zero code: 1

mashraf09 opened this issue · 4 comments

I want to create and run goc build inside the docker-compose. I'm not sure it will work or not but i am having this error while docker-compose executes the line "RUN CGO_ENABLED=0 GOOS=linux GOARCH=amd64 goc build -o main"

Error:
Step 9/12 : RUN CGO_ENABLED=0 GOOS=linux GOARCH=amd64 goc build -o main
---> Running in 8ae3a09842f7
level=fatal msg="Fail to build: fail to list package dependencies"
The command '/bin/sh -c CGO_ENABLED=0 GOOS=linux GOARCH=amd64 goc build -o main' returned a non-zero code: 1
ERROR: Service 'consumer-logger' failed to build : Build failed

Hi @mashraf09 , based on this err "Fail to build: fail to list package dependencies", you can use go list ./... to check what happening.

Hi @CarlJi thanks, go list ./.. is just listing the module name I'm using.

Step 10/12 : RUN go list ./...
---> Running in e4646cb36103
github.com/segmentio/kafka-go/example/consumer-logger
Removing intermediate container e4646cb36103
---> 52f723ecfea6
Step 11/12 : RUN goc build -o main
---> Running in 2c6d723cb8d3
level=fatal msg="Fail to build: fail to list package dependencies"
The command '/bin/sh -c goc build -o main' returned a non-zero code: 1
ERROR: Service 'consumer-logger' failed to build : Build failed

could you please provide the full debug log? use goc build --debug to get it.

@CarlJi I fixed it and successfully build my docker-compose. I added RUN apk add bash to my docker file and it worked.