Workaround for gofmt change in Go 1.11

Go 1.11 uses a different formatting for maps, and now
aligns values; running `gofmt -s -w` on this file resulted
in this diff;

```patch
 content/testsuite/testsuite.go | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)

diff --git a/content/testsuite/testsuite.go b/content/testsuite/testsuite.go
index 974c7cb8ed..d9ae9dc160 100644
--- a/content/testsuite/testsuite.go
+++ b/content/testsuite/testsuite.go
@@ -365,8 +365,8 @@ func checkLabels(ctx context.Context, t *testing.T, cs content.Store) {

 	rootTime := time.Now().UTC().Format(time.RFC3339)
 	labels := map[string]string{
-		"k1": "v1",
-		"k2": "v2",
+		"k1":                    "v1",
+		"k2":                    "v2",
 		"containerd.io/gc.root": rootTime,
 	}

@@ -402,7 +402,7 @@ func checkLabels(ctx context.Context, t *testing.T, cs content.Store) {
 	}

 	info.Labels = map[string]string{
-		"k1": "v1",
+		"k1":                    "v1",
 		"containerd.io/gc.root": rootTime,
 	}
 	preUpdate = time.Now()
```

Adding a whitespace before the long key to make it format the same
on both Go 1.11 and older versions of Go.

Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
This commit is contained in:
Sebastiaan van Stijn 2018-07-05 10:33:59 +02:00
parent 39b6ba826a
commit 383d750d4f
No known key found for this signature in database
GPG Key ID: 76698F39D527CE8C
2 changed files with 4 additions and 0 deletions

View File

@ -367,6 +367,7 @@ func checkLabels(ctx context.Context, t *testing.T, cs content.Store) {
labels := map[string]string{ labels := map[string]string{
"k1": "v1", "k1": "v1",
"k2": "v2", "k2": "v2",
"containerd.io/gc.root": rootTime, "containerd.io/gc.root": rootTime,
} }
@ -403,6 +404,7 @@ func checkLabels(ctx context.Context, t *testing.T, cs content.Store) {
info.Labels = map[string]string{ info.Labels = map[string]string{
"k1": "v1", "k1": "v1",
"containerd.io/gc.root": rootTime, "containerd.io/gc.root": rootTime,
} }
preUpdate = time.Now() preUpdate = time.Now()

View File

@ -684,6 +684,7 @@ func checkUpdate(ctx context.Context, t *testing.T, snapshotter snapshots.Snapsh
expected = map[string]string{ expected = map[string]string{
"l1": "updated", "l1": "updated",
"l3": "v3", "l3": "v3",
"containerd.io/gc.root": rootTime, "containerd.io/gc.root": rootTime,
} }
st.Labels = map[string]string{ st.Labels = map[string]string{
@ -698,6 +699,7 @@ func checkUpdate(ctx context.Context, t *testing.T, snapshotter snapshots.Snapsh
expected = map[string]string{ expected = map[string]string{
"l4": "v4", "l4": "v4",
"containerd.io/gc.root": rootTime, "containerd.io/gc.root": rootTime,
} }
st.Labels = expected st.Labels = expected