Expose interface instead of implementation detail struct
This commit is contained in:
		@@ -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}
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
 
 | 
			
		||||
		Reference in New Issue
	
	Block a user