gohugoio / hugo

The world’s fastest framework for building websites.
https://gohugo.io
Apache License 2.0
76.2k stars 7.55k forks source link

Make readDir/readFile more precise and flexible #9604

Open bep opened 2 years ago

bep commented 2 years ago

See #9599

There are historical reasons to this, I'm sure, but the current behaviour is hard to understand, document and is not as flexible as it easily could be.

So, I suggest adding a filesystem option to both of these functions:

The new default (that work is project work dir only) is a slightly breaking change, but I suspect it's going to solve more issues than it creates.

bep commented 2 years ago

I have marked this as a "GoodFirstIssue" which I think is true, as it's very isolated. Add some failing testcases to tpl/os/integration_test.go would be a good start. I suggest adding a GetFilesystemByName or something to the BaseFS struct and use the constants infiles.