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

Golist implementation treats stderr as fatal #1674

Open
chouvinc opened this issue Sep 19, 2023 · 0 comments
Open

Golist implementation treats stderr as fatal #1674

chouvinc opened this issue Sep 19, 2023 · 0 comments

Comments

@chouvinc
Copy link

Describe the bug
The wrapper around go list treats stderr as fatal and exits if there's nonzero output here. This breaks when children processes of go list output things like download logs, which are commonly emitted to stderr as an (informal?) standard (true fatals being just exits, with status code = 1, see examples here).

We should probably not read from stderr since it's not guaranteed every dependency of go list assumes stderr to actually only output fatals. Would be cool if that entire final error handling block was removed.

To Reproduce
Steps to reproduce the behavior:

  1. Have non-trivial dependencies when running swag with go list
  2. Log what's actually in stderr
  3. See that it's just expected downloads; eg for a clean install in docker
  4. Exits 1 after running swag init

Expected behavior
No exiting even if stderr is non-empty

Screenshots
N/A, but basically I added a custom line in the first linked source to prepend and append some custom text, since the output was confusing me:

	defer func() {
		if stderrBuf.Len() > 0 {
			finalErr = fmt.Errorf("START OF STDERR: \n\n\n %v\n%s END OF STDERR \n\n\n", finalErr, stderrBuf.Bytes())
		}
	}()

And it would just output a bunch of expected downloads, since my build step runs in CI with a clean docker installation (+ no go dependencies installed by default):

START OF STDERR:



go: downloading github.com/hashicorp/go-secure-stdlib/mlock v0.1.1
go: downloading github.com/hashicorp/go-uuid v1.0.2
go: downloading github.com/hashicorp/golang-lru v0.5.4
go: downloading github.com/hashicorp/go-version v1.2.0
go: downloading github.com/armon/go-radix v1.0.0
... more stuff

END OF STDERR



Your swag version
e.g. 1.8.6

Your go version
e.g. 1.18.0

Desktop (please complete the following information):

  • OS: linux/amd64
  • Browser: n/a, CI/headless
  • Version: n/a

Additional context
Maybe related? #1232

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

No branches or pull requests

1 participant