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
ff3ef8a9
Commit
ff3ef8a9
authored
Mar 06, 2011
by
Robert Hencke
Committed by
Brad Fitzpatrick
Mar 06, 2011
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
fmt: trivial cleanup
R=golang-dev, bradfitzgo CC=golang-dev
https://golang.org/cl/4235052
parent
e9135403
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
3 additions
and
13 deletions
+3
-13
format.go
src/pkg/fmt/format.go
+2
-2
scan_test.go
src/pkg/fmt/scan_test.go
+1
-11
No files found.
src/pkg/fmt/format.go
View file @
ff3ef8a9
...
...
@@ -107,7 +107,7 @@ func (f *fmt) writePadding(n int, padding []byte) {
}
// Append b to f.buf, padded on left (w > 0) or right (w < 0 or f.minus)
// clear flags aftewards.
// clear flags afte
r
wards.
func
(
f
*
fmt
)
pad
(
b
[]
byte
)
{
var
padding
[]
byte
var
left
,
right
int
...
...
@@ -124,7 +124,7 @@ func (f *fmt) pad(b []byte) {
}
// append s to buf, padded on left (w > 0) or right (w < 0 or f.minus).
// clear flags aftewards.
// clear flags afte
r
wards.
func
(
f
*
fmt
)
padString
(
s
string
)
{
var
padding
[]
byte
var
left
,
right
int
...
...
src/pkg/fmt/scan_test.go
View file @
ff3ef8a9
...
...
@@ -476,22 +476,12 @@ func verifyInf(str string, t *testing.T) {
}
}
func
TestInf
(
t
*
testing
.
T
)
{
for
_
,
s
:=
range
[]
string
{
"inf"
,
"+inf"
,
"-inf"
,
"INF"
,
"-INF"
,
"+INF"
,
"Inf"
,
"-Inf"
,
"+Inf"
}
{
verifyInf
(
s
,
t
)
}
}
// TODO: there's no conversion from []T to ...T, but we can fake it. These
// functions do the faking. We index the table by the length of the param list.
var
fscanf
=
[]
func
(
io
.
Reader
,
string
,
[]
interface
{})
(
int
,
os
.
Error
){
0
:
func
(
r
io
.
Reader
,
f
string
,
i
[]
interface
{})
(
int
,
os
.
Error
)
{
return
Fscanf
(
r
,
f
)
},
1
:
func
(
r
io
.
Reader
,
f
string
,
i
[]
interface
{})
(
int
,
os
.
Error
)
{
return
Fscanf
(
r
,
f
,
i
[
0
])
},
2
:
func
(
r
io
.
Reader
,
f
string
,
i
[]
interface
{})
(
int
,
os
.
Error
)
{
return
Fscanf
(
r
,
f
,
i
[
0
],
i
[
1
])
},
3
:
func
(
r
io
.
Reader
,
f
string
,
i
[]
interface
{})
(
int
,
os
.
Error
)
{
return
Fscanf
(
r
,
f
,
i
[
0
],
i
[
1
],
i
[
2
])
},
}
func
testScanfMulti
(
name
string
,
t
*
testing
.
T
)
{
sliceType
:=
reflect
.
Typeof
(
make
([]
interface
{},
1
))
.
(
*
reflect
.
SliceType
)
for
_
,
test
:=
range
multiTests
{
...
...
@@ -501,7 +491,7 @@ func testScanfMulti(name string, t *testing.T) {
}
else
{
r
=
newReader
(
test
.
text
)
}
n
,
err
:=
fscanf
[
len
(
test
.
in
)](
r
,
test
.
format
,
test
.
in
)
n
,
err
:=
Fscanf
(
r
,
test
.
format
,
test
.
in
...
)
if
err
!=
nil
{
if
test
.
err
==
""
{
t
.
Errorf
(
"got error scanning (%q, %q): %q"
,
test
.
format
,
test
.
text
,
err
)
...
...
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