1
0
mirror of https://github.com/golang/go synced 2024-11-26 13:58:48 -07:00
The Go programming language
Go to file
Rob Pike 2d4f7ba0cd printf as we know and love it.
Plus print[ln] with the ability to print struct values.

Note for language mavens: if a "..." function passes its argument
to another "..." function, the argument is not wrapped again.  This
allows printf to call fprintf without extra manipulation. It's good
but needs to go in the spec.

This code works:
///
package main

import fmt "fmt"
import os "os"

type T struct { s string; a, b int }

func main() {
	P := fmt.Printer();
	P.printf("%s = %d with float value %.4f\n", "hi there", 7, 123.456);
	P.println("hi there", 7, 123.456);
	P.fprintf(os.Stdout, "%s = %d with float value %.4f\n", "hi there", 7, 123.456);
	P.println(T{"x", 7, 234}, "end of struct", 8, 9);
}

R=rsc
DELTA=28  (7 added, 3 deleted, 18 changed)
OCL=18321
CL=18324
2008-11-02 12:33:02 -08:00
doc - language for struct field tags 2008-10-30 15:52:37 -07:00
include 6l: 2008-10-20 17:33:51 -07:00
lib
pkg
src printf as we know and love it. 2008-11-02 12:33:02 -08:00
test Recognize gccgo error message: 2008-10-31 14:55:57 -07:00
usr/gri - gcd, exponentiation, population count 2008-10-31 16:58:56 -07:00