patch fmt: printArg
This commit is contained in:
@@ -1,8 +1,12 @@
|
|||||||
package main
|
package main
|
||||||
|
|
||||||
import "fmt"
|
import (
|
||||||
|
"errors"
|
||||||
|
"fmt"
|
||||||
|
)
|
||||||
|
|
||||||
func main() {
|
func main() {
|
||||||
fmt.Println("Hello, world")
|
fmt.Println("Hello, world")
|
||||||
fmt.Printf("%f\n", 3.14)
|
fmt.Printf("%f\n", 3.14)
|
||||||
|
fmt.Printf("%v\n", errors.New("error message"))
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -750,7 +750,6 @@ func (p *pp) printArg(arg any, verb rune) {
|
|||||||
p.fmtInteger(uint64(f), unsigned, verb)
|
p.fmtInteger(uint64(f), unsigned, verb)
|
||||||
case string:
|
case string:
|
||||||
p.fmtString(f, verb)
|
p.fmtString(f, verb)
|
||||||
/* TODO(xsw):
|
|
||||||
case []byte:
|
case []byte:
|
||||||
p.fmtBytes(f, verb, "[]byte")
|
p.fmtBytes(f, verb, "[]byte")
|
||||||
case reflect.Value:
|
case reflect.Value:
|
||||||
@@ -763,17 +762,13 @@ func (p *pp) printArg(arg any, verb rune) {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
p.printValue(f, verb, 0)
|
p.printValue(f, verb, 0)
|
||||||
*/
|
|
||||||
default:
|
default:
|
||||||
/*
|
// If the type is not simple, it might have methods.
|
||||||
// If the type is not simple, it might have methods.
|
if !p.handleMethods(verb) {
|
||||||
if !p.handleMethods(verb) {
|
// Need to use reflection, since the type had no
|
||||||
// Need to use reflection, since the type had no
|
// interface methods that could be used for formatting.
|
||||||
// interface methods that could be used for formatting.
|
p.printValue(reflect.ValueOf(f), verb, 0)
|
||||||
p.printValue(reflect.ValueOf(f), verb, 0)
|
}
|
||||||
}
|
|
||||||
*/
|
|
||||||
panic("todo: fmt.(*pp).printArg")
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user