Merge pull request #6758 from icanhazbroccoli/icanhazbroccoli/revert-f94bac064

Revert "chartutil.ReadValues is forced to unmarshal numbers into json.Number"
pull/6756/head
Matthew Fisher 5 years ago committed by GitHub
commit 33338eab17
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

@ -10,4 +10,3 @@ water:
water: water:
where: "everywhere" where: "everywhere"
nor: "any drop to drink" nor: "any drop to drink"
temperature: 1234567890

@ -17,7 +17,6 @@ limitations under the License.
package chartutil package chartutil
import ( import (
"encoding/json"
"fmt" "fmt"
"io" "io"
"io/ioutil" "io/ioutil"
@ -106,10 +105,7 @@ func tableLookup(v Values, simple string) (Values, error) {
// ReadValues will parse YAML byte data into a Values. // ReadValues will parse YAML byte data into a Values.
func ReadValues(data []byte) (vals Values, err error) { func ReadValues(data []byte) (vals Values, err error) {
err = yaml.Unmarshal(data, &vals, func(d *json.Decoder) *json.Decoder { err = yaml.Unmarshal(data, &vals)
d.UseNumber()
return d
})
if len(vals) == 0 { if len(vals) == 0 {
vals = Values{} vals = Values{}
} }

@ -45,7 +45,6 @@ water:
water: water:
where: "everywhere" where: "everywhere"
nor: "any drop to drink" nor: "any drop to drink"
temperature: 1234567890
` `
data, err := ReadValues([]byte(doc)) data, err := ReadValues([]byte(doc))
@ -246,12 +245,6 @@ func matchValues(t *testing.T, data map[string]interface{}) {
} else if o != "everywhere" { } else if o != "everywhere" {
t.Errorf("Expected water water everywhere") t.Errorf("Expected water water everywhere")
} }
if o, err := ttpl("{{.water.water.temperature}}", data); err != nil {
t.Errorf(".water.water.temperature: %s", err)
} else if o != "1234567890" {
t.Errorf("Expected water water temperature: 1234567890, got: %s", o)
}
} }
func ttpl(tpl string, v map[string]interface{}) (string, error) { func ttpl(tpl string, v map[string]interface{}) (string, error) {

Loading…
Cancel
Save