1
0
mirror of https://github.com/goreleaser/goreleaser.git synced 2025-01-08 03:31:59 +02:00
goreleaser/www/docs/errors/no-main.md
Carlos Alexandro Becker d18adfb57e
feat: deprecate --rm-dist in favor of new --clean flag (#3702)
After talking with @perylemke, we realized that probably most people
will likely expect it to be called --clean instead of --rm-dist, as its
more similar to the popular `make clean` task.

This adds the --clean flag, and make the --rm-dist one deprecated.

Signed-off-by: Carlos A Becker <caarlos0@users.noreply.github.com>
2023-01-20 23:47:08 -03:00

1.1 KiB

Build does not contain a main function

This usually happens if you're trying to build a library or if you didn't setup the builds.main section in your .goreleaser.yaml and your main.go is not in the root folder.

Here's an example error:

   ⨯ build failed after 0.11s error=build for foo does not contain a main function

Learn more at https://goreleaser.com/errors/no-main

If you are building a library

Add something like this to your config:

# .goreleaser.yaml
builds:
- skip: true

If your main.go is not in the root folder

Add something like this to your config:

# .goreleaser.yaml
builds:
- main: ./path/to/your/main/pkg/

For more info, check the builds documentation.

If you ran goreleaser outside the root of the project

Run goreleaser in the root of the project.

If you are building in plugin, c-shared or c-archive build modes

You can set no_main_check to true:

# .goreleaser.yaml
builds:
- main: ./path/...
  buildmode: plugin
  no_main_check: true

For more info, check the builds documentation.