diff options
| author | Shulhan <ms@kilabit.info> | 2024-09-08 14:01:33 +0700 |
|---|---|---|
| committer | Shulhan <ms@kilabit.info> | 2024-09-08 14:01:33 +0700 |
| commit | 9cdbccc13eb68e6d2c0067a009416f0e766dccc8 (patch) | |
| tree | 09ceb2f6ce72af9fb9581e11628e620298064436 | |
| parent | 4905270d02431c5a431fe33491893803c373be5c (diff) | |
| download | kbbi-9cdbccc13eb68e6d2c0067a009416f0e766dccc8.tar.xz | |
all: realign some struct for compact layout
Changes,
* struct Client realigned from 56 to 40 bytes (-16)
* struct Word realigned from 72 to 56 bytes (-16)
* anonymous struct in test realigned from 40 to 32 bytes (-8)
| -rw-r--r-- | client.go | 4 | ||||
| -rw-r--r-- | word.go | 12 | ||||
| -rw-r--r-- | word_test.go | 2 |
3 files changed, 10 insertions, 8 deletions
@@ -64,10 +64,10 @@ const ( // Client for official KBBI web using HTTP. type Client struct { - baseDir string + httpc *http.Client cookieURL *url.URL + baseDir string cookies []*http.Cookie - httpc *http.Client } // NewClient create and initialize new client that connect directly to @@ -11,14 +11,16 @@ import ( // Word store the single root word and its definitions. type Word struct { - Root string `json:"dasar,omitempty"` // The root word - Definition []*WordDefinition `json:"definisi"` // The word definition. + err error + + Root string `json:"dasar,omitempty"` // The root word - // Message will contains the information when the word is not found or - // the word is informal (kata tidak baku). + // Message will contains the information when the word is not found + // or the word is informal (kata tidak baku). Message string `json:"pesan,omitempty"` - err error + // The word definition. + Definition []*WordDefinition `json:"definisi"` } // Err return an error from retrieving definition. diff --git a/word_test.go b/word_test.go index 7e0a69b..b7a3f82 100644 --- a/word_test.go +++ b/word_test.go @@ -12,9 +12,9 @@ import ( func TestWord_parseHTMLEntri(t *testing.T) { cases := []struct { + exp *Word infile string cari string - exp *Word }{{ infile: "testdata/entri.html", cari: "informasi", |
