bleh
This commit is contained in:
18
extract/cmd/BUILD
Normal file
18
extract/cmd/BUILD
Normal file
@ -0,0 +1,18 @@
|
||||
load("@io_bazel_rules_go//go:def.bzl", "go_binary", "go_library")
|
||||
|
||||
go_library(
|
||||
name = "cmd_lib",
|
||||
srcs = ["main.go"],
|
||||
importpath = "github.com/squk/lotr/extract/cmd",
|
||||
visibility = ["//visibility:private"],
|
||||
deps = [
|
||||
"//extract/types",
|
||||
"@com_github_davecgh_go_spew//spew",
|
||||
],
|
||||
)
|
||||
|
||||
go_binary(
|
||||
name = "cmd",
|
||||
embed = [":cmd_lib"],
|
||||
visibility = ["//visibility:public"],
|
||||
)
|
30
extract/cmd/main.go
Normal file
30
extract/cmd/main.go
Normal file
@ -0,0 +1,30 @@
|
||||
package main
|
||||
|
||||
import (
|
||||
"encoding/json"
|
||||
"fmt"
|
||||
"io/ioutil"
|
||||
"os"
|
||||
"github.com/squk/lotr/extract/types"
|
||||
"github.com/davecgh/go-spew/spew"
|
||||
)
|
||||
|
||||
func main() {
|
||||
fmt.Println("LOTR CARD PARSE")
|
||||
|
||||
|
||||
// Open our jsonFile
|
||||
jsonFile, err := os.Open("users.json")
|
||||
// if we os.Open returns an error then handle it
|
||||
if err != nil {
|
||||
fmt.Println(err)
|
||||
}
|
||||
fmt.Println("Successfully Opened users.json")
|
||||
// defer the closing of our jsonFile so that we can parse it later on
|
||||
defer jsonFile.Close()
|
||||
|
||||
byteValue, _ := ioutil.ReadAll(jsonFile)
|
||||
c := []types.Card{}
|
||||
json.Unmarshal(byteValue, &c)
|
||||
spew.Dump(c)
|
||||
}
|
Reference in New Issue
Block a user