func GetResultForCurrent(session *gexec.Session, cniVersion string) (*current.Result, error) {

	// Check if the version is older than 0.3.0.
	// Convert it to Current standard spec version if that is the case.
	if version.Compare(cniVersion, "0.3.0", "<") {
		r020 := types020.Result{}

		if err := json.Unmarshal(session.Out.Contents(), &r020); err != nil {
			log.Fatalf("Error unmarshaling session output to Result: %v\n", err)
		}

		rCurrent, err := current.NewResultFromResult(&r020)
		if err != nil {
			return nil, err
		}

		return rCurrent, nil
	}

	r := current.Result{}

	if err := json.Unmarshal(session.Out.Contents(), &r); err != nil {
		log.Fatalf("Error unmarshaling session output to Result: %v\n", err)
	}
	return &r, nil

}
// GetResultForCurrent takes the session output with cniVersion and returns the Result in current.Result format.
GetResultForCurrent takes the session output with cniVersion and returns the Result in current.Result format.
// GetResultForCurrent takes the session output with cniVersion and returns the Result in current . Result format .
func GetResultForCurrent(session *gexec.Session, cniVersion string) (*current.Result, error) {
	if version.Compare(cniVersion, "0.3.0", "<") {
		r020 := types020.Result{}
		if err := json.Unmarshal(session.Out.Contents(), &r020); err != nil {
			log.Fatalf("Error unmarshaling session output to Result: %v\n", err)
		}
		rCurrent, err := current.NewResultFromResult(&r020)
		if err != nil {
			return nil, err
		}
		return rCurrent, nil
	}
	r := current.Result{}
	if err := json.Unmarshal(session.Out.Contents(), &r); err != nil {
		log.Fatalf("Error unmarshaling session output to Result: %v\n", err)
	}
	return &r, nil
}
func GetResultForCurrent ( session * gexec . Session , cniVersion string ) ( * current . Result , error ) { if version . Compare ( cniVersion , " " , " " ) { r020 := types020 . Result { } if err := json . Unmarshal ( session . Out . Contents ( ) , & r020 ) ; err != nil { log . Fatalf ( " \n " , err ) } rCurrent , err := current . NewResultFromResult ( & r020 ) if err != nil { return nil , err } return rCurrent , nil } r := current . Result { } if err := json . Unmarshal ( session . Out . Contents ( ) , & r ) ; err != nil { log . Fatalf ( " \n " , err ) } return & r , nil }
GetResultForCurrent takes the session output with cniVersion and returns the Result in current.Result format.
GetResultForCurrent takes the session output with cniVersion and returns the Result in current . Result format .
// Check if the version is older than 0.3.0. // Convert it to Current standard spec version if that is the case.