| Age | Commit message (Collapse) | Author |
|
Go 1.22 now support for-range on numeric value.
|
|
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.
|
|
Instead of annotating the lines that caught by linters, fix it to comply
with the recommendations.
This causes several breaking changes, especially related to naming,
* api/slack: [Message.IconUrl] become [Message.IconURL]
* lib/dns: DefaultSoaMinumumTtl become DefaultSoaMinimumTTL
* lib/email: [Message.SetBodyHtml] become [Message.SetBodyHTML]
* lib/http: [Client.GenerateHttpRequest] become
[Client.GenerateHTTPRequest]
* lib/http: [ClientOptions.ServerUrl] become [ClientOptions.ServerURL]
* lib/http: [EndpointRequest.HttpWriter] become
[EndpointRequest.HTTPWriter]
* lib/http: [EndpointRequest.HttpRequest] become
[EndpointRequest.HTTPRequest]
* lib/http: [ServerOptions.EnableIndexHtml] become
[ServerOptions.EnableIndexHTML]
* lib/http: [SSEConn.HttpRequest] become [SSEConn.HTTPRequest]
* lib/smtp: [ClientOptions.ServerUrl] become [ClientOptions.ServerURL]
* lib/ssh/sftp: [FileAttrs.SetUid] become [FileAttrs.SetUID]
* lib/ssh/sftp: [FileAttrs.Uid] become [FileAttrs.UID]
|
|
There are some reports that I disagree with revive, in example, code
should not declare the type after variables.
In my opinion, on some cases, declaring the type make the code more
readable and explicit.
Since I did not want to add new configuration file, we changes it and
follow revive for now.
|
|
The Timeout field in net.Dialer sometimes does not have any effect.
In the for-loop, we expect that each Dial at least consume 100 ms
before returning an error.
Turns out, on several occasion, the loop run too quickly, less than the
passed timeout.
This is probably because the listening address has not been
active yet and we run it in the same machine, the OS (or Go?) return
immediately without waiting for timeout.
|
|
The Read method read packet from raw connection.
If the conn parameter is nil it will return [net.ErrClosed].
The bufsize parameter set the size of buffer for each read operation,
default to 1024 if not set or invalid (less than 0 or greater than
65535).
The timeout parameter set how long to wait for data before considering
it as failed.
If its not set, less or equal to 0, it will wait forever.
If no data received and timeout is set, it will return [ErrReadTimeout].
If there is data received and connection closed at the same time, it will
return the data first without error.
The subsequent Read will return empty packet with [ErrClosed].
Signed-off-by: Shulhan <ms@kilabit.info>
|
|
WaitAlive try to connect to network at address until timeout reached.
If connection cannot established it will return an error.
Unlike [net.DialTimeout], this function will retry not returning an error
immediately if the address has not ready yet.
|
|
|
|
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.
|
|
This function only useful for expanding SPF macro "i" or when generating
query for DNS PTR.
|
|
|
|
|