From 21daeb393ee57f3cf62b37c0e9688fca2fb54b4d Mon Sep 17 00:00:00 2001 From: Markus Lehtonen Date: Wed, 10 Jan 2024 20:49:31 +0200 Subject: [PATCH 1/2] test/chore: remove unnecessary assignments in select statements Signed-off-by: Markus Lehtonen --- pkg/cdi/cache_test.go | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/pkg/cdi/cache_test.go b/pkg/cdi/cache_test.go index bc70d8c5..59d6a7b5 100644 --- a/pkg/cdi/cache_test.go +++ b/pkg/cdi/cache_test.go @@ -718,7 +718,7 @@ devices: } select { - case _ = <-stopCh: + case <-stopCh: return default: } @@ -748,7 +748,7 @@ devices: } select { - case _ = <-stopCh: + case <-stopCh: return default: } @@ -771,10 +771,10 @@ devices: // from updater()'s create+write+rename loop) for { select { - case _ = <-stopCh: + case <-stopCh: go osSync() return - case _ = <-sync.C: + case <-sync.C: go osSync() sync.Reset(2 * time.Second) } @@ -803,7 +803,7 @@ devices: select { case err = <-errCh: require.NotNil(t, err) - case _ = <-done: + case <-done: close(stopCh) wg.Wait() return From 707429fccb3f386bab9763f7ed12f53dd42c112e Mon Sep 17 00:00:00 2001 From: Markus Lehtonen Date: Wed, 10 Jan 2024 19:32:45 +0200 Subject: [PATCH 2/2] chore: simplify checking of substrings in schema.Load Signed-off-by: Markus Lehtonen --- schema/schema.go | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/schema/schema.go b/schema/schema.go index 2903a7d0..e6e4063e 100644 --- a/schema/schema.go +++ b/schema/schema.go @@ -135,7 +135,7 @@ func Load(source string) (*Schema, error) { case strings.HasPrefix(source, "http://"): case strings.HasPrefix(source, "https://"): default: - if strings.Index(source, "://") < 0 { + if !strings.Contains(source, "://") { source, err = filepath.Abs(source) if err != nil { return nil, fmt.Errorf("failed to get JSON schema absolute path for %s: %w",