go-tmbundle icon indicating copy to clipboard operation
go-tmbundle copied to clipboard

Go: False positive format string detection

Open mcandre opened this issue 9 years ago • 1 comments

The Go highlighter sometimes highlights percent signs in strings, even though the usage of the string is not as a C-style printf format string, but an ordinary literal string.

Example:

https://github.com/mcandre/mcandre/blob/master/go/ddg/ddg.go

mcandre avatar Sep 01 '16 14:09 mcandre

Another example:

package main

import (
	"fmt"
)

func main() {
	fmt.Printf("%s %[1]s", "foo")
}

https://play.golang.org/p/5wSu2_WRU0m

See "Explicit argument indexes" at https://golang.org/pkg/fmt/#hdr-Printing.

AlekSi avatar Jan 21 '19 10:01 AlekSi