Write Docker container actions - go: cannot find main module; see 'go help modules'

hi all, in the training GitHub Actions: Write Docker container actions I’m stuck in the step 9: use input parameter in the workflow. Having followed all steps and created all necessary file, when run the action I receive the Docker error: go: cannot find main module; see 'go help modules’

Anyone have a tip or a hint what I have done wrong?

I’m having the same issue on after creating the initial Dockerfile with:

FROM golang:latest
WORKDIR /go/src/hello
COPY . .
RUN go get -d -v ./...
RUN go install -v ./...
CMD ["hello"]

I restarted this course again. I copied the code exactly as it was specified and still ran into the same problem. I cannot complete this course.

@millamdl Hi :wave: ! Firstly, you’re doing everything correct in this lab!

Go, the language, has recently gone through an update and it seems to be affecting the way modules work. This course was written specifically for Go 1.15 and the Dockerfile in this course is using Go 1.16 (latest) which is introducing the breaking change.

There is a super simple fix you can implement so that you can continue your course while we update the content of this lab.

Replace the contents of your Dockerfile with what you see below and you should be able to continue:

FROM golang:1.15
WORKDIR /go/src/hello
COPY . .
RUN go get -d -v ./...
RUN go install -v ./...
CMD ["hello"]

This change in Docker image tag will force the compatible Go version :smiley: !

Thanks. That got me unstuck.