1
0
mirror of https://github.com/golang/go synced 2024-11-18 22:14:56 -07:00
go/go/types
Alan Donovan 3a0c4deef1 go/analysis/passes/printf: changes for analysis API
Guide to changes:

- The -printfuncs flag is renamed -printf.funcs.
  It no longer supports "pkg.T.f" form, requiring instead
  "(dir/pkg.T).f" or "(*dir/pkg.T).f".
  The legacy ":%d" suffix is no longer supported.

- (*testing.T).Errorf and friends are removed from the isPrint map
  because they are discovered by induction while analyzing package
  "testing".

- localPrintfLike map operations are replaced by the Fact mechanism.

- The go/types representation is used instead of strings/ast.Nodes in
  various places. For example:

       pkgpath, name string -> *types.Func  (to identify a function)
    format, args *ast.Field -> *types.Var   (to identify format/args params)

  This was required to fix a latent bug in maybePrintfWrapper's
  handling of format string parameters` declared using "factored"
  syntax, such as: func f(foo, format string, args...interface{}).
  See L253 of the original testdata file for a testcase that ensured
  the buggy (?) behavior.

- func printfLike is removed as it was deadcode.

- isFormatter is rewritten to avoid a global variable.

- "if verbose { warn }" is replaced by "if false { report }" for now.

- recursive stringer is rewritten more simply in term of go/types.

Change-Id: Ia6ee827117b611c686e38207916a21fe1fc296e2
Reviewed-on: https://go-review.googlesource.com/c/142239
Reviewed-by: Michael Matloob <matloob@golang.org>
2018-10-16 19:44:49 +00:00
..
objectpath go/types/objectpath: fix tests for pre-go1.11 2018-10-01 16:20:35 +00:00
typeutil go/analysis/passes/printf: changes for analysis API 2018-10-16 19:44:49 +00:00