diff --git a/cmd/beornextract/BUILD b/cmd/beornextract/BUILD index 422d681..997f8c5 100644 --- a/cmd/beornextract/BUILD +++ b/cmd/beornextract/BUILD @@ -12,6 +12,9 @@ alias( go_library( name = "beornextract_lib", srcs = ["main.go"], - importpath = "github.com/squk/lotr/beornextract", - deps = ["@com_github_davecgh_go_spew//spew"], + importpath = "github.com/squk/lotr/cmd/beornextract", + deps = [ + "//cmd/beornextract/types", + "@com_github_davecgh_go_spew//spew", + ], ) diff --git a/cmd/beornextract/main.go b/cmd/beornextract/main.go index e592d72..97037e1 100644 --- a/cmd/beornextract/main.go +++ b/cmd/beornextract/main.go @@ -5,26 +5,26 @@ import ( "fmt" "io/ioutil" "os" - "github.com/squk/lotr/extract/types" + "github.com/davecgh/go-spew/spew" + "github.com/squk/lotr/cmd/beornextract/types" ) func main() { fmt.Println("LOTR CARD PARSE") - // Open our jsonFile - jsonFile, err := os.Open("./data/Bot.Cards.json") - // if we os.Open returns an error then handle it - if err != nil { - fmt.Println(err) - return - } - fmt.Println("Successfully Opened users.json") - // defer the closing of our jsonFile so that we can parse it later on - defer jsonFile.Close() + jsonFile, err := os.Open("./data/Bot.Cards.json") + // if we os.Open returns an error then handle it + if err != nil { + fmt.Println(err) + return + } + 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) + byteValue, _ := ioutil.ReadAll(jsonFile) c := []types.HallOfBeornCard{} json.Unmarshal(byteValue, &c) spew.Dump(c) diff --git a/cmd/beornextract/types/BUILD b/cmd/beornextract/types/BUILD index c8918fe..7b6a859 100644 --- a/cmd/beornextract/types/BUILD +++ b/cmd/beornextract/types/BUILD @@ -3,6 +3,6 @@ load("@io_bazel_rules_go//go:def.bzl", "go_library") go_library( name = "types", srcs = ["card.go"], - importpath = "github.com/squk/lotr/beornextract/types", + importpath = "github.com/squk/lotr/cmd/beornextract/types", visibility = ["//visibility:public"], ) diff --git a/cmd/test/BUILD b/cmd/test/BUILD new file mode 100644 index 0000000..226ea66 --- /dev/null +++ b/cmd/test/BUILD @@ -0,0 +1,18 @@ +load("@io_bazel_rules_go//go:def.bzl", "go_binary", "go_library") + +go_library( + name = "test_lib", + srcs = ["main.go"], + importpath = "github.com/squk/lotr/cmd/test", + visibility = ["//visibility:private"], + deps = [ + "@com_github_davecgh_go_spew//spew", + "@com_github_mattn_go_sqlite3//:go-sqlite3", + ], +) + +go_binary( + name = "test", + embed = [":test_lib"], + visibility = ["//visibility:public"], +) diff --git a/sqlgen/cmd/BUILD b/sqlgen/cmd/BUILD index 5de4da4..e69de29 100644 --- a/sqlgen/cmd/BUILD +++ b/sqlgen/cmd/BUILD @@ -1,18 +0,0 @@ -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/sqlgen/cmd", - visibility = ["//visibility:private"], - deps = [ - "@com_github_davecgh_go_spew//spew", - "@com_github_mattn_go_sqlite3//:go-sqlite3", - ], -) - -go_binary( - name = "cmd", - embed = [":cmd_lib"], - visibility = ["//visibility:public"], -)