Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
G
go
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
Analytics
Analytics
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Commits
Issue Boards
Open sidebar
Kirill Smelkov
go
Commits
cf743c1b
Commit
cf743c1b
authored
Feb 19, 2010
by
Robert Griesemer
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
godoc: make commandline use work again
R=rsc CC=golang-dev
https://golang.org/cl/216054
parent
a5c29da3
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
7 additions
and
10 deletions
+7
-10
src/cmd/godoc/godoc.go
src/cmd/godoc/godoc.go
+5
-8
src/cmd/godoc/main.go
src/cmd/godoc/main.go
+2
-2
No files found.
src/cmd/godoc/godoc.go
View file @
cf743c1b
...
...
@@ -1100,14 +1100,12 @@ type httpHandler struct {
}
// getPageInfo returns the PageInfo for a package directory
path
. If
// getPageInfo returns the PageInfo for a package directory
dirname
. If
// the parameter try is true, no errors are logged if getPageInfo fails.
// If there is no corresponding package in the directory, PageInfo.PDoc
// is nil. If there are no subdirectories, PageInfo.Dirs is nil.
//
func
(
h
*
httpHandler
)
getPageInfo
(
relpath
string
,
try
bool
)
PageInfo
{
dirname
:=
absolutePath
(
relpath
,
h
.
fsRoot
)
func
(
h
*
httpHandler
)
getPageInfo
(
dirname
,
relpath
string
,
try
bool
)
PageInfo
{
// filter function to select the desired .go files
filter
:=
func
(
d
*
os
.
Dir
)
bool
{
// If we are looking at cmd documentation, only accept
...
...
@@ -1129,9 +1127,7 @@ func (h *httpHandler) getPageInfo(relpath string, try bool) PageInfo {
// Get the best matching package: either the first one, or the
// first one whose package name matches the directory name.
// The package name is the directory name within its parent
// (use dirname instead of path because dirname is clean; i.e.
// has no trailing '/').
// The package name is the directory name within its parent.
_
,
pkgname
:=
pathutil
.
Split
(
dirname
)
var
pkg
*
ast
.
Package
for
_
,
p
:=
range
pkgs
{
...
...
@@ -1177,7 +1173,8 @@ func (h *httpHandler) ServeHTTP(c *http.Conn, r *http.Request) {
}
relpath
:=
r
.
URL
.
Path
[
len
(
h
.
pattern
)
:
]
info
:=
h
.
getPageInfo
(
relpath
,
false
)
abspath
:=
absolutePath
(
relpath
,
h
.
fsRoot
)
info
:=
h
.
getPageInfo
(
abspath
,
relpath
,
false
)
if
r
.
FormValue
(
"f"
)
==
"text"
{
contents
:=
applyTemplate
(
packageText
,
"packageText"
,
info
)
...
...
src/cmd/godoc/main.go
View file @
cf743c1b
...
...
@@ -224,11 +224,11 @@ func main() {
packageText
=
packageHTML
}
info
:=
pkgHandler
.
getPageInfo
(
flag
.
Arg
(
0
),
true
)
info
:=
pkgHandler
.
getPageInfo
(
flag
.
Arg
(
0
),
flag
.
Arg
(
0
),
true
)
if
info
.
PDoc
==
nil
&&
info
.
Dirs
==
nil
{
// try again, this time assume it's a command
info
=
cmdHandler
.
getPageInfo
(
flag
.
Arg
(
0
),
false
)
info
=
cmdHandler
.
getPageInfo
(
flag
.
Arg
(
0
),
f
lag
.
Arg
(
0
),
f
alse
)
}
if
info
.
PDoc
!=
nil
&&
flag
.
NArg
()
>
1
{
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment