goreleaser: "git is currently in a dirty state" error message lacks information to debug the problem

Describe the bug

goreleaser builds for my project are failing with the error message:

   • releasing using goreleaser 0.104.3...
   • loading config file       file=.goreleaser.yaml
   • RUNNING BEFORE HOOKS
      • running go mod download
   • GETTING AND VALIDATING GIT STATE
      • releasing v1.4.2, commit 6e5813cb91d4daca0efbc4297969a9819824e342
   ⨯ release failed after 1.90s error=git is currently in a dirty state:
 M go.mod
 M go.sum

I am unable to reproduce this problem on my own machine, and the error message from goreleaser is insufficient to know where the problem lies.

To Reproduce

Not easily reproducible, see https://travis-ci.org/twpayne/chezmoi/builds/519012274 for example output.

Expected behavior

goreleaser prints enough information to debug where the problem is occurring. Specifically, go releaser should emit a full git diff not just a git status.

Environment (please complete the following information):

  • OS: Linux
  • OS version: Whatever travis-ci.org is running right now
  • GoReleaser Version: 0.104.3

Additional context

None, but please just say if you need any more info.

About this issue

  • Original URL
  • State: closed
  • Created 5 years ago
  • Comments: 18 (15 by maintainers)

Commits related to this issue

Most upvoted comments

Yay! That pretty much worked. I still have one error to fix, but it’s unrelated to this issue:

   ⨯ release failed after 333.67s error=Snapcraft Packages: failed to publish artifacts: failed to push dist/chezmoi_1.4.2_linux_ppc64.snap package: Preparing to push 'chezmoi_1.4.2_linux_ppc64.snap'.
After pushing, an attempt will be made to release to 'stable'
Pushing 'chezmoi_1.4.2_linux_ppc64.snap' [===============================] 100%
Processing...|                                                                 
Error while processing...
The store was unable to accept this snap.
  - architectures: Invalid architecture specified in the manifest: ppc64.

(there’s also a weird mis-match between building version 1.4.2 when the tagged version is 1.4.3, but this is for me to investigate first).

Thanks again for being super responsive - and I think that the original request in this issue (print the output of git diff, not just the output of git status) still holds.

Let’s keep this open for now. I’ll see if I can come up with a PR.

Arg s/GOMODULE=off/GO111MODULE=off/, retrying…

it shows the files… you mean… show the diff too?

Yes, please. This will help me debug the problem.

something is changing your dependencies on the CI.

The message shows the changed files: go.mod and go.sum.

You can probably run go mod tidy locally, commit go.sum and go.mod and it should be fine.

Either that or you are using go get on CI, which is changing the go.{mod,sum} files…