Fix build problem with recent go release: vector Data() was renamed to Copy(). Also changed our own decoder method to reflect this.
This commit is contained in:
parent
6ca7f8f160
commit
af804a47fa
1 changed files with 5 additions and 5 deletions
10
decode.go
10
decode.go
|
@ -27,7 +27,7 @@ func Decode(r io.Reader) (data interface{}, err os.Error) {
|
|||
jb := newDecoder(nil, nil)
|
||||
err = Parse(r, jb)
|
||||
if err == nil {
|
||||
data = jb.Data()
|
||||
data = jb.Copy()
|
||||
}
|
||||
return
|
||||
}
|
||||
|
@ -87,18 +87,18 @@ func (j *decoder) Flush() {
|
|||
switch c := j.container.(type) {
|
||||
case *vector.Vector:
|
||||
index := j.index.(int)
|
||||
c.Set(index, j.Data())
|
||||
c.Set(index, j.Copy())
|
||||
case map[string]interface{}:
|
||||
index := j.index.(string)
|
||||
c[index] = j.Data()
|
||||
c[index] = j.Copy()
|
||||
}
|
||||
}
|
||||
|
||||
// Get the value built by this builder.
|
||||
func (j *decoder) Data() interface{} {
|
||||
func (j *decoder) Copy() interface{} {
|
||||
switch v := j.value.(type) {
|
||||
case *vector.Vector:
|
||||
return v.Data()
|
||||
return v.Copy()
|
||||
}
|
||||
return j.value
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue