Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Build for a single target fails with "go_first_class" in targets #4426

Closed
3 of 4 tasks
hansmi opened this issue Nov 15, 2023 · 2 comments · Fixed by #4442
Closed
3 of 4 tasks

Build for a single target fails with "go_first_class" in targets #4426

hansmi opened this issue Nov 15, 2023 · 2 comments · Fixed by #4442
Assignees
Labels
bug Something isn't working

Comments

@hansmi
Copy link

hansmi commented Nov 15, 2023

What happened?

Commit e33d053 added an error when a --single-target build finds no target:

no builds matching --single-target linux/amd64

This works when builds[].targets is left at its implicit default value or includes the selected target. The error above is from a build with go_first_class in the targets.

builds:
  - […]
    targets:
      - go_first_class

From the documentation:

# Special values:
# - go_118_first_class: evaluates to the first-class ports of go1.18.
# - go_first_class: evaluates to latest stable go first-class ports,
# currently same as 1.18.

How can we reproduce this?

Preparation:

$ git clone https://github.com/hansmi/prombackup.git
$ cd prombackup
$ git reset --hard 8985b66fd90a2a1f2764

Reproduction:

$ docker run --rm -v $PWD:/go/src/github.com/user/repo -w /go/src/github.com/user/repo goreleaser/goreleaser build --snapshot --clean --single-target
  • starting build...
  • loading                                          path=.goreleaser.yml
  • building only for linux/amd64                    reason=single target is enabled
  ⨯ build failed after 0s                            error=no builds matching --single-target linux/amd64

Demonstration that go_first_class is to blame:

$ sed -i -e '/go_first_class/ d' .goreleaser.yml
$ docker run --rm -v $PWD:/go/src/github.com/user/repo -w /go/src/github.com/user/repo goreleaser/goreleaser build --snapshot --clean --single-target
  • starting build...
  • loading                                          path=.goreleaser.yml
  • building only for linux/amd64                    reason=single target is enabled
  • skipping validate...
  • loading environment variables
  • getting and validating git state
    • git state                                      commit=8985b66fd90a2a1f276463571b332bf7f8522527 branch=main current_tag=v0.0.6 previous_tag=v0.0.5 dirty=true
    • pipe skipped                                   reason=disabled during snapshot mode
  • parsing tag
  • setting defaults
  • snapshotting
    • building snapshot...                           version=0.0.7-snapshot20231115T221630Z+g8985b66
  • checking distribution directory
    • cleaning dist
  • loading go mod information
  • build prerequisites
  • writing effective config file
    • writing                                        config=dist/config.yaml
  • building binaries
    • building                                       binary=dist/prombackup-server_linux_amd64_v1/prombackup-server
    • building                                       binary=dist/prombackup_linux_amd64_v1/prombackup
    • took: 9s
  • storing release metadata
    • writing                                        file=dist/artifacts.json
    • writing                                        file=dist/metadata.json
  • build succeeded after 9s
  • thanks for using goreleaser!

goreleaser version

$ docker run --rm -v $PWD:/go/src/github.com/user/repo -w /go/src/github.com/user/repo goreleaser/goreleaser --version
[…]
GitVersion:    1.22.1
GitCommit:     52d976beaea9ba8a5b0f09f90f22135b468c33c2
GitTreeState:  false
BuildDate:     2023-11-08T23:40:43Z
BuiltBy:       goreleaser
GoVersion:     go1.21.4
Compiler:      gc
ModuleSum:     h1:7+P9DHpKPmg160mni77AC6x43tch0DKNqULIfrYRyOU=
Platform:      linux/amd64

GoReleaser Check

  • goreleaser check shows no errors

Search

  • I did search for other open and closed issues before opening this

Supporter

Code of Conduct

  • I agree to follow this project's Code of Conduct

Additional context

No response

@hansmi hansmi added bug Something isn't working triage Issue pending triage by one of the maintainers labels Nov 15, 2023
@caarlos0 caarlos0 removed the triage Issue pending triage by one of the maintainers label Nov 24, 2023
@caarlos0
Copy link
Member

this should also be fixed by #4442

can you test that PR?

@hansmi
Copy link
Author

hansmi commented Nov 27, 2023

@caarlos0, I can confirm that #4442 resolves the error reported in this issue. Thank you!

caarlos0 added a commit that referenced this issue Nov 27, 2023
closes #4437 
closes #4426

---------

Signed-off-by: Carlos Alexandro Becker <caarlos0@users.noreply.github.com>
hansmi added a commit to hansmi/ghactions-goreleaser-workflow that referenced this issue Dec 11, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants