From 8b8f0e94b0ab7e65d80508aec67481a1c704a2ff Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Krist=C3=B3f=20T=C3=B3th?= Date: Sat, 13 Apr 2019 16:41:16 +0200 Subject: [PATCH] Expose interface instead of implementation detail struct --- trans/trans.go | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/trans/trans.go b/trans/trans.go index 1340d5d..39ed8c7 100644 --- a/trans/trans.go +++ b/trans/trans.go @@ -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} }