summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorPaul Buetow (europa) <paul@buetow.org>2015-05-24 23:25:26 +0100
committerPaul Buetow (europa) <paul@buetow.org>2015-05-24 23:25:26 +0100
commit50c041108dc321cf37f191dfb697cee0ade426d2 (patch)
tree6265b75b810b2322f608a479ec78db7174a028bb
parent9019796ee10aef4dd8c8f47c217e1a1e85ace571 (diff)
Learned about Stringer and now I am using it
-rw-r--r--process/process.go13
1 files changed, 10 insertions, 3 deletions
diff --git a/process/process.go b/process/process.go
index 9004349..c0e25e2 100644
--- a/process/process.go
+++ b/process/process.go
@@ -13,10 +13,17 @@ type Process struct {
Cmdline string
}
+func (self *Process) String() string {
+ str := "========================="
+
+ str = str + fmt.Sprintf("PID: %d\n", self.Pid)
+ str = str + fmt.Sprintf("cmdline: %s\n", self.Cmdline)
+
+ return str
+}
+
func (self *Process) Print() {
- fmt.Printf("=====================\n")
- fmt.Printf("PID: %d\n", self.Pid)
- fmt.Printf("cmdline: %s\n", self.Cmdline)
+ fmt.Println(self)
}
func Gather(res chan<- Process) {