Code Monkey home page Code Monkey logo

Comments (5)

dims avatar dims commented on September 10, 2024 1

try UnmarshalStrict

/close

from yaml.

kishorviswanathan avatar kishorviswanathan commented on September 10, 2024 1

@dims I am not sure if this issue should remain closed as I was able to reproduce the bug with UnmarshalStrict as well. I don't have permission to reopen it.

from yaml.

k8s-ci-robot avatar k8s-ci-robot commented on September 10, 2024

@dims: Closing this issue.

In response to this:

try UnmarshalStrict

/close

Instructions for interacting with me using PR comments are available here. If you have questions or suggestions related to my behavior, please file an issue against the kubernetes-sigs/prow repository.

from yaml.

kishorviswanathan avatar kishorviswanathan commented on September 10, 2024

Makes no difference if this is what you meant.

package main

import (
	"fmt"

	"sigs.k8s.io/yaml"
)

const (
	invalidYAML = `
  test:
test1: hello
`
)

type yamlType struct {
	Test  string `yaml:"test"`
	Test1 string `yaml:"test1"`
}

func main() {
	var data1 interface{}
	err := yaml.UnmarshalStrict([]byte(invalidYAML), &data1)
	if err != nil {
		fmt.Printf("Error1 %e", err)
	}

	fmt.Printf("data1: %+v\n", data1)

	var data2 yamlType
	err = yaml.UnmarshalStrict([]byte(invalidYAML), &data2)
	if err != nil {
		fmt.Printf("Error2 %e", err)
	}
	fmt.Printf("data2: %+v\n", data2)
}

Output:

data1: map[test:<nil>]
data2: {Test: Test1:}

from yaml.

anderseknert avatar anderseknert commented on September 10, 2024

I too would want to know more about this behavior. Thanks for looking into it @kishorviswanathan 👍

from yaml.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.