From 4bc191e4342b0f32042711747c90d6371fd1e87f Mon Sep 17 00:00:00 2001 From: Paul Meyer <49727155+katexochen@users.noreply.github.com> Date: Tue, 10 Jan 2023 18:08:31 +0100 Subject: [PATCH] versions: move hash generator into own package Signed-off-by: Paul Meyer <49727155+katexochen@users.noreply.github.com> --- go.mod | 2 +- .../generate.go} | 4 +--- .../versions/hash-generator/generate_test.go | 17 +++++++++++++++++ internal/versions/versions.go | 2 +- 4 files changed, 20 insertions(+), 5 deletions(-) rename internal/versions/{generateHashes.go => hash-generator/generate.go} (97%) create mode 100644 internal/versions/hash-generator/generate_test.go diff --git a/go.mod b/go.mod index c08ac940a..bf3803a61 100644 --- a/go.mod +++ b/go.mod @@ -92,6 +92,7 @@ require ( golang.org/x/crypto v0.5.0 golang.org/x/mod v0.7.0 golang.org/x/sys v0.4.0 + golang.org/x/tools v0.4.0 google.golang.org/api v0.106.0 google.golang.org/grpc v1.51.0 google.golang.org/protobuf v1.28.1 @@ -287,7 +288,6 @@ require ( golang.org/x/term v0.4.0 // indirect golang.org/x/text v0.6.0 // indirect golang.org/x/time v0.2.0 // indirect - golang.org/x/tools v0.4.0 // indirect golang.org/x/xerrors v0.0.0-20220907171357-04be3eba64a2 // indirect google.golang.org/appengine v1.6.7 // indirect google.golang.org/genproto v0.0.0-20221227171554-f9683d7f8bef // indirect diff --git a/internal/versions/generateHashes.go b/internal/versions/hash-generator/generate.go similarity index 97% rename from internal/versions/generateHashes.go rename to internal/versions/hash-generator/generate.go index 05268d042..2df826860 100644 --- a/internal/versions/generateHashes.go +++ b/internal/versions/hash-generator/generate.go @@ -1,5 +1,3 @@ -//go:build ignore - /* Copyright (c) Edgeless Systems GmbH @@ -170,5 +168,5 @@ func main() { log.Fatalf("no components lists found") } - fmt.Printf("Successfully generated hashes for %d components in %d component lists.", componentCtr, componentListsCtr) + fmt.Printf("Successfully generated hashes for %d components in %d component lists.\n", componentCtr, componentListsCtr) } diff --git a/internal/versions/hash-generator/generate_test.go b/internal/versions/hash-generator/generate_test.go new file mode 100644 index 000000000..d030a9138 --- /dev/null +++ b/internal/versions/hash-generator/generate_test.go @@ -0,0 +1,17 @@ +/* +Copyright (c) Edgeless Systems GmbH + +SPDX-License-Identifier: AGPL-3.0-only +*/ + +package main + +import ( + "testing" + + "go.uber.org/goleak" +) + +func TestMain(m *testing.M) { + goleak.VerifyTestMain(m) +} diff --git a/internal/versions/versions.go b/internal/versions/versions.go index c77c42cae..71dabf82d 100644 --- a/internal/versions/versions.go +++ b/internal/versions/versions.go @@ -96,7 +96,7 @@ const ( // Regenerate the hashes by running go generate. // To add another Kubernetes version, add a new entry to the VersionConfigs map below and fill the Hash field with an empty string. -//go:generate go run generateHashes.go +//go:generate go run hash-generator/generate.go // VersionConfigs holds download URLs for all required kubernetes components for every supported version. var VersionConfigs = map[ValidK8sVersion]KubernetesVersion{