Skip to content
This repository was archived by the owner on Apr 19, 2024. It is now read-only.

Commit

Permalink
Update README.md
Browse files Browse the repository at this point in the history
  • Loading branch information
AlecAivazis authored Apr 18, 2017
1 parent da84980 commit 74e3258
Showing 1 changed file with 3 additions and 5 deletions.
8 changes: 3 additions & 5 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -138,11 +138,9 @@ response:
q := &survey.Question{
Prompt: &survey.Input{Message: "Hello world validation"},
Validate: func (val interface{}) error {
// since we are validating an Input, this will always succeed
if str, ok := val.(string) ; ok {
if len(str) > 10 {
return errors.New("This response cannot be longer than 10 characters.")
}
// since we are validating an Input, the assertion will always succeed
if str, ok := val.(string) ; ok && len(str) > 10 {
return errors.New("This response cannot be longer than 10 characters.")
}
}
}
Expand Down

0 comments on commit 74e3258

Please sign in to comment.