This commit is contained in:
Christian Nieves
2023-07-12 22:28:24 -05:00
parent 4060a5c274
commit ae55110082
6 changed files with 106 additions and 8 deletions

View File

@ -4,17 +4,36 @@ import (
"encoding/json"
"fmt"
"io/ioutil"
"log"
"os"
"path/filepath"
"github.com/bazelbuild/rules_go/go/tools/bazel"
"github.com/davecgh/go-spew/spew"
"github.com/squk/lotr/cmd/beornextract/types"
)
func main() {
fmt.Println("LOTR CARD PARSE")
f, err := bazel.Runfile(".")
if err != nil {
panic(err)
}
err = filepath.Walk(f,
func(path string, info os.FileInfo, err error) error {
if err != nil {
return err
}
fmt.Println(path, info.Size())
return nil
})
if err != nil {
log.Println(err)
}
// Open our jsonFile
jsonFile, err := os.Open("./data/Bot.Cards.json")
// jsonFile, err := os.Open("cmd/beornextract/data/Bot.Cards.json")
jsonFile, err := bazel.Runfile("cmd/beornextract/data/Bot.Cards.json")
// if we os.Open returns an error then handle it
if err != nil {
fmt.Println(err)