From 3547e72df20c010a10f5c7630a84b00994982ee6 Mon Sep 17 00:00:00 2001 From: Sebastiaan van Stijn Date: Wed, 20 Mar 2019 16:28:55 +0100 Subject: [PATCH 1/2] Improve information if IsStateDirty() fails Before: panic: unexpected field type in StoreSnapshot After: panic: unexpected field type in StoreSnapshot: XXX_NoUnkeyedLiteral struct Signed-off-by: Sebastiaan van Stijn --- manager/dirty.go | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/manager/dirty.go b/manager/dirty.go index c989ec2c86..2f3460436f 100644 --- a/manager/dirty.go +++ b/manager/dirty.go @@ -1,6 +1,7 @@ package manager import ( + "fmt" "reflect" "github.com/docker/swarmkit/api" @@ -45,7 +46,7 @@ func (m *Manager) IsStateDirty() (bool, error) { field := val.Field(i) structField := val.Type().Field(i) if structField.Type.Kind() != reflect.Slice { - panic("unexpected field type in StoreSnapshot") + panic(fmt.Sprintf("unexpected field type in StoreSnapshot: %s (type %v)", structField.Name, structField.Type.Kind())) } if structField.Name != "Nodes" && structField.Name != "Clusters" && structField.Name != "Networks" && field.Len() != 0 { // One of the other data types has an entry From 691a1d8cc51df41f959ec697ca04b1c180005877 Mon Sep 17 00:00:00 2001 From: Sebastiaan van Stijn Date: Thu, 4 Apr 2019 01:25:03 +0200 Subject: [PATCH 2/2] FIXME manually gofmt test file Signed-off-by: Sebastiaan van Stijn --- protobuf/plugin/deepcopy/test/deepcopypb_test.go | 13 +++++++------ 1 file changed, 7 insertions(+), 6 deletions(-) diff --git a/protobuf/plugin/deepcopy/test/deepcopypb_test.go b/protobuf/plugin/deepcopy/test/deepcopypb_test.go index f542bb67d0..e1c2d168c7 100644 --- a/protobuf/plugin/deepcopy/test/deepcopypb_test.go +++ b/protobuf/plugin/deepcopy/test/deepcopypb_test.go @@ -4,15 +4,16 @@ package test import ( - fmt "fmt" + "fmt" + "math" + math_rand "math/rand" + "testing" + "time" + _ "github.com/gogo/protobuf/gogoproto" github_com_gogo_protobuf_jsonpb "github.com/gogo/protobuf/jsonpb" + "github.com/gogo/protobuf/proto" github_com_gogo_protobuf_proto "github.com/gogo/protobuf/proto" - proto "github.com/gogo/protobuf/proto" - math "math" - math_rand "math/rand" - testing "testing" - time "time" ) // Reference imports to suppress errors if they are not otherwise used.