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

adding -c flags by default when building go test #4462

Closed
2 of 3 tasks
fl0Lec opened this issue Dec 5, 2023 · 2 comments
Closed
2 of 3 tasks

adding -c flags by default when building go test #4462

fl0Lec opened this issue Dec 5, 2023 · 2 comments
Assignees
Labels
enhancement New feature or request
Milestone

Comments

@fl0Lec
Copy link
Contributor

fl0Lec commented Dec 5, 2023

Is your feature request related to a problem? Please describe.

when building a go test without the -c flag like so:

 builds:
- command: test
  binary: env.test
  dir: ./internal/builders/golang
  no_main_check: true

will result in the error: exit status 1: fork/exec : exec format error

Describe the solution you'd like

adding:

if build.Command == "test" && !slices.Contains(flags, "-c") {
	cmd = append(cmd, "-c")
}

in internal/builders/golang/build.go#L286 would add the -c flag when not present by default

I can come up with a PR but I did not manage to push some code

Describe alternatives you've considered

clarifying the documentation at builds.md to add the requirements to put the -c flags

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

@fl0Lec fl0Lec added enhancement New feature or request triage Issue pending triage by one of the maintainers labels Dec 5, 2023
@caarlos0 caarlos0 removed the triage Issue pending triage by one of the maintainers label Dec 12, 2023
@caarlos0 caarlos0 added this to the v1.23.0 milestone Dec 12, 2023
@caarlos0
Copy link
Member

hey, yeah, feel free to PR it!
thanks, and sorry for the delayed response.

caarlos0 added a commit that referenced this issue Dec 12, 2023
when building a go test without the `-c` flag like so:
```yaml
 builds:
- command: test
  binary: env.test
  dir: ./internal/builders/golang
  no_main_check: true
  ```

will result in the error: `exit status 1: fork/exec : exec format error`

adding the -c flags when not present in the flags
adding unit test

#4462

---------

Co-authored-by: Carlos Alexandro Becker <caarlos0@users.noreply.github.com>
@caarlos0
Copy link
Member

closed in #4473

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

2 participants