| Age | Commit message (Collapse) | Author |
|
With help of spdxconv tool [1], we able to bulk update all files license
and copyright format to comply with SPDX formats.
[1] https://kilabit.info/project/spdxconv/
|
|
The GoEmbed test that write Go embedded code into "internal/test/embed/"
may create unnecessary changes when the test run on new clone of this
repository, or when we run "go test" again on that package after rebasing.
|
|
Package hexdump implements reading and writing bytes from and into
hexadecimal number.
It support parsing output from hexdump(1) tool.
|
|
While at it, temporary disable gosec due to excessive report for G115,
which may be true, but may also break the current working program.
We should alter and fix once we can test and make sure that it does not
breaks.
|
|
In previous commit we use wrong condition when handling directory "." as
Root.
|
|
In [MemFS.refresh], if the requested url is "/file1" and [Options.Root]
is ".", the path during refresh become "file1" and if passed to
[filepath.Dir] it will return ".".
This cause the loop on refresh never end because there is no PathNodes
equal with ".".
|
|
Using octal in mode make the code more readable, for example mode with
permission "0o644" much more readable than 420.
|
|
|
|
There are several reasons that why we move from github.com.
First, related to the name of package.
We accidentally name the package with "share" a common word in English
that does not reflect the content of repository.
By moving to other repository, we can rename it to better and unique
name, in this "pakakeh.go".
Pakakeh is Minang word for tools, and ".go" suffix indicate that the
repository related to Go programming language.
Second, supporting open source.
The new repository is hosted under sourcehut.org, the founder is known
to support open source, and all their services are licensed under AGPL,
unlike GitHub that are closed sources.
Third, regarding GitHub CoPilot.
The GitHub Terms of Service [1], allow any public content that are hosted
there granted them to parse the content.
On one side, GitHub helps and flourish the open source, but on another
side have an issues regarding scraping the copyleft license [2].
[1]: https://docs.github.com/en/site-policy/github-terms/github-terms-of-service#4-license-grant-to-us
[2]: https://githubcopilotinvestigation.com
|
|
This implemented simplified version of merging multiple MemFS instances.
The sub file system (subfs) can be added to the parent MemFS instance
by calling new method "Merge".
parent.Merge(other *MemfS)
When Get method called, each subfs will be evaluated in order of Merge
called.
This deprecated the function Merge.
|
|
Instead of refreshing from the Root, find the directory that closes
to the requested path.
While at it, simplify the returned error.
|
|
In this changes, we simplify re-scanning the directory content.
Instead of looping on node Childs to detect new or delete files, use map
to store previous Childs first.
If node path exist in map then add it again as child, otherwise delete it.
|
|
Even thought empty directory does not contains file, from the parent
node _it is_ part of their content.
Also, there is a use case where memfs use as virtual file system (VFS),
as a layer with file system, where user can view list of directory,
create a directory or file on the fly.
If we skip scanning empty directory, that directory will not be visible.
|
|
Instead of calling filepath.EvalSymlink and Lstat, call os.Stat directly
to the symlink system path.
This also fix the modTime not currently set to the original file when
creating Node from symlink-ed file.
|
|
Replace ":=" with "var" and realign the field assignments.
|
|
In the next gofmt (Go v1.19), the comment format does not allow empty
lines "//" at the top and bottom of the comment.
This changes make the generated Go code from Embed method to match
as close as possible with output of gofmt.
|
|
|
|
Previously, we assume that the PathNodes from instance of MemFS is
already up to date.
If PathNodes is initialized by previous GoEmbed and the Root directory
contains new files or directories, that new files does not get
embedded.
This changes fix this issue by force re-mount the whole Root directory
before generating the Go file.
|
|
The CommentHeader option allow user to define custom header to the Go
generated file.
The string value is not checked, whether it's a comment or not, it
will rendered as is.
|
|
Previous commits, embed the GenFuncName into the generated Go embed file
which forgot to update the unit tests.
|
|
The original idea for option ContentEncoding in EmbedOptions and Node
is to save spaces, compressing the content on disk on embedding and
doing transport, when the MemFS instance is used to serve the (embedded)
contents of file system.
This option turns out break the HTTP content negotiation [1] of
accept-encoding header, if the HTTP server does not handle it properly,
which default Go HTTP server does not.
In order to prevent this issue in the future, for anyone who use the
memfs for serving static HTTP contents, we remove the options and store
the embedded content as is and let the HTTP server handle how the
compression by itself.
[1] https://developer.mozilla.org/en-US/docs/Web/HTTP/Content_negotiation
|
|
This is to remove "embed_test" being displayed on the documentation page.
|
|
Since the GoEmbed can be called only when MemFS instance is initiated,
it would be better if parameters for GoEmbed also initialized in the
struct Options.
In this way any additional parameters needed to add to GoEmbed does not
changes the method signature in the future.
This commit add new type EmbedOptions that contains the parameters
for GoEmbed.
In this new type, we add new field EmbedWithoutModTime.
if its true, the modification time for all files and directories are not
stored inside generated code, instead all files will use the current
time when the program is running.
|