]> Cypherpunks repositories - gostls13.git/commitdiff
rpc: convert /debug/rpc handler to exp/template
authorRob Pike <r@golang.org>
Tue, 26 Jul 2011 21:44:51 +0000 (14:44 -0700)
committerRob Pike <r@golang.org>
Tue, 26 Jul 2011 21:44:51 +0000 (14:44 -0700)
R=golang-dev, adg
CC=golang-dev
https://golang.org/cl/4819048

src/pkg/rpc/debug.go

index 32dc8a18ba212daac06758a63452250acf9e1947..e0602e676f2c84e61948adf6da45ad47c7054ce9 100644 (file)
@@ -10,33 +10,33 @@ package rpc
 */
 
 import (
+       "exp/template"
        "fmt"
        "http"
        "sort"
-       "template"
 )
 
 const debugText = `<html>
        <body>
        <title>Services</title>
-       {.repeated section @}
+       {{range .}}
        <hr>
-       Service {Name}
+       Service {{.Name}}
        <hr>
                <table>
                <th align=center>Method</th><th align=center>Calls</th>
-               {.repeated section Method}
+               {{range .Method}}
                        <tr>
-                       <td align=left font=fixed>{Name}({Type.ArgType}, {Type.ReplyType}) os.Error</td>
-                       <td align=center>{Type.NumCalls}</td>
+                       <td align=left font=fixed>{{.Name}}({{.Type.ArgType}}, {{.Type.ReplyType}}) os.Error</td>
+                       <td align=center>{{.Type.NumCalls}}</td>
                        </tr>
-               {.end}
+               {{end}}
                </table>
-       {.end}
+       {{end}}
        </body>
        </html>`
 
-var debug = template.MustParse(debugText, nil)
+var debug = template.New("RPC debug").MustParse(debugText)
 
 type debugMethod struct {
        Type *methodType