summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorRobert Griesemer <gri@golang.org>2009-11-05 22:25:46 -0800
committerRobert Griesemer <gri@golang.org>2009-11-05 22:25:46 -0800
commit79284cae32ae358684182efad32f301bfbf68729 (patch)
tree62fc9273553d59294f6f26324ca72f1d18486621
parent07b6becc8883b26ac379228c3c7bc470b1d610ef (diff)
downloadgo-79284cae32ae358684182efad32f301bfbf68729.tar.gz
go-79284cae32ae358684182efad32f301bfbf68729.zip
gofmt'ed src/cmd
R=rsc http://go/go-review/1024004
-rw-r--r--src/cmd/godoc/godoc.go51
-rw-r--r--src/cmd/godoc/main.go8
-rw-r--r--src/cmd/godoc/spec.go3
-rw-r--r--src/cmd/goyacc/doc.go2
4 files changed, 32 insertions, 32 deletions
diff --git a/src/cmd/godoc/godoc.go b/src/cmd/godoc/godoc.go
index 7b94e5036f..9dcdd83c49 100644
--- a/src/cmd/godoc/godoc.go
+++ b/src/cmd/godoc/godoc.go
@@ -86,7 +86,7 @@ var (
)
-var fsTree RWValue; // *Directory tree of packages, updated with each sync
+var fsTree RWValue // *Directory tree of packages, updated with each sync
func init() {
@@ -139,9 +139,9 @@ func htmlEscape(s string) string {
// Package directories
type Directory struct {
- Path string; // includes Name
- Name string;
- Dirs []*Directory;
+ Path string; // includes Name
+ Name string;
+ Dirs []*Directory;
}
@@ -153,7 +153,7 @@ func newDirTree(path, name string, depth int) *Directory {
return &Directory{path, name, nil};
}
- list, _ := io.ReadDir(path); // ignore errors
+ list, _ := io.ReadDir(path); // ignore errors
// determine number of subdirectories and package files
ndirs := 0;
@@ -210,7 +210,7 @@ func newDirectory(root string, depth int) *Directory {
// lookup looks for the *Directory for a given path, relative to dir.
func (dir *Directory) lookup(path string) *Directory {
- path = pathutil.Clean(path); // no trailing '/'
+ path = pathutil.Clean(path); // no trailing '/'
if dir == nil || path == "" || path == "." {
return dir;
@@ -224,7 +224,7 @@ func (dir *Directory) lookup(path string) *Directory {
return d;
}
}
- return nil
+ return nil;
}
return dir.lookup(dpath).lookup(dname);
@@ -404,7 +404,7 @@ func htmlFmt(w io.Writer, x interface{}, format string) {
func htmlCommentFmt(w io.Writer, x interface{}, format string) {
var buf bytes.Buffer;
writeAny(&buf, x, false);
- doc.ToHtml(w, buf.Bytes()); // does html-escaping
+ doc.ToHtml(w, buf.Bytes()); // does html-escaping
}
@@ -416,7 +416,7 @@ func textFmt(w io.Writer, x interface{}, format string) {
// Template formatter for "dir" format.
func dirFmt(w io.Writer, x interface{}, format string) {
- _ = x.(*Directory); // die quickly if x has the wrong type
+ _ = x.(*Directory); // die quickly if x has the wrong type
if err := dirsHtml.Execute(x, w); err != nil {
log.Stderrf("dirsHtml.Execute: %s", err);
}
@@ -425,7 +425,7 @@ func dirFmt(w io.Writer, x interface{}, format string) {
func removePrefix(s, prefix string) string {
if strings.HasPrefix(s, prefix) {
- return s[len(prefix) : len(s)];
+ return s[len(prefix):len(s)];
}
return s;
}
@@ -471,7 +471,7 @@ var infoClasses = [nKinds]string{
// Template formatter for "infoClass" format.
func infoClassFmt(w io.Writer, x interface{}, format string) {
- fmt.Fprintf(w, infoClasses[x.(SpotInfo).Kind()]); // no html escaping needed
+ fmt.Fprintf(w, infoClasses[x.(SpotInfo).Kind()]); // no html escaping needed
}
@@ -530,12 +530,12 @@ func readTemplate(name string) *template.Template {
var (
dirsHtml,
- godocHtml,
- packageHtml,
- packageText,
- parseerrorHtml,
- parseerrorText,
- searchHtml *template.Template;
+ godocHtml,
+ packageHtml,
+ packageText,
+ parseerrorHtml,
+ parseerrorText,
+ searchHtml *template.Template;
)
func readTemplates() {
@@ -694,9 +694,9 @@ type PageInfo struct {
type httpHandler struct {
- pattern string; // url pattern; e.g. "/pkg/"
- fsRoot string; // file system root to which the pattern is mapped
- isPkg bool; // true if this handler serves real package documentation (as opposed to command documentation)
+ pattern string; // url pattern; e.g. "/pkg/"
+ fsRoot string; // file system root to which the pattern is mapped
+ isPkg bool; // true if this handler serves real package documentation (as opposed to command documentation)
}
@@ -754,14 +754,14 @@ func (h *httpHandler) getPageInfo(path string) PageInfo {
// or command-line mode); compute one level for this page
dir = newDirectory(dirname, 1);
}
-
+
return PageInfo{pdoc, dir, h.isPkg};
}
func (h *httpHandler) ServeHTTP(c *http.Conn, r *http.Request) {
path := r.Url.Path;
- path = path[len(h.pattern) : len(path)];
+ path = path[len(h.pattern):len(path)];
// canonicalize URL path and redirect if necessary
if canonical := pathutil.Clean(h.pattern + path) + "/"; r.Url.Path != canonical {
@@ -797,7 +797,7 @@ func (h *httpHandler) ServeHTTP(c *http.Conn, r *http.Request) {
_, pkgname := pathutil.Split(pathutil.Clean(path));
title = "Command " + pkgname;
default:
- title = "Command " + info.PDoc.PackageName
+ title = "Command " + info.PDoc.PackageName;
}
}
@@ -850,8 +850,8 @@ func search(c *http.Conn, r *http.Request) {
// Server
var (
- cmdHandler = httpHandler{"/cmd/", *cmdroot, false};
- pkgHandler = httpHandler{"/pkg/", *pkgroot, true};
+ cmdHandler = httpHandler{"/cmd/", *cmdroot, false};
+ pkgHandler = httpHandler{"/pkg/", *pkgroot, true};
)
@@ -885,4 +885,3 @@ func indexer() {
time.Sleep(1*60e9); // try once a minute
}
}
-
diff --git a/src/cmd/godoc/main.go b/src/cmd/godoc/main.go
index 289d4d4ba5..de051da2bf 100644
--- a/src/cmd/godoc/main.go
+++ b/src/cmd/godoc/main.go
@@ -46,7 +46,7 @@ var (
httpaddr = flag.String("http", "", "HTTP service address (e.g., ':6060')");
// layout control
- html = flag.Bool("html", false, "print HTML in command-line mode");
+ html = flag.Bool("html", false, "print HTML in command-line mode");
)
@@ -79,7 +79,7 @@ func exec(c *http.Conn, args []string) (status int) {
return 2;
}
status = wait.ExitStatus();
- if !wait.Exited() || status > 1 {
+ if !wait.Exited() || status > 1 {
os.Stderr.Write(buf.Bytes());
log.Stderrf("executing %v failed (exit status = %d)", args, status);
return;
@@ -98,7 +98,7 @@ func exec(c *http.Conn, args []string) (status int) {
// Maximum directory depth, adjust as needed.
-const maxDirDepth = 24;
+const maxDirDepth = 24
func dosync(c *http.Conn, r *http.Request) {
args := []string{"/bin/sh", "-c", *syncCmd};
@@ -125,7 +125,7 @@ func dosync(c *http.Conn, r *http.Request) {
func usage() {
fmt.Fprintf(os.Stderr,
"usage: godoc package [name ...]\n"
- " godoc -http=:6060\n");
+ " godoc -http=:6060\n");
flag.PrintDefaults();
os.Exit(2);
}
diff --git a/src/cmd/godoc/spec.go b/src/cmd/godoc/spec.go
index ee9ff4e048..a473fc7b44 100644
--- a/src/cmd/godoc/spec.go
+++ b/src/cmd/godoc/spec.go
@@ -125,7 +125,8 @@ func (p *ebnfParser) parseTerm() bool {
func (p *ebnfParser) parseSequence() {
- for p.parseTerm() {}
+ for p.parseTerm() {
+ }
}
diff --git a/src/cmd/goyacc/doc.go b/src/cmd/goyacc/doc.go
index b6a2580f14..ea5813ebc3 100644
--- a/src/cmd/goyacc/doc.go
+++ b/src/cmd/goyacc/doc.go
@@ -17,7 +17,7 @@ Yacc adepts will have no trouble adapting to this form of the tool.
The file units.y in this directory is a yacc grammar for a version of
the Unix tool units, also written in Go and largely transliterated
-from the Plan 9 C version.
+from the Plan 9 C version.
*/
package documentation