Skip to content

Commit

Permalink
fix(gazelle): remove deprecated function call (#556)
Browse files Browse the repository at this point in the history
Co-authored-by: Yun Peng <pcloudy@google.com>
  • Loading branch information
tyler-french and meteorcloudy authored Jan 24, 2025
1 parent 8758e82 commit 7209de9
Showing 1 changed file with 4 additions and 6 deletions.
10 changes: 4 additions & 6 deletions gazelle/bzl/gazelle.go
Original file line number Diff line number Diff line change
Expand Up @@ -26,8 +26,8 @@ package bzl
import (
"flag"
"fmt"
"io/ioutil"
"log"
"os"
"path/filepath"
"sort"
"strings"
Expand All @@ -39,7 +39,6 @@ import (
"github.com/bazelbuild/bazel-gazelle/repo"
"github.com/bazelbuild/bazel-gazelle/resolve"
"github.com/bazelbuild/bazel-gazelle/rule"

"github.com/bazelbuild/buildtools/build"
)

Expand Down Expand Up @@ -182,8 +181,7 @@ func (*bzlLibraryLang) Resolve(c *config.Config, ix *resolve.RuleIndex, rc *repo
Lang: languageName,
Imp: impLabel.String(),
}
matches := ix.FindRulesByImport(res, languageName)

matches := ix.FindRulesByImportWithConfig(c, res, languageName)
if len(matches) == 0 {
log.Printf("%s: %q (%s) was not found in dependency index. Skipping. This may result in an incomplete deps section and require manual BUILD file intervention.\n", from.String(), imp, impLabel.String())
}
Expand Down Expand Up @@ -259,9 +257,9 @@ func (*bzlLibraryLang) GenerateRules(args language.GenerateArgs) language.Genera
}

func getBzlFileLoads(path string) ([]string, error) {
f, err := ioutil.ReadFile(path)
f, err := os.ReadFile(path)
if err != nil {
return nil, fmt.Errorf("ioutil.ReadFile(%q) error: %v", path, err)
return nil, fmt.Errorf("os.ReadFile(%q) error: %v", path, err)
}
ast, err := build.ParseBuild(path, f)
if err != nil {
Expand Down

0 comments on commit 7209de9

Please # to comment.