aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--client.go4
-rw-r--r--word.go12
-rw-r--r--word_test.go2
3 files changed, 10 insertions, 8 deletions
diff --git a/client.go b/client.go
index 39dd031..ff30e73 100644
--- a/client.go
+++ b/client.go
@@ -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
diff --git a/word.go b/word.go
index bad564e..ecbef63 100644
--- a/word.go
+++ b/word.go
@@ -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",