Skip to content

Commit

Permalink
Remove io/fs package in favor of filepath functions
Browse files Browse the repository at this point in the history
Signed-off-by: Kathryn Baldauf <[email protected]>
  • Loading branch information
katiewasnothere committed Oct 28, 2021
1 parent d76a8dc commit 9ed0296
Showing 1 changed file with 3 additions and 4 deletions.
7 changes: 3 additions & 4 deletions cmd/gcstools/installdrivers.go
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,6 @@ package main
import (
"context"
"fmt"
"io/fs"
"os"
"os/exec"
"path/filepath"
Expand Down Expand Up @@ -51,12 +50,12 @@ func install(ctx context.Context) error {

// find all module files, which end with ".ko" extension, and remove extension
// for use when calling `modprobe` below.
if walkErr := filepath.WalkDir(rootPath, func(path string, d fs.DirEntry, err error) error {
if walkErr := filepath.Walk(rootPath, func(path string, info os.FileInfo, err error) error {
if err != nil {
return errors.Wrap(err, "failed to read directory while walking dir")
}
if !d.IsDir() && filepath.Ext(d.Name()) == moduleExtension {
moduleName := strings.TrimSuffix(d.Name(), moduleExtension)
if !info.IsDir() && filepath.Ext(info.Name()) == moduleExtension {
moduleName := strings.TrimSuffix(info.Name(), moduleExtension)
modules = append(modules, moduleName)
}
return nil
Expand Down

0 comments on commit 9ed0296

Please sign in to comment.