Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
G
go
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
Analytics
Analytics
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Commits
Issue Boards
Open sidebar
Kirill Smelkov
go
Commits
3a2c0a96
Commit
3a2c0a96
authored
Nov 06, 2008
by
Robert Griesemer
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
- fixes to sprintf (by rob)
R=r OCL=18685 CL=18685
parent
91212bd1
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
11 additions
and
8 deletions
+11
-8
src/lib/fmt/print.go
src/lib/fmt/print.go
+11
-8
No files found.
src/lib/fmt/print.go
View file @
3a2c0a96
...
...
@@ -28,11 +28,11 @@ export type Formatter interface {
Precision
()
(
prec
int
,
ok
bool
);
}
export
type
Format
interface
{
type
Format
interface
{
Format
(
f
Formatter
,
c
int
);
}
export
type
String
interface
{
type
String
interface
{
String
()
string
}
...
...
@@ -132,9 +132,10 @@ export func printf(format string, v ...) (n int, errno *os.Error) {
return
n
,
errno
;
}
export
func
sprintf
(
format
string
,
v
...
)
string
{
export
func
sprintf
(
format
string
,
a
...
)
string
{
v
:=
reflect
.
NewValue
(
a
)
.
(
reflect
.
PtrValue
)
.
Sub
()
.
(
reflect
.
StructValue
);
p
:=
Printer
();
p
.
doprintf
(
format
,
reflect
.
NewValue
(
v
)
.
(
reflect
.
StructValue
)
);
p
.
doprintf
(
format
,
v
);
s
:=
string
(
p
.
buf
)[
0
:
p
.
n
];
return
s
;
}
...
...
@@ -155,9 +156,10 @@ export func print(v ...) (n int, errno *os.Error) {
return
n
,
errno
;
}
export
func
sprint
(
v
...
)
string
{
export
func
sprint
(
a
...
)
string
{
v
:=
reflect
.
NewValue
(
a
)
.
(
reflect
.
PtrValue
)
.
Sub
()
.
(
reflect
.
StructValue
);
p
:=
Printer
();
p
.
doprint
(
reflect
.
NewValue
(
v
)
.
(
reflect
.
StructValue
)
,
false
,
false
);
p
.
doprint
(
v
,
false
,
false
);
s
:=
string
(
p
.
buf
)[
0
:
p
.
n
];
return
s
;
}
...
...
@@ -179,9 +181,10 @@ export func println(v ...) (n int, errno *os.Error) {
return
n
,
errno
;
}
export
func
sprintln
(
v
...
)
string
{
export
func
sprintln
(
a
...
)
string
{
v
:=
reflect
.
NewValue
(
a
)
.
(
reflect
.
PtrValue
)
.
Sub
()
.
(
reflect
.
StructValue
);
p
:=
Printer
();
p
.
doprint
(
reflect
.
NewValue
(
v
)
.
(
reflect
.
StructValue
)
,
true
,
true
);
p
.
doprint
(
v
,
true
,
true
);
s
:=
string
(
p
.
buf
)[
0
:
p
.
n
];
return
s
;
}
...
...
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