Expose interface instead of implementation detail struct
This commit is contained in:
parent
44497c7364
commit
8b8f0e94b0
@ -7,6 +7,9 @@ import (
|
|||||||
"log"
|
"log"
|
||||||
)
|
)
|
||||||
|
|
||||||
|
type Translator interface {
|
||||||
|
Translate() []string
|
||||||
|
}
|
||||||
|
|
||||||
type transJob struct {
|
type transJob struct {
|
||||||
word string
|
word string
|
||||||
@ -14,7 +17,7 @@ type transJob struct {
|
|||||||
toLang string
|
toLang string
|
||||||
}
|
}
|
||||||
|
|
||||||
func New(word, fromLang, toLang string) transJob {
|
func New(word, fromLang, toLang string) Translator {
|
||||||
return transJob{word: word, fromLang: fromLang, toLang: toLang}
|
return transJob{word: word, fromLang: fromLang, toLang: toLang}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user