Skip to content

Commit 02a9dc8

Browse files
authored
Fail with error when --profile used without JSON format (#1918)
* Fail with error when --profile used without JSON format The --profile flag only works with --format json but previously produced no output silently when used with other formats. Now returns an error telling the user to use --format json. Fixes #1542 Signed-off-by: Matt Van Horn <455140+mvanhorn@users.noreply.github.com> * fix: use errors.New and add whitespace for linter compliance Replace fmt.Errorf with errors.New (no format verbs) and add blank line above ctx assignment per wsl_v5 linter. Signed-off-by: Matt Van Horn <455140+mvanhorn@users.noreply.github.com> --------- Signed-off-by: Matt Van Horn <455140+mvanhorn@users.noreply.github.com> Co-authored-by: Matt Van Horn <455140+mvanhorn@users.noreply.github.com>
1 parent 422a9ef commit 02a9dc8

1 file changed

Lines changed: 4 additions & 0 deletions

File tree

cmd/lint.go

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -171,6 +171,10 @@ func init() {
171171
}
172172

173173
func lint(args []string, params *lintParams) (result report.Report, err error) {
174+
if params.profile && params.format != formatJSON {
175+
return report.Report{}, errors.New("--profile requires --format json to display profiling data")
176+
}
177+
174178
ctx, cancel := getLinterContext(params.lintAndFixParams)
175179
defer cancel()
176180

0 commit comments

Comments
 (0)