Remove unused return value from PopValueInto.

This commit is contained in:
Alec Thomas
2019-06-21 10:07:24 +10:00
parent 9d0bd59611
commit 1076f5ee1f
4 changed files with 19 additions and 19 deletions
+8 -8
View File
@@ -14,11 +14,11 @@ type TokenType int
const (
UntypedToken TokenType = iota
EOLToken
FlagToken // --<flag>
FlagValueToken // =<value>
ShortFlagToken // -<short>[<tail]
ShortFlagTailToken // <tail>
PositionalArgumentToken // <arg>
FlagToken // --<flag>
FlagValueToken // =<value>
ShortFlagToken // -<short>[<tail]
ShortFlagTailToken // <tail>
PositionalArgumentToken // <arg>
)
func (t TokenType) String() string {
@@ -156,12 +156,12 @@ func (s *Scanner) PopValue(context string) (Token, error) {
// PopValueInto pops a value token into target or returns an error.
//
// "context" is used to assist the user if the value can not be popped, eg. "expected <context> value but got <type>"
func (s *Scanner) PopValueInto(context string, target interface{}) (Token, error) {
func (s *Scanner) PopValueInto(context string, target interface{}) error {
t := s.Pop()
if !t.IsValue() {
return t, errors.Errorf("expected %s value but got %q (%s)", context, t, t.InferredType())
return errors.Errorf("expected %s value but got %q (%s)", context, t, t.InferredType())
}
return t, jsonTranscode(t.Value, target)
return jsonTranscode(t.Value, target)
}
// PopWhile predicate returns true.