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
59ee0373
Commit
59ee0373
authored
Jul 14, 2009
by
Robert Griesemer
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
- removed TODO, minor adjustments
R=rsc DELTA=16 (6 added, 1 deleted, 9 changed) OCL=31638 CL=31641
parent
f752e909
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
14 additions
and
9 deletions
+14
-9
src/cmd/godoc/godoc.go
src/cmd/godoc/godoc.go
+14
-9
No files found.
src/cmd/godoc/godoc.go
View file @
59ee0373
...
...
@@ -169,10 +169,13 @@ func parse(path string, mode uint) (*ast.Program, *parseErrors) {
prog
,
err
:=
parser
.
Parse
(
path
,
src
,
mode
);
if
err
!=
nil
{
// sort and convert error list
var
errs
[]
parseError
;
if
errors
,
ok
:=
err
.
(
scanner
.
ErrorList
);
ok
{
sort
.
Sort
(
errors
);
errs
:=
make
([]
parseError
,
len
(
errors
)
+
1
);
// +1 for final fragment of source
// convert error list (already sorted)
// TODO(gri) If the file contains //line comments, the errors
// may not be sorted in increasing file offset value
// which will lead to incorrect output.
errs
=
make
([]
parseError
,
len
(
errors
)
+
1
);
// +1 for final fragment of source
offs
:=
0
;
for
i
,
r
:=
range
errors
{
// Should always be true, but check for robustness.
...
...
@@ -184,11 +187,13 @@ func parse(path string, mode uint) (*ast.Program, *parseErrors) {
errs
[
i
]
.
msg
=
r
.
Msg
;
}
errs
[
len
(
errors
)]
.
src
=
src
[
offs
:
len
(
src
)];
return
nil
,
&
parseErrors
{
path
,
errs
,
src
};
}
else
{
// TODO should have some default handling here to be more robust
panic
(
"unreachable"
);
// single error of unspecified type
errs
=
make
([]
parseError
,
2
);
errs
[
0
]
=
parseError
{[]
byte
{},
0
,
err
.
String
()};
errs
[
1
]
.
src
=
src
;
}
return
nil
,
&
parseErrors
{
path
,
errs
,
src
};
}
return
prog
,
nil
;
...
...
@@ -478,7 +483,7 @@ func findPackage(path string) (canonical string, pd *pakDesc, dirs dirList) {
}
func
(
p
*
pakDesc
)
D
oc
()
(
*
doc
.
PackageDoc
,
*
parseErrors
)
{
func
(
p
*
pakDesc
)
d
oc
()
(
*
doc
.
PackageDoc
,
*
parseErrors
)
{
if
p
==
nil
{
return
nil
,
nil
;
}
...
...
@@ -519,7 +524,7 @@ func servePkg(c *http.Conn, r *http.Request) {
return
;
}
pdoc
,
errors
:=
desc
.
D
oc
();
pdoc
,
errors
:=
desc
.
d
oc
();
if
errors
!=
nil
{
serveParseErrors
(
c
,
errors
);
return
;
...
...
@@ -695,7 +700,7 @@ func main() {
}
_
,
desc
,
dirs
:=
findPackage
(
flag
.
Arg
(
0
));
pdoc
,
errors
:=
desc
.
D
oc
();
pdoc
,
errors
:=
desc
.
d
oc
();
if
errors
!=
nil
{
err
:=
parseerrorText
.
Execute
(
errors
,
os
.
Stderr
);
if
err
!=
nil
{
...
...
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