You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
The reason for these being nested is so that we can embed the entire examples/templates directory, including subdirectories (see #1669), without also including the source code of the examples Go package itself. As far as I can see, the embed package doesn't provide a way to recursively embed a directory while also excluding a configurable subset of files.
I figured the inelegance of an extra level in the directory hierarchy was better than the inelegance of bundling files that never get used, but YMMV.
Removing this nesting would require filtering out non-directories in examples.List instead, and also reverting the documentation changes that were made in #1715.
Activity
dwahler commentedon Jun 10, 2022
The reason for these being nested is so that we can embed the entire
examples/templatesdirectory, including subdirectories (see #1669), without also including the source code of theexamplesGo package itself. As far as I can see, theembedpackage doesn't provide a way to recursively embed a directory while also excluding a configurable subset of files.I figured the inelegance of an extra level in the directory hierarchy was better than the inelegance of bundling files that never get used, but YMMV.
Removing this nesting would require filtering out non-directories in
examples.Listinstead, and also reverting the documentation changes that were made in #1715.kylecarbs commentedon Jun 12, 2022
@dwahler would
embed ./*/*include the source code itself?The user experience is a bit odd with the nesting because it appears that
examplesis just a package. Having these at an upper-level fixes it I think.