testcontainers-go icon indicating copy to clipboard operation
testcontainers-go copied to clipboard

[Enhancement]: modulegen: print output from failed commands

Open pablochacin opened this issue 2 years ago • 3 comments

Proposal

When generating the scaffold for a new module, the modulegen tool executes multiple commands.

In case one of them fails, it is only reported the step that failed, but the actual error is not reported, as seen in the following output:

Error: >> error synchronizing the dependencies: exit status 1

A more detailed output from the tool would facilitate the debugging of errors. For example:

Error: >> error synchronizing the dependencies: exit status 1

go: finding module for package github.com/testcontainers/testcontainers-go/modules/k6
github.com/testcontainers/testcontainers-go/examples/k6 tested by
	github.com/testcontainers/testcontainers-go/examples/k6.test imports
	github.com/testcontainers/testcontainers-go/modules/k6: module github.com/testcontainers/testcontainers-go@latest found (v0.24.1, replaced by ../..), but does not contain package github.com/testcontainers/testcontainers-go/modules/k6

pablochacin avatar Sep 26 '23 10:09 pablochacin

I think there is a bug in the example template, but it should work if you create a module instead of a example:

In the mean time, instead of creating an example, please try with a real module.

- go run . new example --name k6 --image "grafana/k6" --title k6
+ go run . new module --name k6 --image "grafana/k6" --title k6

mdelapenya avatar Sep 26 '23 11:09 mdelapenya

We saw that the docs are a bit misleading, as the first code snippet is for creating an example module (just copy&paste code, no public API) when it should be just the module.

mdelapenya avatar Sep 26 '23 11:09 mdelapenya

Hi @mdelapenya thanks for the clarification. I tried that and it worked. :+1:

I think it would be worth providing more information about the reason for the failure in the command.

pablochacin avatar Sep 26 '23 14:09 pablochacin