Basic parsing

This commit is contained in:
Christian Nieves
2023-07-03 18:35:57 -05:00
parent 574a07495f
commit 74b67313e7
4 changed files with 10 additions and 3 deletions

2
data/BUILD Normal file
View File

@ -0,0 +1,2 @@
exports_files(glob(["*.json"]))
# exports_files(["Export.Cards.json"])

View File

@ -3,6 +3,10 @@ load("@io_bazel_rules_go//go:def.bzl", "go_binary", "go_library")
go_library( go_library(
name = "cmd_lib", name = "cmd_lib",
srcs = ["main.go"], srcs = ["main.go"],
data = [
"//data:Bot.Cards.json",
"//data:Export.Cards.json"
],
importpath = "github.com/squk/lotr/extract/cmd", importpath = "github.com/squk/lotr/extract/cmd",
visibility = ["//visibility:private"], visibility = ["//visibility:private"],
deps = [ deps = [

View File

@ -13,11 +13,12 @@ func main() {
fmt.Println("LOTR CARD PARSE") fmt.Println("LOTR CARD PARSE")
// Open our jsonFile // Open our jsonFile
jsonFile, err := os.Open("users.json") jsonFile, err := os.Open("./data/Bot.Cards.json")
// if we os.Open returns an error then handle it // if we os.Open returns an error then handle it
if err != nil { if err != nil {
fmt.Println(err) fmt.Println(err)
return
} }
fmt.Println("Successfully Opened users.json") fmt.Println("Successfully Opened users.json")
// defer the closing of our jsonFile so that we can parse it later on // defer the closing of our jsonFile so that we can parse it later on

View File

@ -1,4 +1,4 @@
package extract package types
type Card struct { type Card struct {
PackCode string `json:"pack_code"` PackCode string `json:"pack_code"`