aboutsummaryrefslogtreecommitdiff
path: root/src/debug/macho/macho.go
diff options
context:
space:
mode:
authorHiroshi Ioka <hirochachacha@gmail.com>2017-08-14 17:26:22 +0900
committerIan Lance Taylor <iant@golang.org>2017-08-15 00:13:36 +0000
commitc3fa6f4ddc4a79f436e842742ae735e617f8522e (patch)
treeddd5381043ebca33cd1e3a82042d31a022917b38 /src/debug/macho/macho.go
parent90ffc40e4f3d81ad6b9f57092074f8fef68cf128 (diff)
downloadgo-c3fa6f4ddc4a79f436e842742ae735e617f8522e.tar.gz
go-c3fa6f4ddc4a79f436e842742ae735e617f8522e.zip
debug/macho: make Type implements fmt.(Go)Stringer interfaces
Fixes #21436 Change-Id: I56f43e2852696c28edbcc772a54125a9a9c32497 Reviewed-on: https://go-review.googlesource.com/55262 Reviewed-by: Ian Lance Taylor <iant@golang.org> Run-TryBot: Ian Lance Taylor <iant@golang.org> TryBot-Result: Gobot Gobot <gobot@golang.org>
Diffstat (limited to 'src/debug/macho/macho.go')
-rw-r--r--src/debug/macho/macho.go10
1 files changed, 10 insertions, 0 deletions
diff --git a/src/debug/macho/macho.go b/src/debug/macho/macho.go
index 366ce205dfb..6535ba787b0 100644
--- a/src/debug/macho/macho.go
+++ b/src/debug/macho/macho.go
@@ -41,6 +41,16 @@ const (
TypeBundle Type = 8
)
+var typeStrings = []intName{
+ {uint32(TypeObj), "Obj"},
+ {uint32(TypeExec), "Exec"},
+ {uint32(TypeDylib), "Dylib"},
+ {uint32(TypeBundle), "Bundle"},
+}
+
+func (t Type) String() string { return stringName(uint32(t), typeStrings, false) }
+func (t Type) GoString() string { return stringName(uint32(t), typeStrings, true) }
+
// A Cpu is a Mach-O cpu type.
type Cpu uint32