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

Prevent recursion into output folder? #62

Open
ianrose14 opened this issue Jan 23, 2024 · 16 comments
Open

Prevent recursion into output folder? #62

ianrose14 opened this issue Jan 23, 2024 · 16 comments

Comments

@ianrose14
Copy link

Hi!

I'm invoking like this:

gopages -out godocs/

from within the main directory of my project (e.g. the same directory as go.mod, etc)

I find that gopages seems to be re-reading its own output as new input? In other words, it is creating files like:

godocs/index.html
godocs/src/wattch/godocs/index.html
godocs/src/wattch/godocs/src/wattch/godocs/index.html
godocs/src/wattch/godocs/src/wattch/godocs/src/wattch/godocs/index.html
(etc)

After quite a long time, the program fails with this error:

Error generating page [...] file name too long

Can I somehow tell gopages to exclude/ignore the output directory?

@pashagolub
Copy link

I can confirm this

@JohnStarich
Copy link
Owner

Huh, that’s odd! Do you have an example repo or module I could run this on to reproduce?

@pashagolub
Copy link

Sure! Try this one:

git clone https://github.com/cybertec-postgresql/pgwatch.git

cd pgwatch

gopages -out "docs/godoc"

@JohnStarich
Copy link
Owner

Thanks!

So I've tried to reproduce with this repo, but I'm not hitting any errors or the recursive fun time going on for you. Granted I'm running on Linux, but I could try others to match your system.

Does this happen pretty consistently for you? Is there a specific file system (e.g. network share, Windows volume) or particular OS it occurs on?

@JohnStarich
Copy link
Owner

Oh and please share the Go version you used to install gopages and the version installed on the system gopages runs on.

I suspect the logic to run go list $package_pattern (via golang.org/x/tools/go/packages) is using the local Go version and is misbehaving.

@JohnStarich
Copy link
Owner

I've merged some dependency updates via #67 and cut release gopages/v0.1.28. Please let me know if that release fixed your issue!

@pashagolub
Copy link

Thanks, I'll try tomorrow!

@pashagolub
Copy link

No, the problem still persists for gopages v0.1.28

@JohnStarich
Copy link
Owner

JohnStarich commented Oct 9, 2024 via email

@pashagolub
Copy link

git clone https://github.com/cybertec-postgresql/pgwatch.git

cd pgwatch

gopages -out "docs/godoc"

This will never end and consume all space or throw OS error because of path limit. :) So it's wise to kill it ASAP. In "doc/godoc" you will find the recursion

@JohnStarich
Copy link
Owner

Can you provide more details about your machine and Go version?

I ran this on my machine and it completes successfully in about a second.

@pashagolub
Copy link

Sure!

go version go1.23.0 windows/amd64
Microsoft Windows 11 Pro 22621.1.amd64fre.ni_release.220506-1250

@pashagolub
Copy link

I tried to run test in docker container with Debian GNU/Linux 12 (bookworm) and can confirm there is no error on Linux.

@JohnStarich
Copy link
Owner

Got it, thanks! I can reproduce now. That's a mighty large directory O.O

@JohnStarich
Copy link
Owner

As a temporary work-around, you could run gopages without an output directory in your repo and move it into place afterward.

@pashagolub
Copy link

That's exactly what I do right now :)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants