-
-
Notifications
You must be signed in to change notification settings - Fork 500
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
chore: run make lint on new modules (#2122)
* chore: run make lint for new modules * chore: add readability in the generate function * chore: modify output message to include make lint
- Loading branch information
1 parent
aef83bf
commit b6b4e8c
Showing
2 changed files
with
35 additions
and
10 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,19 +1,39 @@ | ||
package tools | ||
|
||
import ( | ||
"fmt" | ||
"os/exec" | ||
) | ||
|
||
func GoModTidy(cmdDir string) error { | ||
return runGoCommand(cmdDir, "mod", "tidy") | ||
if err := runGoCommand(cmdDir, "mod", "tidy"); err != nil { | ||
return fmt.Errorf(">> error synchronizing the dependencies: %w", err) | ||
} | ||
return nil | ||
} | ||
|
||
func GoVet(cmdDir string) error { | ||
return runGoCommand(cmdDir, "vet", "./...") | ||
if err := runGoCommand(cmdDir, "vet", "./..."); err != nil { | ||
return fmt.Errorf(">> error checking generated code: %w", err) | ||
} | ||
return nil | ||
} | ||
|
||
func MakeLint(cmdDir string) error { | ||
if err := runMakeCommand(cmdDir, "lint"); err != nil { | ||
return fmt.Errorf(">> error synchronizing the dependencies: %w", err) | ||
} | ||
return nil | ||
} | ||
|
||
func runGoCommand(cmdDir string, args ...string) error { | ||
cmd := exec.Command("go", args...) | ||
cmd.Dir = cmdDir | ||
return cmd.Run() | ||
} | ||
|
||
func runMakeCommand(cmdDir string, args ...string) error { | ||
cmd := exec.Command("make", args...) | ||
cmd.Dir = cmdDir | ||
return cmd.Run() | ||
} |