Docker init with golang

I have been trying out the (relatively) new docker init command with a simple golang project. It is so simple (a web server), that it does not require any packages and so a go.sum file is not created. When I run docker compose up --build, I get an error because the generated Dockerfile tries to bind mount go.sum. It works if I manually create a go.sum (touch go.sum).

Would it be possible for the Dockerfile to check for go.sum not being available and so not try and mount it? Or create an empty go.sum file during docker init?

At the very least a warning to user before they attempt a compose build?

As the docker init plugin does not have a public Github project, you can raise the issue in the docker/roadmap Github project:

thanks - done.

1 Like