summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorRob Pike <r@golang.org>2009-01-15 13:48:11 -0800
committerRob Pike <r@golang.org>2009-01-15 13:48:11 -0800
commit8024c6e3aec249fcc40b62e8879d30207e879be9 (patch)
treea72b91ed6b55c7c4635039376af421a98695ad60 /src
parentd6b313278a61f109ab8b71dd8c77a40ff557b819 (diff)
downloadgolang-8024c6e3aec249fcc40b62e8879d30207e879be9.tar.gz
printf->Printf etc.
the raw fmt routines will be another, smaller but subtler pass. R=rsc DELTA=157 (0 added, 0 deleted, 157 changed) OCL=22851 CL=22851
Diffstat (limited to 'src')
-rwxr-xr-xsrc/lib/bignum.go6
-rw-r--r--src/lib/bignum_test.go2
-rw-r--r--src/lib/bufio_test.go2
-rw-r--r--src/lib/flag.go12
-rw-r--r--src/lib/fmt/fmt_test.go30
-rw-r--r--src/lib/fmt/print.go24
-rw-r--r--src/lib/json/generic.go4
-rw-r--r--src/lib/net/dnsclient.go2
-rw-r--r--src/lib/net/dnsmsg.go12
-rw-r--r--src/lib/sort_test.go2
-rw-r--r--src/lib/strconv/fp_test.go4
-rw-r--r--src/lib/testing.go4
12 files changed, 52 insertions, 52 deletions
diff --git a/src/lib/bignum.go b/src/lib/bignum.go
index 60d3b87c1..d5cd21ba6 100755
--- a/src/lib/bignum.go
+++ b/src/lib/bignum.go
@@ -662,7 +662,7 @@ func FmtBase(c int) uint {
func (x Natural) Format(h Fmt.Formatter, c int) {
- Fmt.fprintf(h, "%s", x.ToString(FmtBase(c)));
+ Fmt.Fprintf(h, "%s", x.ToString(FmtBase(c)));
}
@@ -1096,7 +1096,7 @@ func (x *Integer) String() string {
func (x *Integer) Format(h Fmt.Formatter, c int) {
- Fmt.fprintf(h, "%s", x.ToString(FmtBase(c)));
+ Fmt.Fprintf(h, "%s", x.ToString(FmtBase(c)));
}
@@ -1226,7 +1226,7 @@ func (x *Rational) String() string {
func (x *Rational) Format(h Fmt.Formatter, c int) {
- Fmt.fprintf(h, "%s", x.ToString(FmtBase(c)));
+ Fmt.Fprintf(h, "%s", x.ToString(FmtBase(c)));
}
diff --git a/src/lib/bignum_test.go b/src/lib/bignum_test.go
index 0ededd6f6..417af5b24 100644
--- a/src/lib/bignum_test.go
+++ b/src/lib/bignum_test.go
@@ -117,7 +117,7 @@ export func TestNatConv(t *testing.T) {
test_msg = "NatConvD";
x := bignum.Nat(100);
- y, b := bignum.NatFromString(fmt.sprintf("%b", &x), 2, nil);
+ y, b := bignum.NatFromString(fmt.Sprintf("%b", &x), 2, nil);
NAT_EQ(100, y, x);
}
diff --git a/src/lib/bufio_test.go b/src/lib/bufio_test.go
index 272b8b65c..b728027fb 100644
--- a/src/lib/bufio_test.go
+++ b/src/lib/bufio_test.go
@@ -309,7 +309,7 @@ export func TestBufWrite(t *testing.T) {
write := writers[k].fn();
buf, e := NewBufWriteSize(write, bs);
- context := fmt.sprintf("write=%s nwrite=%d bufsize=%d", writers[k].name, nwrite, bs);
+ context := fmt.Sprintf("write=%s nwrite=%d bufsize=%d", writers[k].name, nwrite, bs);
if e != nil {
t.Errorf("%s: NewBufWriteSize %d: %v", context, bs, e);
continue;
diff --git a/src/lib/flag.go b/src/lib/flag.go
index 49294bc4e..2f9c7fcfe 100644
--- a/src/lib/flag.go
+++ b/src/lib/flag.go
@@ -119,7 +119,7 @@ func (b *BoolValue) Set(val bool) {
}
func (b *BoolValue) Str() string {
- return fmt.sprintf("%v", *b.p)
+ return fmt.Sprintf("%v", *b.p)
}
// -- Int Value
@@ -137,7 +137,7 @@ func (i *IntValue) Set(val int) {
}
func (i *IntValue) Str() string {
- return fmt.sprintf("%v", *i.p)
+ return fmt.Sprintf("%v", *i.p)
}
// -- Int64 Value
@@ -155,7 +155,7 @@ func (i *Int64Value) Set(val int64) {
}
func (i *Int64Value) Str() string {
- return fmt.sprintf("%v", *i.p)
+ return fmt.Sprintf("%v", *i.p)
}
// -- Uint Value
@@ -173,7 +173,7 @@ func (i *UintValue) Set(val uint) {
}
func (i *UintValue) Str() string {
- return fmt.sprintf("%v", *i.p)
+ return fmt.Sprintf("%v", *i.p)
}
// -- Uint64 Value
@@ -191,7 +191,7 @@ func (i *Uint64Value) Set(val uint64) {
}
func (i *Uint64Value) Str() string {
- return fmt.sprintf("%v", *i.p)
+ return fmt.Sprintf("%v", *i.p)
}
// -- String Value
@@ -209,7 +209,7 @@ func (s *StringValue) Set(val string) {
}
func (s *StringValue) Str() string {
- return fmt.sprintf("%#q", *s.p)
+ return fmt.Sprintf("%#q", *s.p)
}
// -- Value interface
diff --git a/src/lib/fmt/fmt_test.go b/src/lib/fmt/fmt_test.go
index 8eb70b351..acb7ce86a 100644
--- a/src/lib/fmt/fmt_test.go
+++ b/src/lib/fmt/fmt_test.go
@@ -14,9 +14,9 @@ import (
export func TestFmtInterface(t *testing.T) {
var i1 interface{};
i1 = "abc";
- s := fmt.sprintf("%s", i1);
+ s := fmt.Sprintf("%s", i1);
if s != "abc" {
- t.Errorf(`fmt.sprintf("%%s", empty("abc")) = %q want %q`, s, "abc");
+ t.Errorf(`fmt.Sprintf("%%s", empty("abc")) = %q want %q`, s, "abc");
}
}
@@ -153,14 +153,14 @@ var fmttests = []FmtTest{
export func TestSprintf(t *testing.T) {
for i := 0; i < len(fmttests); i++ {
tt := fmttests[i];
- s := fmt.sprintf(tt.fmt, tt.val);
+ s := fmt.Sprintf(tt.fmt, tt.val);
if s != tt.out {
if ss, ok := tt.val.(string); ok {
// Don't requote the already-quoted strings.
// It's too confusing to read the errors.
- t.Errorf("fmt.sprintf(%q, %q) = %s want %s", tt.fmt, tt.val, s, tt.out);
+ t.Errorf("fmt.Sprintf(%q, %q) = %s want %s", tt.fmt, tt.val, s, tt.out);
} else {
- t.Errorf("fmt.sprintf(%q, %v) = %q want %q", tt.fmt, tt.val, s, tt.out);
+ t.Errorf("fmt.Sprintf(%q, %v) = %q want %q", tt.fmt, tt.val, s, tt.out);
}
}
}
@@ -175,10 +175,10 @@ func (*FlagPrinter) Format(f fmt.Formatter, c int) {
}
}
if w, ok := f.Width(); ok {
- s += fmt.sprintf("%d", w);
+ s += fmt.Sprintf("%d", w);
}
if p, ok := f.Precision(); ok {
- s += fmt.sprintf(".%d", p);
+ s += fmt.Sprintf(".%d", p);
}
s += string(c);
io.WriteString(f, "["+s+"]");
@@ -208,9 +208,9 @@ export func TestFlagParser(t *testing.T) {
var flagprinter FlagPrinter;
for i := 0; i < len(flagtests); i++ {
tt := flagtests[i];
- s := fmt.sprintf(tt.in, &flagprinter);
+ s := fmt.Sprintf(tt.in, &flagprinter);
if s != tt.out {
- t.Errorf("sprintf(%q, &flagprinter) => %q, want %q", tt.in, s, tt.out);
+ t.Errorf("Sprintf(%q, &flagprinter) => %q, want %q", tt.in, s, tt.out);
}
}
}
@@ -234,9 +234,9 @@ export func TestStructPrinter(t *testing.T) {
};
for i := 0; i < len(tests); i++ {
tt := tests[i];
- out := fmt.sprintf(tt.fmt, s);
+ out := fmt.Sprintf(tt.fmt, s);
if out != tt.out {
- t.Errorf("sprintf(%q, &s) = %q, want %q", tt.fmt, out, tt.out);
+ t.Errorf("Sprintf(%q, &s) = %q, want %q", tt.fmt, out, tt.out);
}
}
}
@@ -244,13 +244,13 @@ export func TestStructPrinter(t *testing.T) {
export func TestArrayPrinter(t *testing.T) {
a := []int{1, 2, 3, 4, 5};
want := "[1 2 3 4 5]";
- out := fmt.sprintf("%v", a);
+ out := fmt.Sprintf("%v", a);
if out != want {
- t.Errorf("sprintf(%%v, array) = %q, want %q", out, want);
+ t.Errorf("Sprintf(%%v, array) = %q, want %q", out, want);
}
want = "&" + want;
- out = fmt.sprintf("%v", &a);
+ out = fmt.Sprintf("%v", &a);
if out != want {
- t.Errorf("sprintf(%%v, &array) = %q, want %q", out, want);
+ t.Errorf("Sprintf(%%v, &array) = %q, want %q", out, want);
}
}
diff --git a/src/lib/fmt/print.go b/src/lib/fmt/print.go
index 6f0b0cf15..06d6789f9 100644
--- a/src/lib/fmt/print.go
+++ b/src/lib/fmt/print.go
@@ -128,7 +128,7 @@ func (p *P) doprint(v reflect.StructValue, addspace, addnewline bool);
// These routines end in 'f' and take a format string.
-export func fprintf(w io.Write, format string, a ...) (n int, error *os.Error) {
+export func Fprintf(w io.Write, format string, a ...) (n int, error *os.Error) {
v := reflect.NewValue(a).(reflect.PtrValue).Sub().(reflect.StructValue);
p := Printer();
p.doprintf(format, v);
@@ -136,12 +136,12 @@ export func fprintf(w io.Write, format string, a ...) (n int, error *os.Error) {
return n, error;
}
-export func printf(format string, v ...) (n int, errno *os.Error) {
- n, errno = fprintf(os.Stdout, format, v);
+export func Printf(format string, v ...) (n int, errno *os.Error) {
+ n, errno = Fprintf(os.Stdout, format, v);
return n, errno;
}
-export func sprintf(format string, a ...) string {
+export func Sprintf(format string, a ...) string {
v := reflect.NewValue(a).(reflect.PtrValue).Sub().(reflect.StructValue);
p := Printer();
p.doprintf(format, v);
@@ -152,7 +152,7 @@ export func sprintf(format string, a ...) string {
// These routines do not take a format string and add spaces only
// when the operand on neither side is a string.
-export func fprint(w io.Write, a ...) (n int, error *os.Error) {
+export func Fprint(w io.Write, a ...) (n int, error *os.Error) {
v := reflect.NewValue(a).(reflect.PtrValue).Sub().(reflect.StructValue);
p := Printer();
p.doprint(v, false, false);
@@ -160,12 +160,12 @@ export func fprint(w io.Write, a ...) (n int, error *os.Error) {
return n, error;
}
-export func print(v ...) (n int, errno *os.Error) {
- n, errno = fprint(os.Stdout, v);
+export func Print(v ...) (n int, errno *os.Error) {
+ n, errno = Fprint(os.Stdout, v);
return n, errno;
}
-export func sprint(a ...) string {
+export func Sprint(a ...) string {
v := reflect.NewValue(a).(reflect.PtrValue).Sub().(reflect.StructValue);
p := Printer();
p.doprint(v, false, false);
@@ -177,7 +177,7 @@ export func sprint(a ...) string {
// always add spaces between operands, and add a newline
// after the last operand.
-export func fprintln(w io.Write, a ...) (n int, error *os.Error) {
+export func Fprintln(w io.Write, a ...) (n int, error *os.Error) {
v := reflect.NewValue(a).(reflect.PtrValue).Sub().(reflect.StructValue);
p := Printer();
p.doprint(v, true, true);
@@ -185,12 +185,12 @@ export func fprintln(w io.Write, a ...) (n int, error *os.Error) {
return n, error;
}
-export func println(v ...) (n int, errno *os.Error) {
- n, errno = fprintln(os.Stdout, v);
+export func Println(v ...) (n int, errno *os.Error) {
+ n, errno = Fprintln(os.Stdout, v);
return n, errno;
}
-export func sprintln(a ...) string {
+export func Sprintln(a ...) string {
v := reflect.NewValue(a).(reflect.PtrValue).Sub().(reflect.StructValue);
p := Printer();
p.doprint(v, true, true);
diff --git a/src/lib/json/generic.go b/src/lib/json/generic.go
index b62f8d96d..bedfe6f6b 100644
--- a/src/lib/json/generic.go
+++ b/src/lib/json/generic.go
@@ -63,9 +63,9 @@ func (j *Number) Kind() int { return NumberKind }
func (j *Number) Number() float64 { return j.f }
func (j *Number) String() string {
if math.Floor(j.f) == j.f {
- return fmt.sprintf("%.0f", j.f);
+ return fmt.Sprintf("%.0f", j.f);
}
- return fmt.sprintf("%g", j.f);
+ return fmt.Sprintf("%g", j.f);
}
type Array struct { a *array.Array; Null }
diff --git a/src/lib/net/dnsclient.go b/src/lib/net/dnsclient.go
index f9ca002dd..2066c2886 100644
--- a/src/lib/net/dnsclient.go
+++ b/src/lib/net/dnsclient.go
@@ -115,7 +115,7 @@ Cname:
n := len(addrs);
a := rr.(*DNS_RR_A).a;
addrs = addrs[0:n+1];
- addrs[n] = fmt.sprintf("%d.%d.%d.%d", (a>>24), (a>>16)&0xFF, (a>>8)&0xFF, a&0xFF);
+ addrs[n] = fmt.Sprintf("%d.%d.%d.%d", (a>>24), (a>>16)&0xFF, (a>>8)&0xFF, a&0xFF);
case DNS_TypeCNAME:
// redirect to cname
name = rr.(*DNS_RR_CNAME).cname;
diff --git a/src/lib/net/dnsmsg.go b/src/lib/net/dnsmsg.go
index 76cdd904a..e497fa9b8 100644
--- a/src/lib/net/dnsmsg.go
+++ b/src/lib/net/dnsmsg.go
@@ -323,7 +323,7 @@ func PackStructValue(val reflect.StructValue, msg []byte, off int) (off1 int, ok
name, typ, tag, xxx := val.Type().(reflect.StructType).Field(i);
switch fld.Kind() {
default:
- fmt.fprintf(os.Stderr, "net: dns: unknown packing type %v", fld.Type());
+ fmt.Fprintf(os.Stderr, "net: dns: unknown packing type %v", fld.Type());
return len(msg), false;
case reflect.StructKind:
off, ok = PackStructValue(fld.(reflect.StructValue), msg, off);
@@ -351,7 +351,7 @@ func PackStructValue(val reflect.StructValue, msg []byte, off int) (off1 int, ok
s := fld.(reflect.StringValue).Get();
switch tag {
default:
- fmt.fprintf(os.Stderr, "net: dns: unknown string tag %v", tag);
+ fmt.Fprintf(os.Stderr, "net: dns: unknown string tag %v", tag);
return len(msg), false;
case "domain-name":
off, ok = PackDomainName(s, msg, off);
@@ -389,7 +389,7 @@ func UnpackStructValue(val reflect.StructValue, msg []byte, off int) (off1 int,
fld := val.Field(i);
switch fld.Kind() {
default:
- fmt.fprintf(os.Stderr, "net: dns: unknown packing type %v", fld.Type());
+ fmt.Fprintf(os.Stderr, "net: dns: unknown packing type %v", fld.Type());
return len(msg), false;
case reflect.StructKind:
off, ok = UnpackStructValue(fld.(reflect.StructValue), msg, off);
@@ -411,7 +411,7 @@ func UnpackStructValue(val reflect.StructValue, msg []byte, off int) (off1 int,
var s string;
switch tag {
default:
- fmt.fprintf(os.Stderr, "net: dns: unknown string tag %v", tag);
+ fmt.Fprintf(os.Stderr, "net: dns: unknown string tag %v", tag);
return len(msg), false;
case "domain-name":
s, off, ok = UnpackDomainName(msg, off);
@@ -464,9 +464,9 @@ func PrintStructValue(val reflect.StructValue) string {
s += PrintStructValue(fld.(reflect.StructValue));
case kind == reflect.Uint32Kind && tag == "ipv4":
i := fld.(reflect.Uint32Value).Get();
- s += fmt.sprintf("%d.%d.%d.%d", (i>>24)&0xFF, (i>>16)&0xFF, (i>>8)&0xFF, i&0xFF);
+ s += fmt.Sprintf("%d.%d.%d.%d", (i>>24)&0xFF, (i>>16)&0xFF, (i>>8)&0xFF, i&0xFF);
default:
- s += fmt.sprint(fld.Interface())
+ s += fmt.Sprint(fld.Interface())
}
}
s += "}";
diff --git a/src/lib/sort_test.go b/src/lib/sort_test.go
index 65d5c9b69..6684d93da 100644
--- a/src/lib/sort_test.go
+++ b/src/lib/sort_test.go
@@ -213,7 +213,7 @@ export func TestBentleyMcIlroy(t *testing.T) {
}
}
- desc := fmt.sprintf("n=%d m=%d dist=%s mode=%s", n, m, dists[dist], modes[mode]);
+ desc := fmt.Sprintf("n=%d m=%d dist=%s mode=%s", n, m, dists[dist], modes[mode]);
d := &TestingData{desc, t, mdata[0:n], n*Lg(n)*12/10, 0};
sort.Sort(d);
diff --git a/src/lib/strconv/fp_test.go b/src/lib/strconv/fp_test.go
index 1b60d3f77..ef82d369f 100644
--- a/src/lib/strconv/fp_test.go
+++ b/src/lib/strconv/fp_test.go
@@ -131,14 +131,14 @@ export func TestFp(t *testing.T) {
t.Error("testfp.txt:", lineno, ": cannot atof64 ", a[2]);
continue;
}
- s = fmt.sprintf(a[1], v);
+ s = fmt.Sprintf(a[1], v);
case "float32":
v1, ok := myatof32(a[2]);
if !ok {
t.Error("testfp.txt:", lineno, ": cannot atof32 ", a[2]);
continue;
}
- s = fmt.sprintf(a[1], v1);
+ s = fmt.Sprintf(a[1], v1);
v = float64(v1);
}
if s != a[3] {
diff --git a/src/lib/testing.go b/src/lib/testing.go
index 12512f5d2..b19367da6 100644
--- a/src/lib/testing.go
+++ b/src/lib/testing.go
@@ -38,11 +38,11 @@ func (t *T) FailNow() {
}
func (t *T) Log(args ...) {
- t.errors += "\t" + Tabify(fmt.sprintln(args));
+ t.errors += "\t" + Tabify(fmt.Sprintln(args));
}
func (t *T) Logf(format string, args ...) {
- t.errors += Tabify(fmt.sprintf("\t" + format, args));
+ t.errors += Tabify(fmt.Sprintf("\t" + format, args));
l := len(t.errors);
if l > 0 && t.errors[l-1] != '\n' {
t.errors += "\n"