From b4d2f061beca36bd467e70238ef98c4eb4426a77 Mon Sep 17 00:00:00 2001 From: Alexander Morozov Date: Mon, 2 Nov 2015 08:28:34 -0800 Subject: [PATCH] Fix go vet warnings Signed-off-by: Alexander Morozov --- archive/changes.go | 23 +++++++++++++---------- 1 file changed, 13 insertions(+), 10 deletions(-) diff --git a/archive/changes.go b/archive/changes.go index 49593ef..e0bd4c4 100644 --- a/archive/changes.go +++ b/archive/changes.go @@ -31,6 +31,18 @@ const ( ChangeDelete ) +func (c ChangeType) String() string { + switch c { + case ChangeModify: + return "C" + case ChangeAdd: + return "A" + case ChangeDelete: + return "D" + } + return "" +} + // Change represents a change, it wraps the change type and path. // It describes changes of the files in the path respect to the // parent layers. The change could be modify, add, delete. @@ -41,16 +53,7 @@ type Change struct { } func (change *Change) String() string { - var kind string - switch change.Kind { - case ChangeModify: - kind = "C" - case ChangeAdd: - kind = "A" - case ChangeDelete: - kind = "D" - } - return fmt.Sprintf("%s %s", kind, change.Path) + return fmt.Sprintf("%s %s", change.Kind, change.Path) } // for sort.Sort