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

Invalid goarch values are ignored #1878

Closed
ahmetb opened this issue Oct 28, 2020 · 5 comments · Fixed by #1886
Closed

Invalid goarch values are ignored #1878

ahmetb opened this issue Oct 28, 2020 · 5 comments · Fixed by #1886
Labels
bug Something isn't working good-first-issue

Comments

@ahmetb
Copy link

ahmetb commented Oct 28, 2020

Describe the bug

If you write a wrong goarch: field, it's simply ignored and no errors printed.

For example, I have goarch: [i386, amd64] and only amd64 gets built –no errors are shown about i386 being a wrong GOARCH value

To Reproduce

Steps to reproduce the behavior:

before:
  hooks:
  - go mod download
builds:
- main: .
  binary: grpc_health_probe
  flags:
  - -tags=netgo
  ldflags:
  - -w
  env:
  - CGO_ENABLED=0
  goos:
  - linux
  goarch:
  - "i386"
  - amd64
  - arm
  - arm64
  - ppc64le
  - s390x
  goarm: [6]
checksum:
  name_template: "checksums.txt"
  algorithm: sha256
archives:
  - format: binary
    name_template: "{{ .ProjectName }}-{{ .Os }}-{{ .Arch }}"

Make sure your config file is valid by running
goreleaser check -f path-to-config-file.

It's valid

Expected behavior

Expected to see an error.

Environment (please complete the following information):

  • GoReleaser Version: 0.143.0
@ahmetb ahmetb added the bug Something isn't working label Oct 28, 2020
@yzwdroid
Copy link

can I give it a try?

@caarlos0
Copy link
Member

Go ahead @yzwdroid 🙏

@yzwdroid
Copy link

yzwdroid commented Nov 1, 2020

Hi @caarlos0, I am new to golang and cobra, can you give me some hint which file should I code to validate the goarch. check.go or somewhere else. Also I found the code in check.go

			cfg, err := loadConfig(root.config)
			if err := ctrlc.Default.Run(ctx, func() error {
				log.Info(color.New(color.Bold).Sprint("checking config:"))
				return defaults.Pipe{}.Run(ctx)
			}); err != nil {
				log.WithError(err).Error(color.New(color.Bold).Sprintf("config is invalid"))
				return fmt.Errorf("invalid config: %w", err)
			}

where could be the right place to do the validation.

Thanks caarlos0

@caarlos0
Copy link
Member

caarlos0 commented Nov 5, 2020

Sorry @yzwdroid , I didn't have the time to explain it, end up fixing it myself. You can check #1886.

@kodiakhq kodiakhq bot closed this as completed in #1886 Nov 5, 2020
@github-actions
Copy link
Contributor

github-actions bot commented Dec 5, 2020

This issue has been automatically locked since there has not been any recent activity after it was closed. Please open a new issue for related bugs.

@github-actions github-actions bot locked as resolved and limited conversation to collaborators Dec 5, 2020
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
bug Something isn't working good-first-issue
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants