| Age | Commit message (Collapse) | Author |
|
=== Breaking changes
* lib/json: remove solidus (slash) from being escaped/un-escaped
=== Bug fixes
* lib/memfs: fix SIGSEGV when node is deleted when being watched
=== New features
lib/text: add custom MarshalJSON to type Chunk and Line
=== Chores
* lib/memfs: simplify checking for symlink
* lib/http: increase time sleep waiting for server on example endpoint
* text/diff: rewrite the test using test.Data
* _doc: cleaning up the documentation
* lib/totp: cleaning up the codes
|
|
|
|
The panic is caused by the item in slice of Childs is being
removed during iteration.
To fix this, we remove the childs on the second iteration after
we remove any sub directories inside them.
|
|
While at it change the isIncluded parameter from os.FileMode to
os.FileInfo.
|
|
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.
|
|
On container, sometimes the test fail with the following error
2022-08-28 19:32:21 UTC DefaultErrorHandler: POST /error/custom:
Custom error
2022/08/28 19:32:22 Do: Get "http://127.0.0.1:7016/?":
dial tcp 127.0.0.1:7016: connect: connection refused
FAIL github.com/shuLhan/share/lib/http 1.583s
This was caused by server is not ready yet to accept connection when
testing executed.
|
|
Using test.Data provide much more readable input and outputs and
simplify modifying the test data instead of manually define the
expected output in struct.
|
|
|
|
The standard json package does not escape the solidus, even though the
RFC said so.
Someone also report this as an error in RFC [1] by removing solidus
from list of escaped characters but the author itself reject it.
[1] https://www.rfc-editor.org/errata/eid3159
|
|
In the _doc, we remove generated HTML files.
In the index, we add link to README and section about Development that
include links to repository, issues, and patches.
In the README, we reformat it to use AsciiDoc markup, remove the
sanitizer library, add CLI for epoch, ini, and xtrk.
|
|
This changes replace ":=" with explicit variable declarations and use
raw string literal whenever possible.
|
|
=== Breaking changes
* lib/memfs: set the Root SysPath to the first MemFS instance on
Merge
* lib/memfs: rename Option field Development to TryDirect
=== New features
* _bin: add script to run Go benchmark
* _bin: add script to run Go test and generate HTML coverage
* _bin: add script go-mod-tip.sh
* cmd/epoch: print the weekday in local and UTC time
* cmd/epoch: add flag to parse time from RFC3339 and RFC1123 format
* cmd/ini: a CLI to get and set values in the INI file format
* lib/test: implement Data, a type to load formatted file for helping
test
=== Bug fixes
* lib/ini: fix parsing and saving multi line variables
* lib/ini: fix marshaling pointer to nil field
* lib/memfs: ignore error on Get when calling node Update
=== Enhancements
* lib/dns: add field SOA to the ServerOptions
* lib/http: add server options to generate index.html automatically
* lib/ini: support escaped double-quote and colon in tag subsection
* lib/ini: handle marshaling slice of time.Time
|
|
|
|
The go-bench.sh accept two arguments: the method or function to benchmark,
default to "."; and benchmark number, default to current timestamp
YYYYmmDD-HHMM.
|
|
The idea on using select is to prevent the process being blocked when
sending to channel that is already full.
|
|
The SOA field defined the root authority for all zones and records
served under the Server.
|
|
|
|
Changes,
* Use test.Data for test that require longer text input and output
* Replace variable declaration ":=" with explicit one.
* Use literal string
|
|
If the EnableIndexHtml in the ServeOptions enabled, server generate
list of files inside the requested path as HTML.
|
|
The GenerateIndexHtml generate simple directory listing as HTML for
all child in the node.
This method is only applicable if node is a directory.
|
|
|
|
|
|
|
|
We only do lock on exported methods, but when doing testing we call
the send method without lock which cause read and write on Client.conn
at the same time.
|
|
This is to prevent the test failed due to the same port number (8053)
has already been used (another DNS server already running).
|
|
The PKGBUILD create Arch package named share-tools.
Its include command epoch, ini, and xtrk.
|
|
The script accept one single argument: the path to package to
be tested.
If its empty default to current directory and sub-directories.
|
|
The go-mod-tip shell script get and print the latest Go module
version based on the last tag and the latest commit hash from the
current working directory.
This command usually used to fix go.mod due to force commit.
|
|
Instead of using only the last tagged version use the last tag
plus latest commit hash.
This changes require the Version and other constants that use it
to be declared as variable.
|
|
Add new task: "build" to build all cmd into _bin/linux-amd64
directory.
Set the default "all" task to test, lint, and then build.
Remove the $SRC and $SRC_TEST to minimize disk read, let the Go
figure it out if the package need to be build and/or test.
|
|
While at it, expand the usage to describe the synopsis, arguments,
and example of command.
Also, replace any variable assignment from ":=" to explicit variable
with type.
|
|
|
|
|
|
The flag for RFC1123 comes with two options one with string timezone
(-rfc1123) and one with numeric time zone (-rfc1123z).
|
|
|
|
This is the CLI that implements the lib/ini for getting and setting
the key's value from INI file.
|
|
Previously, if INI file contains multi line variables, for example
key = a \
b
The Get and saved value is "a \tb", where it should be "a b" for Get and
"a \\\n\t\b" again when saved.
This changes require refactoring how the variable's value is parsed and
stored.
A variable value is parsed and stored from character after "=" until new
line or comment as raw value, and the real value is derived by trimming
white spaces, handle escaped character and double quotes.
|
|
Previously, the comment is parsed and stored separately.
This changes make the comment as part of format.
|
|
While at it, rewrite the benchmark code to call Parse instead of
reader.Parse and reset the timer after loading the file.
|
|
|
|
|
|
Given the following input and output,
>>>
input
<<<
output
EOF
The input and output content always have new line at the end.
This may cause unexpected input or output.
If input or output content expecting new line at the end, add two empty
lines at the end of it.
|
|
This is to make the list of files being tested is consistent.
|
|
Previously, the LoadDataDir load all files from directory that have
".txt" extension.
This may cause unknown non-test data files loaded and may cause an error.
To distinguish it with other text files, inside the directory to be loaded
load only the file that has suffix "_test.txt".
|
|
|
|
A colon `:` is escaped using double backslash `\\`, for example
`a:b\\:c:d` contains section `a`, subsection `b:c`, and variable `d`.
A double quote `"` is escaped using triple backslash, for example `\\\"`.
|
|
|
|
|
|
If the field is pointer, the code will thrown panic if its point to
nil struct or print "<invalid reflct.Value>" for String.
|
|
Data contains predefined input and output values that is loaded from
file to be used during test.
The data provides zero or more flags, an optional description, zero or
more input, and zero or more output.
The data file name must end with ".txt".
The data content use the following format,
[FLAG_KEY ":" FLAG_VALUE LF]
[LF DESCRIPTION]
">>>" [INPUT_NAME] LF
INPUT_CONTENT
LF
"<<<" [OUTPUT_NAME] LF
OUTPUT_CONTENT
The data can contains zero or more flag.
A flag is key and value separated by ":".
The flag key must not contain spaces.
The data may contain description.
The line that start with "\n>>>" defined the beginning of input.
An input can have a name, if its empty it will be set to "default".
An input can be defined multiple times, with different names.
The line that start with "\n<<<" defined the beginning of output.
An output can have a name, if its empty it will be set to "default".
An output also can be defined multiple times, with different names.
|