Skip to content
This repository was archived by the owner on Aug 24, 2022. It is now read-only.

Commit 93d124a

Browse files
committed
add pkgdoc sketch code
1 parent de117c8 commit 93d124a

File tree

7 files changed

+882
-0
lines changed

7 files changed

+882
-0
lines changed

pkgdoc/a.go

+18
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,18 @@
1+
// Copyright 2015 ChaiShushan <chaishushan{AT}gmail.com>. All rights reserved.
2+
// Use of this source code is governed by a BSD-style
3+
// license that can be found in the LICENSE file.
4+
5+
package pkgdoc
6+
7+
import (
8+
"fmt"
9+
"go/doc"
10+
)
11+
12+
func Register(local string, pkgDoc *doc.Package) error {
13+
return fmt.Errorf("pkgdoc: TODO")
14+
}
15+
16+
func Getdoc(local string, pkgDoc *doc.Package) *doc.Package {
17+
return pkgDoc
18+
}

pkgdoc/a_test.go

+13
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
// Copyright 2015 ChaiShushan <chaishushan{AT}gmail.com>. All rights reserved.
2+
// Use of this source code is governed by a BSD-style
3+
// license that can be found in the LICENSE file.
4+
5+
package pkgdoc
6+
7+
import (
8+
"testing"
9+
)
10+
11+
func TestFoo(t *testing.T) {
12+
// TODO
13+
}

pkgdoc/example/example.go

+56
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,56 @@
1+
// Copyright 2015 ChaiShushan <chaishushan{AT}gmail.com>. All rights reserved.
2+
// Use of this source code is governed by a BSD-style
3+
// license that can be found in the LICENSE file.
4+
5+
/*
6+
Package example is a example for pkgdoc.
7+
8+
Example:
9+
func main() {
10+
println("Hello, 世界")
11+
}
12+
13+
Please report bugs to <chaishushan{AT}gmail.com>.
14+
Thanks!
15+
*/
16+
package example
17+
18+
// TODO(chai2010): Add more examples.
19+
20+
// BUG(chai2010): Just a bug example.
21+
22+
// const1 doc.
23+
const (
24+
CONST1_A = 'A' // doc CONST1_A?
25+
CONST1_B = 'B'
26+
CONST1_Byte = Byte('A')
27+
CONST1_MyInt = MyInt('A')
28+
)
29+
30+
// const2 doc.
31+
const (
32+
CONST2_A = 'A'
33+
CONST2_B = 'B'
34+
CONST2_Byte = Byte('A')
35+
CONST2_MyInt = MyInt('A')
36+
)
37+
38+
const CONST3_NO_DOC = "xxx"
39+
40+
// Byte type doc.
41+
type Byte uint8
42+
43+
func PrintByte(a Byte) {
44+
//
45+
}
46+
47+
// MyInt type doc.
48+
type MyInt int
49+
50+
func PrintMyInt(a MyInt) {
51+
//
52+
}
53+
54+
func (p MyInt) Print() {
55+
//
56+
}

pkgdoc/image/image.go

+118
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,118 @@
1+
// Copyright 2015 ChaiShushan <chaishushan{AT}gmail.com>. All rights reserved.
2+
// Use of this source code is governed by a BSD-style
3+
// license that can be found in the LICENSE file.
4+
5+
// AUTO GENERATED, DONOT EDIT!!!
6+
7+
package image
8+
9+
import (
10+
"go/doc"
11+
12+
"github.com/chai2010/golangdoc/pkgdoc"
13+
)
14+
15+
func init() {
16+
pkgdoc.Register("default", &doc.Package{
17+
Name: pkgName,
18+
ImportPath: pkgImportPath,
19+
Doc: pkgDoc,
20+
Notes: pkgNotes,
21+
Bugs: pkgBugs,
22+
Consts: pkgConsts,
23+
Types: pkgTypes,
24+
Vars: pkgVars,
25+
Funcs: pkgFuncs,
26+
})
27+
}
28+
29+
var pkgName = "image"
30+
31+
var pkgImportPath = "image"
32+
33+
var pkgDoc = `
34+
Package image implements a basic 2-D image library.
35+
36+
The fundamental interface is called Image. An Image contains colors,
37+
which are described in the image/color package.
38+
39+
Values of the Image interface are created either by calling functions
40+
such as NewRGBA and NewPaletted, or by calling Decode on an io.Reader
41+
containing image data in a format such as GIF, JPEG or PNG. Decoding any
42+
particular image format requires the prior registration of a decoder
43+
function. Registration is typically automatic as a side effect of
44+
initializing that format's package so that, to decode a PNG image, it
45+
suffices to have
46+
47+
import _ "image/png"
48+
49+
in a program's main package. The _ means to import a package purely for
50+
its initialization side effects.
51+
52+
See "The Go image package" for more details:
53+
http://golang.org/doc/articles/image_package.html
54+
`
55+
56+
var pkgNotes = map[string][]*doc.Note{
57+
"TODO": []*doc.Note{
58+
&doc.Note{
59+
UID: "chai2010",
60+
Body: "example",
61+
},
62+
},
63+
}
64+
65+
var pkgBugs = []string{}
66+
67+
var pkgConsts = []*doc.Value{
68+
&doc.Value{
69+
Doc: "",
70+
Names: []string{},
71+
},
72+
}
73+
74+
var pkgTypes = []*doc.Type{
75+
&doc.Type{
76+
Doc: "",
77+
Name: "",
78+
79+
Consts: []*doc.Value{
80+
&doc.Value{
81+
Doc: "",
82+
Names: []string{},
83+
},
84+
},
85+
Vars: []*doc.Value{
86+
&doc.Value{
87+
Doc: "",
88+
Names: []string{},
89+
},
90+
},
91+
Funcs: []*doc.Func{
92+
&doc.Func{
93+
Doc: "",
94+
Name: "",
95+
},
96+
},
97+
Methods: []*doc.Func{
98+
&doc.Func{
99+
Doc: "",
100+
Name: "",
101+
},
102+
},
103+
},
104+
}
105+
106+
var pkgVars = []*doc.Value{
107+
&doc.Value{
108+
Doc: "",
109+
Names: []string{},
110+
},
111+
}
112+
113+
var pkgFuncs = []*doc.Func{
114+
&doc.Func{
115+
Doc: "",
116+
Name: "",
117+
},
118+
}

0 commit comments

Comments
 (0)