File tree Expand file tree Collapse file tree 2 files changed +23
-2
lines changed
gazelle/manifest/generate Expand file tree Collapse file tree 2 files changed +23
-2
lines changed Original file line number Diff line number Diff line change @@ -6,7 +6,10 @@ go_library(
6
6
srcs = ["generate.go" ],
7
7
importpath = "github.com/bazelbuild/rules_python/gazelle/manifest/generate" ,
8
8
visibility = ["//visibility:public" ],
9
- deps = ["//manifest" ],
9
+ deps = [
10
+ "//manifest" ,
11
+ "@io_bazel_rules_go//go/runfiles" ,
12
+ ],
10
13
)
11
14
12
15
sources_hash (
Original file line number Diff line number Diff line change @@ -28,6 +28,7 @@ import (
28
28
"os"
29
29
"strings"
30
30
31
+ "github.com/bazelbuild/rules_go/go/runfiles"
31
32
"github.com/bazelbuild/rules_python/gazelle/manifest"
32
33
)
33
34
@@ -128,7 +129,24 @@ func main() {
128
129
129
130
// unmarshalJSON returns the parsed mapping from the given JSON file path.
130
131
func unmarshalJSON (jsonPath string ) (map [string ]string , error ) {
131
- file , err := os .Open (jsonPath )
132
+
133
+ r , err := runfiles .New ()
134
+ if err != nil {
135
+ log .Fatalf ("runfiles.New: %v" , err )
136
+ }
137
+
138
+ // FIXME harding coding this for debugging
139
+ path := "modules_mapping.json"
140
+ path , err = r .Rlocation (path )
141
+ if err != nil {
142
+ log .Fatalf ("runfiles.Path: %v" , err )
143
+ }
144
+
145
+ file , err := r .Open (path )
146
+ if err != nil {
147
+ log .Fatal (err )
148
+ }
149
+
132
150
if err != nil {
133
151
return nil , fmt .Errorf ("failed to unmarshal JSON file: %w" , err )
134
152
}
You can’t perform that action at this time.
0 commit comments