Skip to content

Commit

Permalink
gopls: fix non-constant format strings
Browse files Browse the repository at this point in the history
Fix vet failures related to the new vet check for non-constant format
strings with no args (golang/go#60529).

Change-Id: If63006613ec4827b8f7d23990654f5ecc1521ec8
Reviewed-on: https://go-review.googlesource.com/c/tools/+/610795
Reviewed-by: Alan Donovan <adonovan@google.com>
Auto-Submit: Robert Findley <rfindley@google.com>
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
  • Loading branch information
findleyr authored and adonovan committed Sep 4, 2024
1 parent c758e54 commit dc4d64c
Show file tree
Hide file tree
Showing 3 changed files with 3 additions and 3 deletions.
2 changes: 1 addition & 1 deletion gopls/internal/cache/view.go
Original file line number Diff line number Diff line change
Expand Up @@ -706,7 +706,7 @@ func (s *Snapshot) initialize(ctx context.Context, firstAttempt bool) {
}
case len(modDiagnostics) > 0:
initialErr = &InitializationError{
MainError: fmt.Errorf(modDiagnostics[0].Message),
MainError: errors.New(modDiagnostics[0].Message),
}
}

Expand Down
2 changes: 1 addition & 1 deletion gopls/internal/golang/completion/statements.go
Original file line number Diff line number Diff line change
Expand Up @@ -408,7 +408,7 @@ func (c *completer) addReturnZeroValues() {
snip.WritePlaceholder(func(b *snippet.Builder) {
b.WriteText(zero)
})
fmt.Fprintf(&label, zero)
fmt.Fprint(&label, zero)
}

c.items = append(c.items, CompletionItem{
Expand Down
2 changes: 1 addition & 1 deletion gopls/internal/test/integration/fake/editor.go
Original file line number Diff line number Diff line change
Expand Up @@ -663,7 +663,7 @@ func (e *Editor) SaveBufferWithoutActions(ctx context.Context, path string) erro
defer e.mu.Unlock()
buf, ok := e.buffers[path]
if !ok {
return fmt.Errorf(fmt.Sprintf("unknown buffer: %q", path))
return fmt.Errorf("unknown buffer: %q", path)
}
content := buf.text()
includeText := false
Expand Down

0 comments on commit dc4d64c

Please sign in to comment.