Skip to content

Commit

Permalink
gopls: use suggestions
Browse files Browse the repository at this point in the history
  • Loading branch information
santhosh-tekuri committed May 20, 2024
1 parent f728d51 commit 2c2b0f1
Show file tree
Hide file tree
Showing 4 changed files with 10 additions and 9 deletions.
2 changes: 1 addition & 1 deletion format.go
Original file line number Diff line number Diff line change
Expand Up @@ -483,7 +483,7 @@ func validateTime(v any) error {
}

// check leap second
if !(s < 60 || (h == 23 && m == 59)) {
if s >= 60 && (h != 23 || m != 59) {
return errors.New("invalid leap second")
}

Expand Down
4 changes: 2 additions & 2 deletions output.go
Original file line number Diff line number Diff line change
Expand Up @@ -70,9 +70,9 @@ func (e *ValidationError) display(sb *strings.Builder, verbose bool, indent int,
schLoc = fmt.Sprintf("S#%s", f)
}
}
sb.WriteString(fmt.Sprintf(" [%s]", schLoc))
fmt.Fprintf(sb, " [%s]", schLoc)
}
sb.WriteString(fmt.Sprintf(": %s", e.ErrorKind.LocalizedString(p)))
fmt.Fprintf(sb, ": %s", e.ErrorKind.LocalizedString(p))
}
}
for _, cause := range e.Causes {
Expand Down
6 changes: 3 additions & 3 deletions position.go
Original file line number Diff line number Diff line change
Expand Up @@ -86,10 +86,10 @@ func schemaPath(path string) SchemaPath {
var sp SchemaPath
for _, tok := range strings.Split(path, "/") {
var pos Position
switch {
case tok == "*":
switch tok {
case "*":
pos = AllProp{}
case tok == "[]":
case "[]":
pos = AllItem{}
default:
if i, err := strconv.Atoi(tok); err == nil {
Expand Down
7 changes: 4 additions & 3 deletions util.go
Original file line number Diff line number Diff line change
Expand Up @@ -69,11 +69,12 @@ func unescape(tok string) (string, bool) {
if tok == "" {
return "", false
}
if tok[0] == '0' {
switch tok[0] {
case '0':
sb.WriteByte('~')
} else if tok[0] == '1' {
case '1':
sb.WriteByte('/')
} else {
default:
return "", false
}
tok = tok[1:]
Expand Down

0 comments on commit 2c2b0f1

Please sign in to comment.