aboutsummaryrefslogtreecommitdiff
path: root/lib/dsv/readerinterface.go
diff options
context:
space:
mode:
authorShulhan <ms@kilabit.info>2024-03-03 04:59:34 +0700
committerShulhan <ms@kilabit.info>2024-03-05 14:53:12 +0700
commit2fa7605727e90ca323b7b24168632e485d74c583 (patch)
tree3533df0fc07ef96b1564736926cc3310994be515 /lib/dsv/readerinterface.go
parentb921ebfb3e81b367ff24305eb18c5dd073b38635 (diff)
downloadpakakeh.go-2fa7605727e90ca323b7b24168632e485d74c583.tar.xz
all: comply with linter recommendations #2
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.
Diffstat (limited to 'lib/dsv/readerinterface.go')
-rw-r--r--lib/dsv/readerinterface.go5
1 files changed, 3 insertions, 2 deletions
diff --git a/lib/dsv/readerinterface.go b/lib/dsv/readerinterface.go
index c6fa1cb6..736b999d 100644
--- a/lib/dsv/readerinterface.go
+++ b/lib/dsv/readerinterface.go
@@ -6,6 +6,7 @@ package dsv
import (
"bytes"
+ "errors"
"fmt"
"io"
"os"
@@ -195,7 +196,7 @@ func parsingRightQuote(reader ReaderInterface, rq, line []byte, startAt int) (
N: 0,
}
- if e == io.EOF {
+ if errors.Is(e, io.EOF) {
eRead.T &= EReadEOF
}
@@ -408,7 +409,7 @@ err:
What: fmt.Sprint(e),
}
- if e == io.EOF {
+ if errors.Is(e, io.EOF) {
eRead.T = EReadEOF
} else {
eRead.T = EReadLine