Expose interface instead of implementation detail struct

This commit is contained in:
Kristóf Tóth 2019-04-13 16:41:16 +02:00
parent 44497c7364
commit 8b8f0e94b0

View File

@ -7,6 +7,9 @@ import (
"log"
)
type Translator interface {
Translate() []string
}
type transJob struct {
word string
@ -14,7 +17,7 @@ type transJob struct {
toLang string
}
func New(word, fromLang, toLang string) transJob {
func New(word, fromLang, toLang string) Translator {
return transJob{word: word, fromLang: fromLang, toLang: toLang}
}