goreleaser / goreleaser-action

GitHub Action for GoReleaser
https://github.com/marketplace/actions/goreleaser-action
MIT License
865 stars 78 forks source link

error=build for binary does not contain a main function #317

Closed greenpau closed 2 years ago

greenpau commented 2 years ago

I have a vanilla config. The manually triggered action results in the following error:

release failed after 5.33s error=build for ovn_exporter does not contain a main function

The failed run: greenpau/ovn_exporter/runs/4358394650

How do I troubleshoot the failure?

greenpau commented 2 years ago

Running $ goreleaser build --snapshot --rm-dist locally and getting the same error:

      • building                  binary=/home/greenpau/dev/go/src/github.com/greenpau/ovn_exporter/dist/ovn_exporter_linux_amd64/ovn_exporter
   ⨯ build failed after 0.11s error=build for ovn_exporter does not contain a main function

The dist directory contains a single dist/config.yaml. The ovn_exporter_linux_amd64/ovn_exporter are not there.

Perhaps, there has to be a step make build type of step? 🤔

caarlos0 commented 2 years ago

Perhaps, there has to be a step make build type of step? 🤔

no, probably you haven't created a .goreleaser.yml and your main function is not on the root folder.

Please refer to the documentation: https://goreleaser.com/quick-start/ and https://goreleaser.com/customization/build/

greenpau commented 2 years ago

no, probably you haven't created a .goreleaser.yml and your main function is not on the root folder.

@caarlos0 , 👍 my main function is not in the root. I do have .goreleaser.yml though.

caarlos0 commented 2 years ago

you are not informing the main property in your build config, thats likely the issue

caarlos0 commented 2 years ago

Improved the error msg a bit: https://github.com/goreleaser/goreleaser/pull/2709

caarlos0 commented 2 years ago

so, was that it? can we close this?

greenpau commented 2 years ago

so, was that it? can we close this?

@caarlos0 , thank you for your help! 👍

I am all good. Released v1.0.4. Had to do the following changes:

caarlos0 commented 2 years ago

Nice! Glad it worked out!

Will close this then, but feel free to reopen/comment/open another issue if needed.

We also have a channel in the gopher slack and on discord, links to all https://goreleaser.com/links/