| Age | Commit message (Collapse) | Author |
|
Now that Go has type parameter, we can use it to use the same function
that accept different types for working with slice of int, int64.
|
|
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.
|
|
This rename all variable "Ids" into "ListID".
|
|
|
|
|
|
|
|
MergeByDistance merge two slice of integers by their distance between each
others.
For example, if slice a contains "{1, 5, 9}" and b contains
"{4, 11, 15}" and the distance is 3, the output of merged is
"{1, 5, 9, 15}". The 4 and 11 are not included because 4 is in range
between 1 and (1+3), and 11 is in range between 9 and 9+3.
|
|
The Remove function remove value "v" from slice if its exist and return
new slice and true; otherwise, if not found, return unmodified slice and
false.
|
|
Just like package "bytes" or "strings", the package "ints" focus on slice
of integer.
|