| Age | Commit message (Collapse) | Author |
|
The internal/cmd/gocheck use the go static analysis [Analyzer] that are
not included in the default go vet.
By using gocheck we found un-alignment and shadowing,
* client.go:18:13: struct with 24 pointer bytes could be 16
* dictionary.go:23:17: struct with 32 pointer bytes could be 16
* client_test.go:18:13: struct with 56 pointer bytes could be 48
* client_test.go:62:13: struct with 56 pointer bytes could be 48
* cmd/kamusku-telegram-bot/main.go:31:3: declaration of "err" shadows
declaration at line 25
* kamusku_test.go:49:3: declaration of "err" shadows declaration at
line 38
[Analyzer]: https://pkg.go.dev/golang.org/x/tools/go/analysis#hdr-Analyzer
|
|
|
|
Since we now only have one client, apiClient, rename it to Client so it
can be used by other module or package later.
|
|
The client will have two mode: direct or API. The direct mode connect
to official KBBI website, request the word page, and parse the HTML to
get the definition. The API mode connect to server API that provide
caching of dictionary.
|
|
Sebelumnya parameter untuk method CariDefinisi() hanya sebuah string.
Supaya dapat mencari lebih dari satu kata dalam satu kali panggil, maka
parameternya diganti menjadi slice of string.
Hal ini menyebabkan penambahan field internal "err" yang berisi kesalahan
pada saat pengambilan definisi yang dapat diperiksa dengan menggunakan
method Err().
Selain itu, pindahkan fungsi parseHTMLEntri menjadi method dari Kata.
|
|
|
|
|