From 053c5535ba116de2ff243e764785a867a250c00a Mon Sep 17 00:00:00 2001 From: Derek Parker Date: Sat, 25 Oct 2014 12:25:00 -0500 Subject: [PATCH] Small code cleanup --- proctl/variables_linux_amd64.go | 11 +++-------- 1 file changed, 3 insertions(+), 8 deletions(-) diff --git a/proctl/variables_linux_amd64.go b/proctl/variables_linux_amd64.go index 9fcd0ede..2a2ea6ac 100644 --- a/proctl/variables_linux_amd64.go +++ b/proctl/variables_linux_amd64.go @@ -162,8 +162,7 @@ func (thread *ThreadContext) readString(addr uintptr) (string, error) { i := bytes.IndexByte(val, 0x0) val = val[:i] - str := *(*string)(unsafe.Pointer(&val)) - return str, nil + return *(*string)(unsafe.Pointer(&val)), nil } func (thread *ThreadContext) readIntSlice(addr uintptr) (string, error) { @@ -194,9 +193,7 @@ func (thread *ThreadContext) readIntSlice(addr uintptr) (string, error) { members = append(members, number) } - str := fmt.Sprintf("len: %d cap: %d %d", l, c, members) - - return str, err + return fmt.Sprintf("len: %d cap: %d %d", l, c, members), nil } func (thread *ThreadContext) readIntArray(addr uintptr, t *dwarf.ArrayType) (string, error) { @@ -220,9 +217,7 @@ func (thread *ThreadContext) readIntArray(addr uintptr, t *dwarf.ArrayType) (str members = append(members, number) } - str := fmt.Sprintf("[%d]int %d", t.ByteSize/8, members) - - return str, nil + return fmt.Sprintf("[%d]int %d", t.ByteSize/8, members), nil } func (thread *ThreadContext) readInt(addr uintptr, size int64) (string, error) {