Basic parsing
This commit is contained in:
2
data/BUILD
Normal file
2
data/BUILD
Normal file
@ -0,0 +1,2 @@
|
|||||||
|
exports_files(glob(["*.json"]))
|
||||||
|
# exports_files(["Export.Cards.json"])
|
@ -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 = [
|
||||||
|
@ -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
|
||||||
|
@ -1,4 +1,4 @@
|
|||||||
package extract
|
package types
|
||||||
|
|
||||||
type Card struct {
|
type Card struct {
|
||||||
PackCode string `json:"pack_code"`
|
PackCode string `json:"pack_code"`
|
||||||
|
Reference in New Issue
Block a user