Skip to content

Commit dc4d64c

Browse files
findleyradonovan
authored andcommitted
gopls: fix non-constant format strings
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 <[email protected]> Auto-Submit: Robert Findley <[email protected]> LUCI-TryBot-Result: Go LUCI <[email protected]>
1 parent c758e54 commit dc4d64c

File tree

3 files changed

+3
-3
lines changed

3 files changed

+3
-3
lines changed

gopls/internal/cache/view.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -706,7 +706,7 @@ func (s *Snapshot) initialize(ctx context.Context, firstAttempt bool) {
706706
}
707707
case len(modDiagnostics) > 0:
708708
initialErr = &InitializationError{
709-
MainError: fmt.Errorf(modDiagnostics[0].Message),
709+
MainError: errors.New(modDiagnostics[0].Message),
710710
}
711711
}
712712

gopls/internal/golang/completion/statements.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -408,7 +408,7 @@ func (c *completer) addReturnZeroValues() {
408408
snip.WritePlaceholder(func(b *snippet.Builder) {
409409
b.WriteText(zero)
410410
})
411-
fmt.Fprintf(&label, zero)
411+
fmt.Fprint(&label, zero)
412412
}
413413

414414
c.items = append(c.items, CompletionItem{

gopls/internal/test/integration/fake/editor.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -663,7 +663,7 @@ func (e *Editor) SaveBufferWithoutActions(ctx context.Context, path string) erro
663663
defer e.mu.Unlock()
664664
buf, ok := e.buffers[path]
665665
if !ok {
666-
return fmt.Errorf(fmt.Sprintf("unknown buffer: %q", path))
666+
return fmt.Errorf("unknown buffer: %q", path)
667667
}
668668
content := buf.text()
669669
includeText := false

0 commit comments

Comments
 (0)