Skip to content

Commit 162a453

Browse files
author
072020127
committed
fix os import
Signed-off-by: 072020127 <haoyuanma@gmail.com>
1 parent f4fd36e commit 162a453

File tree

1 file changed

+3
-4
lines changed

1 file changed

+3
-4
lines changed

hack/gen_bpf_specs.go

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,6 @@ import (
2020
"bytes"
2121
"fmt"
2222
"go/format"
23-
"io/ioutil"
2423
"os"
2524
"path/filepath"
2625
"regexp"
@@ -67,7 +66,7 @@ func main() {
6766

6867
var entries []entry
6968
for _, f := range files {
70-
b, _ := ioutil.ReadFile(f)
69+
b, _ := os.ReadFile(f)
7170
for _, line := range strings.Split(string(b), "\n") {
7271
m := genRe.FindStringSubmatch(line)
7372
if m == nil {
@@ -379,7 +378,7 @@ func collectGoFiles(root string) []string {
379378

380379
func detectModulePath(root string) string {
381380
modf := filepath.Join(root, "go.mod")
382-
b, err := ioutil.ReadFile(modf)
381+
b, err := os.ReadFile(modf)
383382
if err != nil {
384383
return ""
385384
}
@@ -479,7 +478,7 @@ func renderVariant(tpl *template.Template, pkgs []pkgInfo, symsKn, symsDe, symsG
479478
if err != nil {
480479
return fmt.Errorf("gofmt failed: %w\nraw output:\n%s\n", err, string(out))
481480
}
482-
if err := ioutil.WriteFile(outPath, src, 0644); err != nil {
481+
if err := os.WriteFile(outPath, src, 0644); err != nil {
483482
return fmt.Errorf("write out: %w", err)
484483
}
485484
return nil

0 commit comments

Comments
 (0)