| Age | Commit message (Collapse) | Author |
|
Explain the second and third return values: match and maxlen.
|
|
|
|
Using Words seems like misleading since we capture the characters
difference, not a word as in human language.
|
|
In the struct Data, we add new method WriteLineChunks to print the
LineChunks data into [io.Writer] w.
|
|
In the struct Data we also rename field Changes to LineChunks.
|
|
Defining []T as new type does not help on readability only make it
confusing for future maintenances.
|
|
While at it,
- reorganize the order of functions alphabetically, following
the order from doc.
- changes the [Line.String] to print text in double quoted to help human
compare the changes for non-printable characters.
|
|
While at it, rename the source file to reflect the content, instead of
diffinterface.go name it func.go.
|
|
While at it, use consistent receiver "diff" for Data and return *Data
from Text, Lines, Files, and Unified.
|
|
I cannot remember the use case for implementing IsEqual.
Seems like the original purpose of IsEqual is to compare minimum length
between two slices of bytes.
|
|
|
|
The reason for refactoring is we will add more fields to the Line type
to handle unified diff.
In the ParseLines, we changes the line number to start from 1, to make it
consistent with ReadLines and file line numbering.
This causes a lot of changes in the expectation files in testdata.
|
|
|
|
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/
|
|
HTTP request now implicitly create request with context.
Any false positive related to not closing HTTP response body has been
annotated with "nolint:bodyclose".
In the example code, use consistent "// Output:" comment format, by
prefixing with single space.
Any comment on code now also prefixing with single space.
An error returned without variables now use [errors.New] instead of
[fmt.Errorf].
Any error returned using [fmt.Errorf] now wrapped using "%w" instead of
"%s".
Also, replace error checking using [errors.Is] or [errors.As], instead
of using equal/not-equal operator.
Any statement like "x = x OP y" now replaced with "x OP= y".
Also, swap statement is simplified using "x, y = y, x".
Any switch statement with single case now replaced with if-condition.
Any call to defer on function or program that call [os.Exit], now
replaced by calling the deferred function directly.
Any if-else condition now replaced with switch statement, if possible.
|
|
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
|
|
The shadow tool [1] report a variable where its name is declared twice
or more, in different scope.
[1] https://pkg.go.dev/golang.org/x/tools@v0.13.0/go/analysis/passes/shadow
|
|
Some changes,
* add missing comment to method MarshalJSON in Chunk and Line
* use consistent receiver name on Chunk and Line
* rename variable "new" to "newline" to fix
"redefinition of the built-in function new"
|
|
The realignment reduce the cost of the following struct,
* Chunk: from 16 to 8 bytes (-8)
* struct in TestChunk_MarshalJSON: from 40 to 32 bytes (-8)
* diff.LineChange: from 96 to 88 bytes (-8)
* Line: from 16 to 8 bytes (-8)
* struct in TestLine_MarshalJSON: from 40 to 32 bytes (-8)
|
|
This is to prevent import cycle later when we use lib/test in bytes.
|
|
|
|
The goal is to remove dependency to lib/test so we can use text/diff
in the lib/test in the future.
|
|
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.
|
|
|
|
This changes refactoring some functions, notably,
* Rename Bytes function to IsEqual
* Rename Lines function to Bytes
* Add function Text that compare two text (raw bytes)
* Add function Lines that compare two instances of text.Lines
|
|
|
|
|
|
The valid syntax to suppress linter warnings is "//nolint:<name>" with
no space between comment and "nolint" and between ":". Also, we move the
placement of nolint directive to the top of statements for multiple
nolint in the same scope.
While at it, fix and supress some linter warnings.
|
|
Most of the warnings caused by update to linter which cause global
variables declared with grouping "( ... )" and that has been suppressed,
are become false-positive again.
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|