Skip to content

Commit 4a0ba01

Browse files
committed
nit: inline validateJSONOutput helper; drop errors import
1 parent 54a7620 commit 4a0ba01

1 file changed

Lines changed: 2 additions & 10 deletions

File tree

cmd/browsers_telemetry.go

Lines changed: 2 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,6 @@ package cmd
22

33
import (
44
"context"
5-
"errors"
65
"fmt"
76
"slices"
87
"strconv"
@@ -30,13 +29,6 @@ type BrowsersTelemetryStreamInput struct {
3029
Output string
3130
}
3231

33-
func validateJSONOutput(out string) error {
34-
if out != "" && out != "json" {
35-
return errors.New("unsupported --output value: use 'json'")
36-
}
37-
return nil
38-
}
39-
4032
// parseTelemetryCategories parses a comma-separated "name=on|off" string into
4133
// a BrowserTelemetryCategoriesConfigParam. Unmentioned categories are omitted.
4234
func parseTelemetryCategories(s string) (kernel.BrowserTelemetryCategoriesConfigParam, error) {
@@ -102,8 +94,8 @@ func shouldEmit(ev kernel.BrowserTelemetryEventUnion, categories, types []string
10294
}
10395

10496
func (b BrowsersCmd) TelemetryStream(ctx context.Context, in BrowsersTelemetryStreamInput) error {
105-
if err := validateJSONOutput(in.Output); err != nil {
106-
return err
97+
if in.Output != "" && in.Output != "json" {
98+
return fmt.Errorf("unsupported --output value: use 'json'")
10799
}
108100
for _, c := range in.Categories {
109101
if c != "system" && !slices.Contains(settableCategories, c) {

0 commit comments

Comments
 (0)