// readWordList reads the wordlist for the given language from the filesystem.
// If found, the list is cached and will be read from the cache upon next
// request. The returned slice is a safe copy and can be mutated. If the
// specified has no corresponding wordlist, an error is returned. This has been
// a panic before, however, this could enable a user to forcefully crash the
// whole application.
readWordList reads the wordlist for the given language from the filesystem.
If found, the list is cached and will be read from the cache upon next
request. The returned slice is a safe copy and can be mutated. If the
specified has no corresponding wordlist, an error is returned. This has been
a panic before, however, this could enable a user to forcefully crash the
whole application.
// readWordList reads the wordlist for the given language from the filesystem . // If found the list is cached and will be read from the cache upon next // request . The returned slice is a safe copy and can be mutated . If the // specified has no corresponding wordlist an error is returned . This has been // a panic before however this could enable a user to forcefully crash the // whole application .
func readWordList(lowercaser cases.Caser, chosenLanguage string) ([]string, error) {
	return readWordListInternal(lowercaser, chosenLanguage, func(key string) (string, error) {
		wordFile, wordErr := wordFS.Open("words/" + key)
		if wordErr != nil {
			return "", wordErr
		}
		wordBytes, readError := io.ReadAll(wordFile)
		if readError != nil {
			return "", readError
		}
		return string(wordBytes), nil
	})
}
func readWordList ( lowercaser cases . Caser , chosenLanguage string ) ( [ ] string , error ) { return readWordListInternal ( lowercaser , chosenLanguage , func ( key string ) ( string , error ) { wordFile , wordErr := wordFS . Open ( " " + key ) if wordErr != nil { return " " , wordErr } wordBytes , readError := io . ReadAll ( wordFile ) if readError != nil { return " " , readError } return string ( wordBytes ) , nil } ) }
readWordList reads the wordlist for the given language from the filesystem.
readWordList reads the wordlist for the given language from the filesystem .