From 3e72e5aa1dbc25f12d67e92e84b04c73a4439a78 Mon Sep 17 00:00:00 2001 From: Christian Kellner Date: Wed, 10 Nov 2021 18:48:20 +0100 Subject: [PATCH] disk: pass basePartitionTable as pointer Pass the `basePartitionTable` argument of `CreatePartitionTable`. Now that we clone the partition table at the beginning of the method there is no need to pass a copy of the partition table. --- internal/disk/customizations.go | 2 +- internal/disk/disk_test.go | 2 +- internal/distro/rhel85/distro.go | 2 +- internal/distro/rhel86/distro.go | 2 +- internal/distro/rhel90/distro.go | 2 +- internal/distro/rhel90beta/distro.go | 2 +- 6 files changed, 6 insertions(+), 6 deletions(-) diff --git a/internal/disk/customizations.go b/internal/disk/customizations.go index 1e6893d99..f009a4dca 100644 --- a/internal/disk/customizations.go +++ b/internal/disk/customizations.go @@ -27,7 +27,7 @@ const ( func CreatePartitionTable( mountpoints []blueprint.FilesystemCustomization, imageSize uint64, - basePartitionTable PartitionTable, + basePartitionTable *PartitionTable, rng *rand.Rand, ) PartitionTable { diff --git a/internal/disk/disk_test.go b/internal/disk/disk_test.go index f564178e1..7c335725d 100644 --- a/internal/disk/disk_test.go +++ b/internal/disk/disk_test.go @@ -44,7 +44,7 @@ func TestDisk_DynamicallyResizePartitionTable(t *testing.T) { // math/rand is good enough in this case /* #nosec G404 */ rng := rand.New(rand.NewSource(0)) - pt = disk.CreatePartitionTable(mountpoints, 1024, pt, rng) + pt = disk.CreatePartitionTable(mountpoints, 1024, &pt, rng) assert.GreaterOrEqual(t, expectedSize, pt.Size) } diff --git a/internal/distro/rhel85/distro.go b/internal/distro/rhel85/distro.go index 30111f4db..3167952ac 100644 --- a/internal/distro/rhel85/distro.go +++ b/internal/distro/rhel85/distro.go @@ -322,7 +322,7 @@ func (t *imageType) getPartitionTable( return basePartitionTable, fmt.Errorf("unknown arch: " + archName) } - return disk.CreatePartitionTable(mountpoints, options.Size, basePartitionTable, rng), nil + return disk.CreatePartitionTable(mountpoints, options.Size, &basePartitionTable, rng), nil } // local type for ostree commit metadata used to define commit sources diff --git a/internal/distro/rhel86/distro.go b/internal/distro/rhel86/distro.go index 7e7c99ab1..d61c2d2b9 100644 --- a/internal/distro/rhel86/distro.go +++ b/internal/distro/rhel86/distro.go @@ -392,7 +392,7 @@ func (t *imageType) getPartitionTable( return basePartitionTable, fmt.Errorf("unknown arch: " + archName) } - return disk.CreatePartitionTable(mountpoints, options.Size, basePartitionTable, rng), nil + return disk.CreatePartitionTable(mountpoints, options.Size, &basePartitionTable, rng), nil } func (t *imageType) getDefaultImageConfig() *distro.ImageConfig { diff --git a/internal/distro/rhel90/distro.go b/internal/distro/rhel90/distro.go index c7e31ab3c..0ce61c8fe 100644 --- a/internal/distro/rhel90/distro.go +++ b/internal/distro/rhel90/distro.go @@ -380,7 +380,7 @@ func (t *imageType) getPartitionTable( return basePartitionTable, fmt.Errorf("unknown arch: " + archName) } - return disk.CreatePartitionTable(mountpoints, options.Size, basePartitionTable, rng), nil + return disk.CreatePartitionTable(mountpoints, options.Size, &basePartitionTable, rng), nil } func (t *imageType) getDefaultImageConfig() *distro.ImageConfig { diff --git a/internal/distro/rhel90beta/distro.go b/internal/distro/rhel90beta/distro.go index f47ee54ae..7d3bd1eea 100644 --- a/internal/distro/rhel90beta/distro.go +++ b/internal/distro/rhel90beta/distro.go @@ -357,7 +357,7 @@ func (t *imageType) getPartitionTable( return basePartitionTable, fmt.Errorf("unknown arch: " + archName) } - return disk.CreatePartitionTable(mountpoints, options.Size, basePartitionTable, rng), nil + return disk.CreatePartitionTable(mountpoints, options.Size, &basePartitionTable, rng), nil } // local type for ostree commit metadata used to define commit sources