From 2a40c09840b79f9b1641804944d27165354cdfb8 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Lo=C3=AFc=20Minier?= Date: Fri, 5 Sep 2025 13:07:26 +0000 Subject: [PATCH 1/3] fix: struct field tag not compatible with reflect.StructTag.Get MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Reported by go vet Signed-off-by: Loïc Minier --- actions/image_partition_action.go | 4 ++-- actions/ostree_deploy_action.go | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/actions/image_partition_action.go b/actions/image_partition_action.go index 345febf..e83c744 100644 --- a/actions/image_partition_action.go +++ b/actions/image_partition_action.go @@ -215,7 +215,7 @@ type Partition struct { Flags []string Features []string ExtendedOptions []string - Fsck bool "fsck" + Fsck bool `yaml:"fsck"` FSUUID string } @@ -250,7 +250,7 @@ type ImagePartitionAction struct { ImageSize string PartitionType string DiskID string - GptGap string "gpt_gap" + GptGap string `yaml:"gpt_gap"` Partitions []Partition Mountpoints []Mountpoint size int64 diff --git a/actions/ostree_deploy_action.go b/actions/ostree_deploy_action.go index 5f379ee..7666944 100644 --- a/actions/ostree_deploy_action.go +++ b/actions/ostree_deploy_action.go @@ -64,7 +64,7 @@ import ( type OstreeDeployAction struct { debos.BaseAction `yaml:",inline"` Repository string - RemoteRepository string "remote_repository" + RemoteRepository string `yaml:"remote_repository"` Branch string Os string SetupFSTab bool `yaml:"setup-fstab"` From f3b4ced5eeddfb21d4c94181a8c681379d24d8b7 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Lo=C3=AFc=20Minier?= Date: Fri, 5 Sep 2025 13:22:57 +0000 Subject: [PATCH 2/3] fix: struct literal uses unkeyed fields MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Reported by go vet Signed-off-by: Loïc Minier --- actions/image_partition_action.go | 2 +- actions/recipe_test.go | 7 ++++++- cmd/debos/debos.go | 7 ++++++- 3 files changed, 13 insertions(+), 3 deletions(-) diff --git a/actions/image_partition_action.go b/actions/image_partition_action.go index e83c744..6a5ecd0 100644 --- a/actions/image_partition_action.go +++ b/actions/image_partition_action.go @@ -639,7 +639,7 @@ func (i ImagePartitionAction) Run(context *debos.DebosContext) error { devicePath := i.getPartitionDevice(p.number, *context) context.ImagePartitions = append(context.ImagePartitions, - debos.Partition{p.Name, devicePath}) + debos.Partition{Name: p.Name, DevicePath: devicePath}) } context.ImageMntDir = path.Join(context.Scratchdir, "mnt") diff --git a/actions/recipe_test.go b/actions/recipe_test.go index 45d37a0..4cc01cc 100644 --- a/actions/recipe_test.go +++ b/actions/recipe_test.go @@ -306,7 +306,12 @@ actions: } func runTestWithSubRecipes(t *testing.T, test testSubRecipe, templateVars ...map[string]string) actions.Recipe { - context := debos.DebosContext{&debos.CommonContext{}, "", "", 512} + context := debos.DebosContext{ + CommonContext: &debos.CommonContext{}, + RecipeDir: "", + Architecture: "", + SectorSize: 512, + } dir, err := os.MkdirTemp("", "go-debos") assert.Empty(t, err) defer os.RemoveAll(dir) diff --git a/cmd/debos/debos.go b/cmd/debos/debos.go index 6f73489..41b3e7d 100644 --- a/cmd/debos/debos.go +++ b/cmd/debos/debos.go @@ -94,7 +94,12 @@ func warnLocalhost(variable string, value string) { } func main() { - context := debos.DebosContext{&debos.CommonContext{}, "", "", 512} + context := debos.DebosContext{ + CommonContext: &debos.CommonContext{}, + RecipeDir: "", + Architecture: "", + SectorSize: 512, + } var options struct { Backend string `short:"b" long:"fakemachine-backend" description:"Fakemachine backend to use" default:"auto"` ArtifactDir string `long:"artifactdir" description:"Directory for packed archives and ostree repositories (default: current directory)"` From 9e3fd35d3f4661ebef99881f52c65bf2c6924dd2 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Lo=C3=AFc=20Minier?= Date: Fri, 5 Sep 2025 13:35:23 +0000 Subject: [PATCH 3/3] ci: Enable govet linter in golangci.yml MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: Loïc Minier --- .golangci.yml | 1 + actions/image_partition_action.go | 4 ++-- actions/ostree_deploy_action.go | 2 +- actions/recipe_test.go | 6 +++--- cmd/debos/debos.go | 6 +++--- 5 files changed, 10 insertions(+), 9 deletions(-) diff --git a/.golangci.yml b/.golangci.yml index 4d63960..a02b893 100644 --- a/.golangci.yml +++ b/.golangci.yml @@ -2,6 +2,7 @@ version: "2" linters: default: none enable: + - govet - staticcheck formatters: enable: diff --git a/actions/image_partition_action.go b/actions/image_partition_action.go index 6a5ecd0..5dc9696 100644 --- a/actions/image_partition_action.go +++ b/actions/image_partition_action.go @@ -215,7 +215,7 @@ type Partition struct { Flags []string Features []string ExtendedOptions []string - Fsck bool `yaml:"fsck"` + Fsck bool `yaml:"fsck"` FSUUID string } @@ -250,7 +250,7 @@ type ImagePartitionAction struct { ImageSize string PartitionType string DiskID string - GptGap string `yaml:"gpt_gap"` + GptGap string `yaml:"gpt_gap"` Partitions []Partition Mountpoints []Mountpoint size int64 diff --git a/actions/ostree_deploy_action.go b/actions/ostree_deploy_action.go index 7666944..edcb239 100644 --- a/actions/ostree_deploy_action.go +++ b/actions/ostree_deploy_action.go @@ -64,7 +64,7 @@ import ( type OstreeDeployAction struct { debos.BaseAction `yaml:",inline"` Repository string - RemoteRepository string `yaml:"remote_repository"` + RemoteRepository string `yaml:"remote_repository"` Branch string Os string SetupFSTab bool `yaml:"setup-fstab"` diff --git a/actions/recipe_test.go b/actions/recipe_test.go index 4cc01cc..44613b1 100644 --- a/actions/recipe_test.go +++ b/actions/recipe_test.go @@ -308,9 +308,9 @@ actions: func runTestWithSubRecipes(t *testing.T, test testSubRecipe, templateVars ...map[string]string) actions.Recipe { context := debos.DebosContext{ CommonContext: &debos.CommonContext{}, - RecipeDir: "", - Architecture: "", - SectorSize: 512, + RecipeDir: "", + Architecture: "", + SectorSize: 512, } dir, err := os.MkdirTemp("", "go-debos") assert.Empty(t, err) diff --git a/cmd/debos/debos.go b/cmd/debos/debos.go index 41b3e7d..38f4480 100644 --- a/cmd/debos/debos.go +++ b/cmd/debos/debos.go @@ -96,9 +96,9 @@ func warnLocalhost(variable string, value string) { func main() { context := debos.DebosContext{ CommonContext: &debos.CommonContext{}, - RecipeDir: "", - Architecture: "", - SectorSize: 512, + RecipeDir: "", + Architecture: "", + SectorSize: 512, } var options struct { Backend string `short:"b" long:"fakemachine-backend" description:"Fakemachine backend to use" default:"auto"`