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
e3749536
Commit
e3749536
authored
Feb 01, 2010
by
Robert Griesemer
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
don't report a couple of meaningless errors in command-line mode
R=rsc CC=golang-dev
https://golang.org/cl/199045
parent
d2fc5d68
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
8 additions
and
7 deletions
+8
-7
src/cmd/godoc/godoc.go
src/cmd/godoc/godoc.go
+6
-5
src/cmd/godoc/main.go
src/cmd/godoc/main.go
+2
-2
No files found.
src/cmd/godoc/godoc.go
View file @
e3749536
...
...
@@ -1036,12 +1036,13 @@ type httpHandler struct {
}
// getPageInfo returns the PageInfo for a given package directory.
// getPageInfo returns the PageInfo for a package directory path. 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
(
path
string
)
PageInfo
{
func
(
h
*
httpHandler
)
getPageInfo
(
path
string
,
try
bool
)
PageInfo
{
// the path is relative to h.fsroot
dirname
:=
pathutil
.
Join
(
h
.
fsRoot
,
path
)
...
...
@@ -1066,11 +1067,11 @@ func (h *httpHandler) getPageInfo(path string) PageInfo {
// get package AST
pkgs
,
err
:=
parser
.
ParseDir
(
dirname
,
filter
,
parser
.
ParseComments
)
if
err
!=
nil
{
if
err
!=
nil
&&
!
try
{
// TODO: errors should be shown instead of an empty directory
log
.
Stderrf
(
"parser.parseDir: %s"
,
err
)
}
if
len
(
pkgs
)
!=
1
{
if
len
(
pkgs
)
!=
1
&&
!
try
{
// TODO: should handle multiple packages
log
.
Stderrf
(
"parser.parseDir: found %d packages"
,
len
(
pkgs
))
}
...
...
@@ -1110,7 +1111,7 @@ func (h *httpHandler) ServeHTTP(c *http.Conn, r *http.Request) {
path
:=
r
.
URL
.
Path
path
=
path
[
len
(
h
.
pattern
)
:
]
info
:=
h
.
getPageInfo
(
path
)
info
:=
h
.
getPageInfo
(
path
,
false
)
var
buf
bytes
.
Buffer
if
r
.
FormValue
(
"f"
)
==
"text"
{
...
...
src/cmd/godoc/main.go
View file @
e3749536
...
...
@@ -220,11 +220,11 @@ func main() {
packageText
=
packageHTML
}
info
:=
pkgHandler
.
getPageInfo
(
flag
.
Arg
(
0
))
info
:=
pkgHandler
.
getPageInfo
(
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
))
info
=
cmdHandler
.
getPageInfo
(
flag
.
Arg
(
0
)
,
false
)
}
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