mohae/joefriday · os_unix.go
go logo
func Deserialize(p []byte) (*o.OS, error) {
	os := &o.OS{}
	err := json.Unmarshal(p, os)
	if err != nil {
		return nil, err
	}
	return os, nil
}
Similar code snippets
1.
juju/juju · service.go
Match rating: 55.82% · See similar code snippets
go logo
func (s *Service) deserialize(data []byte) (common.Conf, error) {
	conf, err := deserialize(data, renderer)
	if err != nil {
		return conf, s.errorf(err, "failed to deserialize conf")
	}
	return conf, nil
}
2.
mohae/joefriday · version_unix.go
Match rating: 54.85% · See similar code snippets
go logo
func Deserialize(p []byte) (*v.Kernel, error) {
	k := &v.Kernel{}
	err := json.Unmarshal(p, k)
	if err != nil {
		return nil, err
	}
	return k, nil
}
3.
mohae/joefriday · netusage_unix.go
Match rating: 53.91% · See similar code snippets
go logo
func Deserialize(p []byte) (*structs.DevUsage, error) {
	u := &structs.DevUsage{}
	err := json.Unmarshal(p, u)
	if err != nil {
		return nil, err
	}
	return u, nil
}
4.
mohae/joefriday · mem_unix.go
Match rating: 52.88% · See similar code snippets
go logo
func Deserialize(p []byte) (*m.MemInfo, error) {
	var inf m.MemInfo
	err := json.Unmarshal(p, &inf)
	if err != nil {
		return nil, err
	}
	return &inf, nil
}
5.
mohae/joefriday · loadavg_unix.go
Match rating: 51.52% · See similar code snippets
go logo
func Deserialize(p []byte) (la l.LoadAvg, err error) {
	err = json.Unmarshal(p, &la)
	if err != nil {
		return la, err
	}
	return la, nil
}
6.
mohae/joefriday · uptime_unix.go
Match rating: 51.32% · See similar code snippets
go logo
func Deserialize(p []byte) (*up.Uptime, error) {
	var u up.Uptime
	err := json.Unmarshal(p, &u)
	if err != nil {
		return nil, err
	}
	return &u, nil
}
7.
mohae/joefriday · diskstats_unix.go
Match rating: 50.36% · See similar code snippets
go logo
func Deserialize(p []byte) (*structs.DiskStats, error) {
	st := &structs.DiskStats{}
	err := json.Unmarshal(p, st)
	if err != nil {
		return nil, err
	}
	return st, nil
}
8.
sclasen/swfsm · fsm_models.go
Match rating: 48.81% · See similar code snippets
go logo
func (j JSONStateSerializer) Deserialize(serialized string, state interface{}) error {
	err := json.NewDecoder(strings.NewReader(serialized)).Decode(state)
	return err
}
9.
moby/moby · image.go
Match rating: 48.34% · See similar code snippets
go logo
func (img *Image) OperatingSystem() string {
	os := img.OS
	if os == "" {
		os = runtime.GOOS
	}
	return os
}
10.
mohae/joefriday · loadavg_unix.go
Match rating: 47.91% · See similar code snippets
go logo
func Deserialize(p []byte) (*load.LoadAvg, error) {
	var l load.LoadAvg
	err := json.Unmarshal(p, &l)
	if err != nil {
		return nil, err
	}
	return &l, nil
}