Merge pull request #917 from methane/fix-stringer

Fix stringer error on helper/schema/schema.go
This commit is contained in:
Paul Hinze 2015-02-04 10:09:53 -06:00
commit 26156981d7
3 changed files with 47 additions and 44 deletions

View File

@ -11,8 +11,6 @@
// A good starting point is to view the Provider structure.
package schema
//go:generate stringer -type=ValueType
import (
"fmt"
"os"
@ -25,47 +23,6 @@ import (
"github.com/mitchellh/mapstructure"
)
// ValueType is an enum of the type that can be represented by a schema.
type ValueType int
const (
TypeInvalid ValueType = iota
TypeBool
TypeInt
TypeFloat
TypeString
TypeList
TypeMap
TypeSet
typeObject
)
// Zero returns the zero value for a type.
func (t ValueType) Zero() interface{} {
switch t {
case TypeInvalid:
return nil
case TypeBool:
return false
case TypeInt:
return 0
case TypeFloat:
return 0.0
case TypeString:
return ""
case TypeList:
return []interface{}{}
case TypeMap:
return map[string]interface{}{}
case TypeSet:
return nil
case typeObject:
return map[string]interface{}{}
default:
panic(fmt.Sprintf("unknown type %s", t))
}
}
// Schema is used to describe the structure of a value.
//
// Read the documentation of the struct elements for important details.

View File

@ -0,0 +1,46 @@
package schema
//go:generate stringer -type=ValueType valuetype.go
import "fmt"
// ValueType is an enum of the type that can be represented by a schema.
type ValueType int
const (
TypeInvalid ValueType = iota
TypeBool
TypeInt
TypeFloat
TypeString
TypeList
TypeMap
TypeSet
typeObject
)
// Zero returns the zero value for a type.
func (t ValueType) Zero() interface{} {
switch t {
case TypeInvalid:
return nil
case TypeBool:
return false
case TypeInt:
return 0
case TypeFloat:
return 0.0
case TypeString:
return ""
case TypeList:
return []interface{}{}
case TypeMap:
return map[string]interface{}{}
case TypeSet:
return nil
case typeObject:
return map[string]interface{}{}
default:
panic(fmt.Sprintf("unknown type %s", t))
}
}

View File

@ -1,4 +1,4 @@
// generated by stringer -type=ValueType; DO NOT EDIT
// generated by stringer -type=ValueType valuetype.go; DO NOT EDIT
package schema