Rietveld Code Review Tool
Help | Bug tracker | Discussion group | Source code | Sign in
(1159)

Unified Diff: src/cmd/godoc/template.go

Issue 6852075: code review 6852075: go/format: Package format implements standard formattin... (Closed)
Patch Set: diff -r 7646c94159a1 https://code.google.com/p/go Created 11 years, 4 months ago
Use n/p to move between diff chunks; N/P to move between comments. Please Sign in to add in-line comments.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « src/cmd/godoc/play.go ('k') | src/pkg/go/format/format.go » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: src/cmd/godoc/template.go
===================================================================
--- a/src/cmd/godoc/template.go
+++ b/src/cmd/godoc/template.go
@@ -57,8 +57,8 @@
return string(file)
}
-// format returns a textual representation of the arg, formatted according to its nature.
-func format(arg interface{}) string {
+// stringFor returns a textual representation of the arg, formatted according to its nature.
+func stringFor(arg interface{}) string {
switch arg := arg.(type) {
case int:
return fmt.Sprintf("%d", arg)
@@ -87,10 +87,10 @@
// text is already whole file.
command = fmt.Sprintf("code %q", file)
case 1:
- command = fmt.Sprintf("code %q %s", file, format(arg[0]))
+ command = fmt.Sprintf("code %q %s", file, stringFor(arg[0]))
text = oneLine(file, text, arg[0])
case 2:
- command = fmt.Sprintf("code %q %s %s", file, format(arg[0]), format(arg[1]))
+ command = fmt.Sprintf("code %q %s %s", file, stringFor(arg[0]), stringFor(arg[1]))
text = multipleLines(file, text, arg[0], arg[1])
default:
return "", fmt.Errorf("incorrect code invocation: code %q %q", file, arg)
« no previous file with comments | « src/cmd/godoc/play.go ('k') | src/pkg/go/format/format.go » ('j') | no next file with comments »

Powered by Google App Engine
RSS Feeds Recent Issues | This issue
This is Rietveld f62528b