Skip to content

Commit

Permalink
linting
Browse files Browse the repository at this point in the history
  • Loading branch information
hellt committed Oct 21, 2024
1 parent 1c9d209 commit b5c12fd
Show file tree
Hide file tree
Showing 3 changed files with 10 additions and 6 deletions.
2 changes: 1 addition & 1 deletion clab/config.go
Original file line number Diff line number Diff line change
Expand Up @@ -389,7 +389,7 @@ func (c *CLab) verifyLinks(ctx context.Context) error {
}

// LoadKernelModules loads containerlab-required kernel modules.
func (c *CLab) loadKernelModules() error {
func (*CLab) loadKernelModules() error {
modules := []string{"ip_tables", "ip6_tables"}
opts := []kmod.Option{
kmod.SetInitFunc(utils.ModInitFunc),
Expand Down
4 changes: 2 additions & 2 deletions go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -237,7 +237,7 @@ require (
github.com/josharian/native v1.1.0 // indirect
github.com/json-iterator/go v1.1.12 // indirect
github.com/kevinburke/ssh_config v1.2.0 // indirect
github.com/klauspost/compress v1.17.9 // indirect
github.com/klauspost/compress v1.17.9
github.com/klauspost/pgzip v1.2.6 // indirect
github.com/manifoldco/promptui v0.9.0 // indirect
github.com/mattn/go-colorable v0.1.13 // indirect
Expand Down Expand Up @@ -275,7 +275,7 @@ require (
github.com/sylabs/sif/v2 v2.18.0 // indirect
github.com/syndtr/gocapability v0.0.0-20200815063812-42c35b437635 // indirect
github.com/ugorji/go/codec v1.2.12 // indirect
github.com/ulikunitz/xz v0.5.12 // indirect
github.com/ulikunitz/xz v0.5.12
github.com/vbatts/tar-split v0.11.5 // indirect
github.com/vishvananda/netns v0.0.4 // indirect
github.com/weaveworks/libgitops v0.0.0-20200611103311-2c871bbbbf0c // indirect
Expand Down
10 changes: 7 additions & 3 deletions utils/kernel_module.go
Original file line number Diff line number Diff line change
Expand Up @@ -102,13 +102,13 @@ func (kv *KernelVersion) GreaterOrEqual(cmpKv *KernelVersion) bool {
return true
}

// modInitFunc supports uncompressed files and gzip and xz compressed files.
func ModInitFunc(path, params string, flags int) error {
// ModInitFunc supports uncompressed files and gzip and xz compressed files.
func ModInitFunc(path, params string, _ int) error {
f, err := os.Open(path)
if err != nil {
return err
}
defer f.Close()
defer f.Close() // skipcq: GO-S2307

switch filepath.Ext(path) {
case ".gz":
Expand All @@ -117,19 +117,22 @@ func ModInitFunc(path, params string, flags int) error {
return err
}
defer rd.Close()

return initModule(rd, params)
case ".xz":
rd, err := xz.NewReader(f)
if err != nil {
return err
}

return initModule(rd, params)
case ".zst":
rd, err := zstd.NewReader(f)
if err != nil {
return err
}
defer rd.Close()

return initModule(rd, params)
}

Expand All @@ -139,6 +142,7 @@ func ModInitFunc(path, params string, flags int) error {
return initModule(f, params)
}
}

return nil
}

Expand Down

0 comments on commit b5c12fd

Please sign in to comment.