Skip to content

Commit 57ff818

Browse files
committed
refactor(sheets): satisfy read-format lint on landed branch (#284)
1 parent 5dd4972 commit 57ff818

File tree

1 file changed

+6
-4
lines changed

1 file changed

+6
-4
lines changed

internal/cmd/sheets_format_fields.go

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,8 @@ import (
88
"google.golang.org/api/sheets/v4"
99
)
1010

11+
const sheetsUserEnteredFormatPrefix = "userEnteredFormat"
12+
1113
func normalizeFormatMask(mask string) (string, []string) {
1214
parts := splitFieldMask(mask)
1315
if len(parts) == 0 {
@@ -22,17 +24,17 @@ func normalizeFormatMask(mask string) (string, []string) {
2224
}
2325

2426
switch {
25-
case part == "userEnteredFormat":
27+
case part == sheetsUserEnteredFormatPrefix:
2628
normalized = append(normalized, part)
27-
case strings.HasPrefix(part, "userEnteredFormat."):
28-
formatPath := strings.TrimPrefix(part, "userEnteredFormat.")
29+
case strings.HasPrefix(part, sheetsUserEnteredFormatPrefix+"."):
30+
formatPath := strings.TrimPrefix(part, sheetsUserEnteredFormatPrefix+".")
2931
normalized = append(normalized, part)
3032
if formatPath != "" {
3133
formatJSONPaths = append(formatJSONPaths, formatPath)
3234
}
3335
default:
3436
if isFormatJSONPath(part) {
35-
normalized = append(normalized, "userEnteredFormat."+part)
37+
normalized = append(normalized, sheetsUserEnteredFormatPrefix+"."+part)
3638
formatJSONPaths = append(formatJSONPaths, part)
3739
} else {
3840
normalized = append(normalized, part)

0 commit comments

Comments
 (0)