summaryrefslogtreecommitdiff
path: root/src/cmd/godoc/snippet.go
diff options
context:
space:
mode:
authorOndřej Surý <ondrej@sury.org>2012-04-06 15:14:11 +0200
committerOndřej Surý <ondrej@sury.org>2012-04-06 15:14:11 +0200
commit505c19580e0f43fe5224431459cacb7c21edd93d (patch)
tree79e2634c253d60afc0cc0b2f510dc7dcbb48497b /src/cmd/godoc/snippet.go
parent1336a7c91e596c423a49d1194ea42d98bca0d958 (diff)
downloadgolang-505c19580e0f43fe5224431459cacb7c21edd93d.tar.gz
Imported Upstream version 1upstream/1
Diffstat (limited to 'src/cmd/godoc/snippet.go')
-rw-r--r--[-rwxr-xr-x]src/cmd/godoc/snippet.go18
1 files changed, 15 insertions, 3 deletions
diff --git a/src/cmd/godoc/snippet.go b/src/cmd/godoc/snippet.go
index 68e27d9a0..b482b7487 100755..100644
--- a/src/cmd/godoc/snippet.go
+++ b/src/cmd/godoc/snippet.go
@@ -11,9 +11,9 @@ package main
import (
"bytes"
+ "fmt"
"go/ast"
"go/token"
- "fmt"
)
type Snippet struct {
@@ -62,7 +62,14 @@ func genSnippet(fset *token.FileSet, d *ast.GenDecl, id *ast.Ident) *Snippet {
}
// only use the spec containing the id for the snippet
- dd := &ast.GenDecl{d.Doc, d.Pos(), d.Tok, d.Lparen, []ast.Spec{s}, d.Rparen}
+ dd := &ast.GenDecl{
+ Doc: d.Doc,
+ TokPos: d.Pos(),
+ Tok: d.Tok,
+ Lparen: d.Lparen,
+ Specs: []ast.Spec{s},
+ Rparen: d.Rparen,
+ }
return newSnippet(fset, dd, id)
}
@@ -73,7 +80,12 @@ func funcSnippet(fset *token.FileSet, d *ast.FuncDecl, id *ast.Ident) *Snippet {
}
// only use the function signature for the snippet
- dd := &ast.FuncDecl{d.Doc, d.Recv, d.Name, d.Type, nil}
+ dd := &ast.FuncDecl{
+ Doc: d.Doc,
+ Recv: d.Recv,
+ Name: d.Name,
+ Type: d.Type,
+ }
return newSnippet(fset, dd, id)
}