This is an automated email from the ASF dual-hosted git repository.
rohit pushed a commit to branch main
in repository https://gitbox.apache.org/repos/asf/cloudstack-go.git
The following commit(s) were added to refs/heads/main by this push:
new 0106fc7 generate: fix error when goimports not found (#50)
0106fc7 is described below
commit 0106fc79c6b1031ad6d7c89a157ba8a77f6c8afe
Author: Abhishek Kumar <[email protected]>
AuthorDate: Thu Mar 16 14:46:03 2023 +0530
generate: fix error when goimports not found (#50)
Signed-off-by: Abhishek Kumar <[email protected]>
---
generate/generate.go | 7 ++++---
1 file changed, 4 insertions(+), 3 deletions(-)
diff --git a/generate/generate.go b/generate/generate.go
index 9906f18..ac3e5fb 100644
--- a/generate/generate.go
+++ b/generate/generate.go
@@ -123,10 +123,11 @@ func (e *generateError) Error() string {
type goimportError struct {
output string
+ error error
}
func (e *goimportError) Error() string {
- return fmt.Sprintf("GoImport failed to format:\n%v", e.output)
+ return fmt.Sprintf("GoImport failed to format:\n%v\n%v", e.output,
e.error)
}
type service struct {
@@ -238,7 +239,7 @@ func main() {
}
out, err := exec.Command("goimports", "-w", outdir).CombinedOutput()
if err != nil {
- errors = append(errors, &goimportError{string(out)})
+ errors = append(errors, &goimportError{string(out), err})
}
testdir, err := testDir()
@@ -247,7 +248,7 @@ func main() {
}
out, err = exec.Command("goimports", "-w", testdir).CombinedOutput()
if err != nil {
- errors = append(errors, &goimportError{string(out)})
+ errors = append(errors, &goimportError{string(out), err})
}
if len(errors) > 0 {