Rietveld Code Review Tool
Help | Bug tracker | Discussion group | Source code | Sign in
(630)

Delta Between Two Patch Sets: cmd/vet/testdata/print.go

Issue 10895043: code review 10895043: go.tools/cmd/vet: improvements to static checking of pr... (Closed)
Left Patch Set: diff -r 70059fa0a39e https://code.google.com/p/go.tools Created 10 years, 8 months ago
Right Patch Set: diff -r c13a5b840d50 https://code.google.com/p/go.tools Created 10 years, 8 months ago
Left:
Right:
Use n/p to move between diff chunks; N/P to move between comments. Please Sign in to add in-line comments.
Jump to:
Left: Side by side diff | Download
Right: Side by side diff | Download
« no previous file with change/comment | « cmd/vet/print.go ('k') | cmd/vet/types.go » ('j') | no next file with change/comment »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
LEFTRIGHT
1 // Copyright 2010 The Go Authors. All rights reserved. 1 // Copyright 2010 The Go Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style 2 // Use of this source code is governed by a BSD-style
3 // license that can be found in the LICENSE file. 3 // license that can be found in the LICENSE file.
4 4
5 // This file contains tests for the printf checker. 5 // This file contains tests for the printf checker.
6 6
7 package testdata 7 package testdata
8 8
9 import ( 9 import (
10 "fmt" 10 "fmt"
(...skipping 61 matching lines...) Expand 10 before | Expand all | Expand 10 after
72 fmt.Printf("%q %q %q %q", 3, i, 'x', r) 72 fmt.Printf("%q %q %q %q", 3, i, 'x', r)
73 fmt.Printf("%s %s %s", "hi", s, []byte{65}) 73 fmt.Printf("%s %s %s", "hi", s, []byte{65})
74 fmt.Printf("%t %t", true, b) 74 fmt.Printf("%t %t", true, b)
75 fmt.Printf("%T %T", 3, i) 75 fmt.Printf("%T %T", 3, i)
76 fmt.Printf("%U %U", 3, i) 76 fmt.Printf("%U %U", 3, i)
77 fmt.Printf("%v %v", 3, i) 77 fmt.Printf("%v %v", 3, i)
78 fmt.Printf("%x %x %x %x", 3, i, "hi", s) 78 fmt.Printf("%x %x %x %x", 3, i, "hi", s)
79 fmt.Printf("%X %X %X %X", 3, i, "hi", s) 79 fmt.Printf("%X %X %X %X", 3, i, "hi", s)
80 fmt.Printf("%.*s %d %g", 3, "hi", 23, 2.3) 80 fmt.Printf("%.*s %d %g", 3, "hi", 23, 2.3)
81 fmt.Printf("%s", &stringerv) 81 fmt.Printf("%s", &stringerv)
82 » fmt.Printf("%T", stringerv) 82 » fmt.Printf("%T", &stringerv)
83 fmt.Printf("%*%", 2) // Ridiculous but allowed. 83 fmt.Printf("%*%", 2) // Ridiculous but allowed.
84 84
85 fmt.Printf("%g", 1+2i) 85 fmt.Printf("%g", 1+2i)
86 // Some bad format/argTypes 86 // Some bad format/argTypes
87 fmt.Printf("%b", "hi") // ERROR "arg .hi. for printf verb %b of wrong type" 87 fmt.Printf("%b", "hi") // ERROR "arg .hi. for printf verb %b of wrong type"
88 fmt.Printf("%b", c) // ERROR "arg c for printf ve rb %b of wrong type" 88 fmt.Printf("%b", c) // ERROR "arg c for printf ve rb %b of wrong type"
89 fmt.Printf("%b", 1+2i) // ERROR "arg 1 \+ 2i for pri ntf verb %b of wrong type" 89 fmt.Printf("%b", 1+2i) // ERROR "arg 1 \+ 2i for pri ntf verb %b of wrong type"
90 fmt.Printf("%c", 2.3) // ERROR "arg 2.3 for printf verb %c of wrong type" 90 fmt.Printf("%c", 2.3) // ERROR "arg 2.3 for printf verb %c of wrong type"
91 fmt.Printf("%d", 2.3) // ERROR "arg 2.3 for printf verb %d of wrong type" 91 fmt.Printf("%d", 2.3) // ERROR "arg 2.3 for printf verb %d of wrong type"
92 fmt.Printf("%e", "hi") // ERROR "arg .hi. for printf verb %e of wrong type" 92 fmt.Printf("%e", "hi") // ERROR "arg .hi. for printf verb %e of wrong type"
(...skipping 98 matching lines...) Expand 10 before | Expand all | Expand 10 after
191 return "string" 191 return "string"
192 } 192 }
193 193
194 func (*stringer) Warn(int, ...interface{}) string { 194 func (*stringer) Warn(int, ...interface{}) string {
195 return "warn" 195 return "warn"
196 } 196 }
197 197
198 func (*stringer) Warnf(int, string, ...interface{}) string { 198 func (*stringer) Warnf(int, string, ...interface{}) string {
199 return "warnf" 199 return "warnf"
200 } 200 }
LEFTRIGHT

Powered by Google App Engine
RSS Feeds Recent Issues | This issue
This is Rietveld f62528b