Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

godoc chokes on symlink #1540

Closed
oerdnj opened this issue Feb 21, 2011 · 7 comments
Closed

godoc chokes on symlink #1540

oerdnj opened this issue Feb 21, 2011 · 7 comments

Comments

@oerdnj
Copy link

oerdnj commented Feb 21, 2011

What steps will reproduce the problem?
1. Install source files to /usr/share/golang/src
2. Install GOROOT to /usr/lib/golang
3. Create symlink from /usr/share/golang/src to /usr/lib/golang/src
4. Run godoc -http=:6060
5. Point a browser to <URL>:6060/cmd/ (or /pkg/)

What is the expected output?
Full list of commands (or packages) as seen on golang.org including the subdirectories
(for /pkg/) and synopsis.

What do you see instead?
List of directories in /pkg/ or /cmd/ without synopsis.

Which operating system are you using?
Linux, .DEB

Which revision are you using?  (hg identify)
release.2011-02-15

Additional information?
Copying the src directory directly under the /usr/lib/golang/ fixes the problem.

I think the problem is in the index, since the errorneous log output includes following
lines:

2011/02/21 14:56:21 updating index...
2011/02/21 14:56:21 index updated (0s, 0 bytes of source, 0 files, 0 lines, 0 unique
words, 0 spots)

and the correct one should look like this:
2011/02/21 14:58:00 updating index...
2011/02/21 14:58:32 index updated (31.305s, 5506098 bytes of source, 828 files, 202606
lines, 16522 unique words, 322828 spots)
@adg
Copy link
Contributor

adg commented Feb 22, 2011

Comment 1:

path.Walk doesn't follow symlinks, and I understand that this is to avoid circular
behaviour.
I'm not sure where the fix is, if any. Godoc could kick off an additional Walk when its
VisitFile encounters a symlink'd directory. Or path.Walk could have an option to follow
symlinks. Or we could mandate that the goroot be intact and free of symlinks for our
tools to work.
To solve this specific problem, why not make /usr/share/godoc/src a symlink to
/usr/lib/golang/src ?

Owner changed to a...@golang.org.

Status changed to Thinking.

@oerdnj
Copy link
Author

oerdnj commented Feb 22, 2011

Comment 2:

> Godoc could kick off an additional Walk when its VisitFile encounters a symlink'd
directory.
That would probably be the best sollution (with limiting max depth to something like 3
or 5).
But the easies workaround would be to resolve the symlink on the first level (ie. just
resolve the /usr/lib/golang/src and run path.Walk inside the resolved path).
> To solve this specific problem, why not make /usr/share/godoc/src a symlink to
/usr/lib/golang/src ?
It links to #1539 (ie. architecture-independent files should be in
/usr/share/<something>).

@rsc
Copy link
Contributor

rsc commented Feb 22, 2011

Comment 3:

godoc doesn't support symlinks in directory hierarchies
If you stop letting yourself get pushed around by FHS
you will be happier.
Russ

Status changed to WorkingAsIntended.

@oerdnj
Copy link
Author

oerdnj commented Feb 22, 2011

Comment 4:

> If you stop letting yourself get pushed around by FHS
> you will be happier.
The thing is not being pushed by FHS but it's either go will be included in major
distributions like Debian (aka FHS) or not (no FHS support).
Anyway no hard feelings, I'll fix it myself just for Debian (and other distros could
pick it up from my git repo).

@gopherbot
Copy link

Comment 5 by wwaites:

A very minor clash with my development practice encountered this same problem. I like to
do
    ln -s ~/src/gostuff ~/go/src/pkg/bitbucket/ww
and of course that breaks godoc. As I said a minor inconvenience - to check the
documentation
I have to push to bitbucket and then install with goinstall. A patch to fix this in
godoc is attached
but "go doesn't support symlinks in directory hierarchies" sounds rather categorical...

Attachments:

  1. godoc-symlinks.diff (1769 bytes)

@oerdnj
Copy link
Author

oerdnj commented Feb 27, 2011

Comment 6:

Cool, I'll incorporate the patch into the Debian package as soon as I get back from my
vacation.

@gopherbot
Copy link

Comment 7 by dmitry@dsa.pp.ru:

I've got another patch to fix the problem.

Attachments:

  1. godoc-symlinks.diff (778 bytes)

@golang golang locked and limited conversation to collaborators Jun 24, 2016
@rsc rsc unassigned adg Jun 22, 2022
This issue was closed.
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

No branches or pull requests

4 participants