Migrate leak related structs to leak package

This commit is contained in:
2018-07-11 16:32:19 +01:00
parent 32ebda931e
commit d239c011b0
7 changed files with 19 additions and 20 deletions

27
leak/entry.go Normal file
View File

@@ -0,0 +1,27 @@
package leak
// NewEntry returns a new *Entry instance initialized with a *Object of the
// given input JSON data.
func NewEntry(inputJSON []byte) (*Entry, error) {
obj, err := NewObject(inputJSON)
if err != nil {
return nil, err
}
return &Entry{
Object: obj,
Index: obj.Index(),
}, err
}
// Entry is a parsed heap item object
type Entry struct {
Object *Object
Offset int64
Index string
}
// Address returns the Address property of the entry's Object.
func (s *Entry) Address() string {
return s.Object.Address
}