From b6f6ab17f9a811ef3be827478f987132ed4f396d Mon Sep 17 00:00:00 2001 From: 564104865 <564104865@qq.com> Date: Wed, 3 Nov 2021 23:50:57 +0800 Subject: [PATCH] go fmt --- os/gcache/gcache_z_example_cache_test.go | 24 +++++++++++------------- 1 file changed, 11 insertions(+), 13 deletions(-) diff --git a/os/gcache/gcache_z_example_cache_test.go b/os/gcache/gcache_z_example_cache_test.go index 70c06e0a3..92ef33fd0 100644 --- a/os/gcache/gcache_z_example_cache_test.go +++ b/os/gcache/gcache_z_example_cache_test.go @@ -131,13 +131,12 @@ func ExampleCache_SetMap() { //It does not expire if `duration` == 0. It deletes the keys of `data` if `duration` < 0 or given `value` is nil. c.SetMap(ctx, data, 1000*time.Millisecond) - //Gets the specified key value v1, _ := c.Get(ctx, "k1") v2, _ := c.Get(ctx, "k2") v3, _ := c.Get(ctx, "k3") - fmt.Println( v1,v2,v3) + fmt.Println(v1, v2, v3) // Output: // v1 v2 v3 @@ -173,14 +172,13 @@ func ExampleCache_Update() { c.SetMap(ctx, g.MapAnyAny{"k1": "v1", "k2": "v2", "k3": "v3"}, 0) //Print the current key value pair - k1, _ := c.Get(ctx,"k1") + k1, _ := c.Get(ctx, "k1") fmt.Println(k1) - k2, _ := c.Get(ctx,"k2") + k2, _ := c.Get(ctx, "k2") fmt.Println(k2) - k3, _ := c.Get(ctx,"k3") + k3, _ := c.Get(ctx, "k3") fmt.Println(k3) - //Update updates the value of `key` without changing its expiration and returns the old value. re, exist, _ := c.Update(ctx, "k1", "v11") fmt.Println(re, exist) @@ -190,11 +188,11 @@ func ExampleCache_Update() { re1, exist1, _ := c.Update(ctx, "k4", "v44") fmt.Println(re1, exist1) - kup1, _ := c.Get(ctx,"k1") + kup1, _ := c.Get(ctx, "k1") fmt.Println(kup1) - kup2, _ := c.Get(ctx,"k2") + kup2, _ := c.Get(ctx, "k2") fmt.Println(kup2) - kup3, _ := c.Get(ctx,"k3") + kup3, _ := c.Get(ctx, "k3") fmt.Println(kup3) // Output: // v1 @@ -305,13 +303,13 @@ func ExampleCache_Data() { c.Set(ctx, "k5", "v5", 0) //Data returns a copy of all key-value pairs in the cache as map type. Note that this function may lead lots of memory usage, you can implement this function if necessary. - data, _ := c.Get(ctx,"k1") + data, _ := c.Get(ctx, "k1") fmt.Println(data) - data1, _ := c.Get(ctx,"k2") + data1, _ := c.Get(ctx, "k2") fmt.Println(data1) - data2, _ := c.Get(ctx,"k5") + data2, _ := c.Get(ctx, "k5") fmt.Println(data2) // Output: @@ -482,7 +480,7 @@ func ExampleCache_Removes() { c.SetMap(ctx, g.MapAnyAny{"k1": "v1", "k2": "v2", "k3": "v3", "k4": "v4"}, 0) //Remove deletes one or more keys from cache, and returns its value. If multiple keys are given, it returns the value of the last deleted item. - c.Removes(ctx, g.Slice{"k1", "k2","k3"}) + c.Removes(ctx, g.Slice{"k1", "k2", "k3"}) data, _ := c.Data(ctx) fmt.Println(data)