Skip to content
Projects
Groups
Snippets
Help
Loading...
Sign in
Toggle navigation
G
golang
Project
Project
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Commits
Issue Boards
Open sidebar
go
golang
Commits
d2fc5d68
Commit
d2fc5d68
authored
Feb 01, 2010
by
Rob Pike
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Change type of Printf's args to ... interface{}
R=rsc CC=golang-dev
https://golang.org/cl/197043
parent
1f11ece6
Expand all
Hide whitespace changes
Inline
Side-by-side
Showing
15 changed files
with
43 additions
and
45 deletions
+43
-45
util.go
src/cmd/cgo/util.go
+2
-2
goyacc.go
src/cmd/goyacc/goyacc.go
+1
-1
proc_linux.go
src/pkg/debug/proc/proc_linux.go
+3
-3
compiler.go
src/pkg/exp/eval/compiler.go
+1
-1
expr.go
src/pkg/exp/eval/expr.go
+1
-1
stmt.go
src/pkg/exp/eval/stmt.go
+1
-1
parser.go
src/pkg/exp/parser/parser.go
+1
-1
print.go
src/pkg/fmt/print.go
+0
-0
parser.go
src/pkg/go/parser/parser.go
+1
-1
printer.go
src/pkg/go/printer/printer.go
+1
-1
log.go
src/pkg/log/log.go
+12
-10
template.go
src/pkg/template/template.go
+2
-2
testing.go
src/pkg/testing/testing.go
+6
-6
pidigits.go
test/bench/pidigits.go
+1
-1
defer.go
test/defer.go
+10
-14
No files found.
src/cmd/cgo/util.go
View file @
d2fc5d68
...
...
@@ -76,7 +76,7 @@ func run(stdin []byte, argv []string) (stdout, stderr []byte, ok bool) {
}
// Die with an error message.
func
fatal
(
msg
string
,
args
...
)
{
func
fatal
(
msg
string
,
args
...
interface
{}
)
{
fmt
.
Fprintf
(
os
.
Stderr
,
msg
+
"
\n
"
,
args
)
os
.
Exit
(
2
)
}
...
...
@@ -84,7 +84,7 @@ func fatal(msg string, args ...) {
var
nerrors
int
var
noPos
token
.
Position
func
error
(
pos
token
.
Position
,
msg
string
,
args
...
)
{
func
error
(
pos
token
.
Position
,
msg
string
,
args
...
interface
{}
)
{
nerrors
++
if
pos
.
IsValid
()
{
fmt
.
Fprintf
(
os
.
Stderr
,
"%s: "
,
pos
)
...
...
src/cmd/goyacc/goyacc.go
View file @
d2fc5d68
...
...
@@ -3097,7 +3097,7 @@ func create(s string, m int) *bufio.Writer {
//
// write out error comment
//
func
error
(
s
string
,
v
...
)
{
func
error
(
s
string
,
v
...
interface
{}
)
{
nerrors
++
fmt
.
Fprintf
(
stderr
,
s
,
v
)
fmt
.
Fprintf
(
stderr
,
": %v:%v
\n
"
,
infile
,
lineno
)
...
...
src/pkg/debug/proc/proc_linux.go
View file @
d2fc5d68
...
...
@@ -282,7 +282,7 @@ func (t *thread) ptraceDetach() os.Error {
var
logLock
sync
.
Mutex
func
(
t
*
thread
)
logTrace
(
format
string
,
args
...
)
{
func
(
t
*
thread
)
logTrace
(
format
string
,
args
...
interface
{}
)
{
if
!
trace
{
return
}
...
...
@@ -301,7 +301,7 @@ func (t *thread) logTrace(format string, args ...) {
fmt
.
Fprint
(
os
.
Stderr
,
"
\n
"
)
}
func
(
t
*
thread
)
warn
(
format
string
,
args
...
)
{
func
(
t
*
thread
)
warn
(
format
string
,
args
...
interface
{}
)
{
logLock
.
Lock
()
defer
logLock
.
Unlock
()
fmt
.
Fprintf
(
os
.
Stderr
,
"Thread %d: WARNING "
,
t
.
tid
)
...
...
@@ -309,7 +309,7 @@ func (t *thread) warn(format string, args ...) {
fmt
.
Fprint
(
os
.
Stderr
,
"
\n
"
)
}
func
(
p
*
process
)
logTrace
(
format
string
,
args
...
)
{
func
(
p
*
process
)
logTrace
(
format
string
,
args
...
interface
{}
)
{
if
!
trace
{
return
}
...
...
src/pkg/exp/eval/compiler.go
View file @
d2fc5d68
...
...
@@ -27,7 +27,7 @@ type compiler struct {
silentErrors
int
}
func
(
a
*
compiler
)
diagAt
(
pos
positioned
,
format
string
,
args
...
)
{
func
(
a
*
compiler
)
diagAt
(
pos
positioned
,
format
string
,
args
...
interface
{}
)
{
a
.
errors
.
Error
(
pos
.
Pos
(),
fmt
.
Sprintf
(
format
,
args
))
a
.
numErrors
++
}
...
...
src/pkg/exp/eval/expr.go
View file @
d2fc5d68
...
...
@@ -58,7 +58,7 @@ func (a *exprInfo) newExpr(t Type, desc string) *expr {
return
&
expr
{
exprInfo
:
a
,
t
:
t
,
desc
:
desc
}
}
func
(
a
*
exprInfo
)
diag
(
format
string
,
args
...
)
{
func
(
a
*
exprInfo
)
diag
(
format
string
,
args
...
interface
{}
)
{
a
.
diagAt
(
&
a
.
pos
,
format
,
args
)
}
...
...
src/pkg/exp/eval/stmt.go
View file @
d2fc5d68
...
...
@@ -27,7 +27,7 @@ type stmtCompiler struct {
stmtLabel
*
label
}
func
(
a
*
stmtCompiler
)
diag
(
format
string
,
args
...
)
{
func
(
a
*
stmtCompiler
)
diag
(
format
string
,
args
...
interface
{}
)
{
a
.
diagAt
(
&
a
.
pos
,
format
,
args
)
}
...
...
src/pkg/exp/parser/parser.go
View file @
d2fc5d68
...
...
@@ -91,7 +91,7 @@ func (p *parser) init(filename string, src []byte, mode uint) {
// ----------------------------------------------------------------------------
// Parsing support
func
(
p
*
parser
)
printTrace
(
a
...
)
{
func
(
p
*
parser
)
printTrace
(
a
...
interface
{}
)
{
const
dots
=
". . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . "
+
". . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . "
const
n
=
uint
(
len
(
dots
))
...
...
src/pkg/fmt/print.go
View file @
d2fc5d68
This diff is collapsed.
Click to expand it.
src/pkg/go/parser/parser.go
View file @
d2fc5d68
...
...
@@ -93,7 +93,7 @@ func (p *parser) init(filename string, src []byte, scope *ast.Scope, mode uint)
// ----------------------------------------------------------------------------
// Parsing support
func
(
p
*
parser
)
printTrace
(
a
...
)
{
func
(
p
*
parser
)
printTrace
(
a
...
interface
{}
)
{
const
dots
=
". . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . "
+
". . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . "
const
n
=
uint
(
len
(
dots
))
...
...
src/pkg/go/printer/printer.go
View file @
d2fc5d68
...
...
@@ -101,7 +101,7 @@ func (p *printer) init(output io.Writer, cfg *Config) {
}
func
(
p
*
printer
)
internalError
(
msg
...
)
{
func
(
p
*
printer
)
internalError
(
msg
...
interface
{}
)
{
if
debug
{
fmt
.
Print
(
p
.
pos
.
String
()
+
": "
)
fmt
.
Println
(
msg
)
...
...
src/pkg/log/log.go
View file @
d2fc5d68
...
...
@@ -149,31 +149,33 @@ func (l *Logger) Output(calldepth int, s string) os.Error {
}
// Logf is analogous to Printf() for a Logger.
func
(
l
*
Logger
)
Logf
(
format
string
,
v
...
)
{
l
.
Output
(
2
,
fmt
.
Sprintf
(
format
,
v
))
}
func
(
l
*
Logger
)
Logf
(
format
string
,
v
...
interface
{})
{
l
.
Output
(
2
,
fmt
.
Sprintf
(
format
,
v
))
}
// Log is analogous to Print() for a Logger.
func
(
l
*
Logger
)
Log
(
v
...
)
{
l
.
Output
(
2
,
fmt
.
Sprintln
(
v
))
}
func
(
l
*
Logger
)
Log
(
v
...
interface
{}
)
{
l
.
Output
(
2
,
fmt
.
Sprintln
(
v
))
}
// Stdout is a helper function for easy logging to stdout. It is analogous to Print().
func
Stdout
(
v
...
)
{
stdout
.
Output
(
2
,
fmt
.
Sprint
(
v
))
}
func
Stdout
(
v
...
interface
{}
)
{
stdout
.
Output
(
2
,
fmt
.
Sprint
(
v
))
}
// Stderr is a helper function for easy logging to stderr. It is analogous to Fprint(os.Stderr).
func
Stderr
(
v
...
)
{
stderr
.
Output
(
2
,
fmt
.
Sprintln
(
v
))
}
func
Stderr
(
v
...
interface
{}
)
{
stderr
.
Output
(
2
,
fmt
.
Sprintln
(
v
))
}
// Stdoutf is a helper functions for easy formatted logging to stdout. It is analogous to Printf().
func
Stdoutf
(
format
string
,
v
...
)
{
stdout
.
Output
(
2
,
fmt
.
Sprintf
(
format
,
v
))
}
func
Stdoutf
(
format
string
,
v
...
interface
{}
)
{
stdout
.
Output
(
2
,
fmt
.
Sprintf
(
format
,
v
))
}
// Stderrf is a helper function for easy formatted logging to stderr. It is analogous to Fprintf(os.Stderr).
func
Stderrf
(
format
string
,
v
...
)
{
stderr
.
Output
(
2
,
fmt
.
Sprintf
(
format
,
v
))
}
func
Stderrf
(
format
string
,
v
...
interface
{}
)
{
stderr
.
Output
(
2
,
fmt
.
Sprintf
(
format
,
v
))
}
// Exit is equivalent to Stderr() followed by a call to os.Exit(1).
func
Exit
(
v
...
)
{
exit
.
Output
(
2
,
fmt
.
Sprintln
(
v
))
}
func
Exit
(
v
...
interface
{}
)
{
exit
.
Output
(
2
,
fmt
.
Sprintln
(
v
))
}
// Exitf is equivalent to Stderrf() followed by a call to os.Exit(1).
func
Exitf
(
format
string
,
v
...
)
{
exit
.
Output
(
2
,
fmt
.
Sprintf
(
format
,
v
))
}
func
Exitf
(
format
string
,
v
...
interface
{}
)
{
exit
.
Output
(
2
,
fmt
.
Sprintf
(
format
,
v
))
}
// Crash is equivalent to Stderr() followed by a call to panic().
func
Crash
(
v
...
)
{
crash
.
Output
(
2
,
fmt
.
Sprintln
(
v
))
}
func
Crash
(
v
...
interface
{}
)
{
crash
.
Output
(
2
,
fmt
.
Sprintln
(
v
))
}
// Crashf is equivalent to Stderrf() followed by a call to panic().
func
Crashf
(
format
string
,
v
...
)
{
crash
.
Output
(
2
,
fmt
.
Sprintf
(
format
,
v
))
}
func
Crashf
(
format
string
,
v
...
interface
{}
)
{
crash
.
Output
(
2
,
fmt
.
Sprintf
(
format
,
v
))
}
src/pkg/template/template.go
View file @
d2fc5d68
...
...
@@ -187,14 +187,14 @@ func New(fmap FormatterMap) *Template {
}
// Report error and stop executing. The line number must be provided explicitly.
func
(
t
*
Template
)
execError
(
st
*
state
,
line
int
,
err
string
,
args
...
)
{
func
(
t
*
Template
)
execError
(
st
*
state
,
line
int
,
err
string
,
args
...
interface
{}
)
{
st
.
errors
<-
&
Error
{
line
,
fmt
.
Sprintf
(
err
,
args
)}
runtime
.
Goexit
()
}
// Report error, save in Template to terminate parsing.
// The line number comes from the template state.
func
(
t
*
Template
)
parseError
(
err
string
,
args
...
)
{
func
(
t
*
Template
)
parseError
(
err
string
,
args
...
interface
{}
)
{
t
.
error
=
&
Error
{
t
.
linenum
,
fmt
.
Sprintf
(
err
,
args
)}
}
...
...
src/pkg/testing/testing.go
View file @
d2fc5d68
...
...
@@ -89,34 +89,34 @@ func (t *T) FailNow() {
// Log formats its arguments using default formatting, analogous to Print(),
// and records the text in the error log.
func
(
t
*
T
)
Log
(
args
...
)
{
t
.
errors
+=
"
\t
"
+
tabify
(
fmt
.
Sprintln
(
args
))
}
func
(
t
*
T
)
Log
(
args
...
interface
{}
)
{
t
.
errors
+=
"
\t
"
+
tabify
(
fmt
.
Sprintln
(
args
))
}
// Log formats its arguments according to the format, analogous to Printf(),
// and records the text in the error log.
func
(
t
*
T
)
Logf
(
format
string
,
args
...
)
{
func
(
t
*
T
)
Logf
(
format
string
,
args
...
interface
{}
)
{
t
.
errors
+=
"
\t
"
+
tabify
(
fmt
.
Sprintf
(
format
,
args
))
}
// Error is equivalent to Log() followed by Fail().
func
(
t
*
T
)
Error
(
args
...
)
{
func
(
t
*
T
)
Error
(
args
...
interface
{}
)
{
t
.
Log
(
args
)
t
.
Fail
()
}
// Errorf is equivalent to Logf() followed by Fail().
func
(
t
*
T
)
Errorf
(
format
string
,
args
...
)
{
func
(
t
*
T
)
Errorf
(
format
string
,
args
...
interface
{}
)
{
t
.
Logf
(
format
,
args
)
t
.
Fail
()
}
// Fatal is equivalent to Log() followed by FailNow().
func
(
t
*
T
)
Fatal
(
args
...
)
{
func
(
t
*
T
)
Fatal
(
args
...
interface
{}
)
{
t
.
Log
(
args
)
t
.
FailNow
()
}
// Fatalf is equivalent to Logf() followed by FailNow().
func
(
t
*
T
)
Fatalf
(
format
string
,
args
...
)
{
func
(
t
*
T
)
Fatalf
(
format
string
,
args
...
interface
{}
)
{
t
.
Logf
(
format
,
args
)
t
.
FailNow
()
}
...
...
test/bench/pidigits.go
View file @
d2fc5d68
...
...
@@ -92,7 +92,7 @@ func eliminate_digit(d int64) {
bignum
.
Iscale
(
numer
,
10
)
}
func
printf
(
s
string
,
arg
...
)
{
func
printf
(
s
string
,
arg
...
interface
{}
)
{
if
!*
silent
{
fmt
.
Printf
(
s
,
arg
)
}
...
...
test/defer.go
View file @
d2fc5d68
...
...
@@ -10,9 +10,7 @@ import "fmt"
var
result
string
func
addInt
(
i
int
)
{
result
+=
fmt
.
Sprint
(
i
)
}
func
addInt
(
i
int
)
{
result
+=
fmt
.
Sprint
(
i
)
}
func
test1helper
()
{
for
i
:=
0
;
i
<
10
;
i
++
{
...
...
@@ -21,16 +19,14 @@ func test1helper() {
}
func
test1
()
{
result
=
""
;
test1helper
()
;
result
=
""
test1helper
()
if
result
!=
"9876543210"
{
fmt
.
Printf
(
"test1: bad defer result (should be 9876543210): %q
\n
"
,
result
)
;
fmt
.
Printf
(
"test1: bad defer result (should be 9876543210): %q
\n
"
,
result
)
}
}
func
addDotDotDot
(
v
...
)
{
result
+=
fmt
.
Sprint
(
v
)
}
func
addDotDotDot
(
v
...
interface
{})
{
result
+=
fmt
.
Sprint
(
v
)
}
func
test2helper
()
{
for
i
:=
0
;
i
<
10
;
i
++
{
...
...
@@ -39,14 +35,14 @@ func test2helper() {
}
func
test2
()
{
result
=
""
;
test2helper
()
;
result
=
""
test2helper
()
if
result
!=
"9876543210"
{
fmt
.
Printf
(
"test2: bad defer result (should be 9876543210): %q
\n
"
,
result
)
;
fmt
.
Printf
(
"test2: bad defer result (should be 9876543210): %q
\n
"
,
result
)
}
}
func
main
()
{
test1
()
;
test2
()
;
test1
()
test2
()
}
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment