start
This commit is contained in:
24
BUILD
24
BUILD
@ -1,31 +1,13 @@
|
|||||||
load("@io_bazel_rules_go//go:def.bzl", "go_prefix", "go_binary")
|
load("@io_bazel_rules_go//go:def.bzl", "go_binary")
|
||||||
|
|
||||||
package(
|
package(
|
||||||
default_visibility = ["//visibility:public"],
|
default_visibility = ["//visibility:public"],
|
||||||
)
|
)
|
||||||
|
|
||||||
go_prefix("github.com/laramiel/bazel-example-golang/")
|
|
||||||
|
|
||||||
go_binary(
|
go_binary(
|
||||||
name = "hello",
|
name = "hello",
|
||||||
srcs = ["hello.go"],
|
srcs = ["hello.go"],
|
||||||
deps = [
|
deps = [
|
||||||
"//local",
|
"//cmd",
|
||||||
],
|
]
|
||||||
)
|
|
||||||
|
|
||||||
go_binary(
|
|
||||||
name = "remote",
|
|
||||||
srcs = ["remote.go"],
|
|
||||||
deps = [
|
|
||||||
"@ws_remote//:remote",
|
|
||||||
],
|
|
||||||
)
|
|
||||||
|
|
||||||
go_binary(
|
|
||||||
name = "bare",
|
|
||||||
srcs = ["bare.go"],
|
|
||||||
deps = [
|
|
||||||
"@ws_bare//:bare",
|
|
||||||
],
|
|
||||||
)
|
)
|
||||||
|
49
WORKSPACE
49
WORKSPACE
@ -1,36 +1,23 @@
|
|||||||
git_repository(
|
load("@bazel_tools//tools/build_defs/repo:git.bzl", "git_repository")
|
||||||
|
load("@bazel_tools//tools/build_defs/repo:http.bzl", "http_archive")
|
||||||
|
|
||||||
|
# git_repository(
|
||||||
|
# name = "io_bazel_rules_go",
|
||||||
|
# remote = "https://github.com/bazelbuild/rules_go.git",
|
||||||
|
# branch = "master",
|
||||||
|
# )
|
||||||
|
|
||||||
|
http_archive(
|
||||||
name = "io_bazel_rules_go",
|
name = "io_bazel_rules_go",
|
||||||
remote = "https://github.com/bazelbuild/rules_go.git",
|
sha256 = "6b65cb7917b4d1709f9410ffe00ecf3e160edf674b78c54a894471320862184f",
|
||||||
commit = "373feb6",
|
urls = [
|
||||||
|
"https://mirror.bazel.build/github.com/bazelbuild/rules_go/releases/download/v0.39.0/rules_go-v0.39.0.zip",
|
||||||
|
"https://github.com/bazelbuild/rules_go/releases/download/v0.39.0/rules_go-v0.39.0.zip",
|
||||||
|
],
|
||||||
)
|
)
|
||||||
|
|
||||||
load("@io_bazel_rules_go//go:def.bzl", "go_repositories")
|
load("@io_bazel_rules_go//go:deps.bzl", "go_register_toolchains", "go_rules_dependencies")
|
||||||
|
|
||||||
go_repositories()
|
go_rules_dependencies()
|
||||||
|
|
||||||
git_repository(
|
go_register_toolchains(version = "1.19.3")
|
||||||
name = "ws_remote",
|
|
||||||
remote = "https://github.com/laramiel/bazel-example-golang-remote.git",
|
|
||||||
commit = "4a9199b",
|
|
||||||
)
|
|
||||||
|
|
||||||
|
|
||||||
BARE_BUILD = """
|
|
||||||
load("@io_bazel_rules_go//go:def.bzl", "go_prefix", "go_library")
|
|
||||||
|
|
||||||
go_prefix("github.com/laramiel/bazel-example-golang-bare")
|
|
||||||
|
|
||||||
go_library(
|
|
||||||
name = "bare",
|
|
||||||
srcs = [ "bare.go" ],
|
|
||||||
visibility = ["//visibility:public"],
|
|
||||||
)
|
|
||||||
|
|
||||||
"""
|
|
||||||
|
|
||||||
new_git_repository(
|
|
||||||
name = "ws_bare",
|
|
||||||
remote = "https://github.com/laramiel/bazel-example-golang-bare.git",
|
|
||||||
commit = "3bd848f",
|
|
||||||
build_file_content = BARE_BUILD
|
|
||||||
)
|
|
||||||
|
16
bare.go
16
bare.go
@ -1,16 +0,0 @@
|
|||||||
package main
|
|
||||||
|
|
||||||
import (
|
|
||||||
"fmt"
|
|
||||||
|
|
||||||
// HACK ALERT
|
|
||||||
// The correct import is this:
|
|
||||||
// "github.com/laramiel/bazel-example-golang-bare/bare"
|
|
||||||
// But the bazel build rules for external golang packages like git_repository() are busted.
|
|
||||||
// We hack around it by importing where those external dependencies end up:
|
|
||||||
"github.com/laramiel/bazel-example-golang/external/ws_bare/bare"
|
|
||||||
)
|
|
||||||
|
|
||||||
func main() {
|
|
||||||
fmt.Println("Hello", bare.World())
|
|
||||||
}
|
|
1
bazel-lotr
Symbolic link
1
bazel-lotr
Symbolic link
@ -0,0 +1 @@
|
|||||||
|
/private/var/tmp/_bazel_christian/3262850bcac806b0124f7f44b81dceb1/execroot/__main__
|
@ -1,7 +1,8 @@
|
|||||||
load("@io_bazel_rules_go//go:def.bzl", "go_library")
|
load("@io_bazel_rules_go//go:def.bzl", "go_library")
|
||||||
|
|
||||||
go_library(
|
go_library(
|
||||||
name ="local",
|
name ="cmd",
|
||||||
srcs = [ "local.go" ],
|
srcs = [ "cmd.go" ],
|
||||||
visibility = ["//visibility:public"],
|
visibility = ["//visibility:public"],
|
||||||
|
importpath= "github.com/squk/lotr/cmd"
|
||||||
)
|
)
|
9
cmd/cmd.go
Normal file
9
cmd/cmd.go
Normal file
@ -0,0 +1,9 @@
|
|||||||
|
package main
|
||||||
|
|
||||||
|
import (
|
||||||
|
"fmt"
|
||||||
|
)
|
||||||
|
|
||||||
|
func main() {
|
||||||
|
fmt.Println("Hello World. Cmd")
|
||||||
|
}
|
1
data/Bot.Cards.json
Normal file
1
data/Bot.Cards.json
Normal file
File diff suppressed because one or more lines are too long
1
data/Export.Cards.json
Normal file
1
data/Export.Cards.json
Normal file
File diff suppressed because one or more lines are too long
4
hello.go
4
hello.go
@ -2,12 +2,8 @@ package main
|
|||||||
|
|
||||||
import (
|
import (
|
||||||
"fmt"
|
"fmt"
|
||||||
|
|
||||||
"github.com/laramiel/bazel-example-golang/local/local"
|
|
||||||
)
|
)
|
||||||
|
|
||||||
func main() {
|
func main() {
|
||||||
fmt.Println("Hello World")
|
fmt.Println("Hello World")
|
||||||
|
|
||||||
fmt.Println("Hello", local.World())
|
|
||||||
}
|
}
|
||||||
|
@ -1,5 +0,0 @@
|
|||||||
package local
|
|
||||||
|
|
||||||
func World() string {
|
|
||||||
return "local.World!"
|
|
||||||
}
|
|
16
remote.go
16
remote.go
@ -1,16 +0,0 @@
|
|||||||
package main
|
|
||||||
|
|
||||||
import (
|
|
||||||
"fmt"
|
|
||||||
|
|
||||||
// HACK ALERT
|
|
||||||
// The correct import is this:
|
|
||||||
// "github.com/laramiel/bazel-example-golang-remote/remote"
|
|
||||||
// But the bazel build rules for external golang packages like git_repository() are busted.
|
|
||||||
// We hack around it by importing where those external dependencies end up:
|
|
||||||
"github.com/laramiel/bazel-example-golang/external/ws_remote/remote"
|
|
||||||
)
|
|
||||||
|
|
||||||
func main() {
|
|
||||||
fmt.Println("Hello ", remote.World())
|
|
||||||
}
|
|
@ -1,21 +0,0 @@
|
|||||||
load("@io_bazel_rules_go//go:def.bzl", "go_binary")
|
|
||||||
|
|
||||||
package(
|
|
||||||
default_visibility = ["//visibility:public"],
|
|
||||||
)
|
|
||||||
|
|
||||||
go_binary(
|
|
||||||
name = "bare",
|
|
||||||
srcs = ["bare.go"],
|
|
||||||
deps = [
|
|
||||||
"//submodule/src:bare",
|
|
||||||
],
|
|
||||||
)
|
|
||||||
|
|
||||||
go_binary(
|
|
||||||
name = "remote",
|
|
||||||
srcs = ["remote.go"],
|
|
||||||
deps = [
|
|
||||||
"//submodule/src/remote",
|
|
||||||
],
|
|
||||||
)
|
|
@ -1,17 +0,0 @@
|
|||||||
package main
|
|
||||||
|
|
||||||
import (
|
|
||||||
"fmt"
|
|
||||||
|
|
||||||
// HACK ALERT
|
|
||||||
// The correct import is this:
|
|
||||||
// "github.com/laramiel/bazel-example-golang-bare/bare"
|
|
||||||
// But the bazel build rules for subversion packages don't support alternate
|
|
||||||
// go_prefix() commands.
|
|
||||||
// We hack around it by importing where those external dependencies end up:
|
|
||||||
"github.com/laramiel/bazel-example-golang/submodule/src/bare"
|
|
||||||
)
|
|
||||||
|
|
||||||
func main() {
|
|
||||||
fmt.Println("Hello", bare.World())
|
|
||||||
}
|
|
@ -1,17 +0,0 @@
|
|||||||
package main
|
|
||||||
|
|
||||||
import (
|
|
||||||
"fmt"
|
|
||||||
|
|
||||||
// HACK ALERT
|
|
||||||
// The correct import is this:
|
|
||||||
// "github.com/laramiel/bazel-example-golang-remote/remote"
|
|
||||||
// But the bazel build rules for subversion packages don't support alternate
|
|
||||||
// go_prefix() commands.
|
|
||||||
// We hack around it by importing where those dependencies end up:
|
|
||||||
"github.com/laramiel/bazel-example-golang/submodule/src/remote/remote"
|
|
||||||
)
|
|
||||||
|
|
||||||
func main() {
|
|
||||||
fmt.Println("Hello", remote.World())
|
|
||||||
}
|
|
@ -1,9 +0,0 @@
|
|||||||
load("@bazel_tools//tools/build_rules/go:def.bzl", "go_prefix", "go_library")
|
|
||||||
|
|
||||||
go_prefix("github.com/laramiel/bazel-example-golang-bare/")
|
|
||||||
|
|
||||||
go_library(
|
|
||||||
name = "bare",
|
|
||||||
srcs = [ "bare/bare.go" ],
|
|
||||||
visibility = ["//visibility:public"],
|
|
||||||
)
|
|
Submodule submodule/src/bare deleted from 3bd848fc12
Submodule submodule/src/remote deleted from 4a9199be6e
@ -1,24 +0,0 @@
|
|||||||
load("@io_bazel_rules_go//go:def.bzl", "go_binary")
|
|
||||||
|
|
||||||
package(
|
|
||||||
default_visibility = ["//visibility:public"],
|
|
||||||
)
|
|
||||||
|
|
||||||
# BAZEL does not work correctly with BUILD files rooted elsewhere than
|
|
||||||
# the actual code directory.
|
|
||||||
#
|
|
||||||
#go_binary(
|
|
||||||
# name ="bare",
|
|
||||||
# srcs = [ "bare.go" ],
|
|
||||||
# deps = [
|
|
||||||
# "//vendor/github.com/laramiel:bare",
|
|
||||||
# ],
|
|
||||||
#)
|
|
||||||
|
|
||||||
go_binary(
|
|
||||||
name = "remote",
|
|
||||||
srcs = ["remote.go"],
|
|
||||||
deps = [
|
|
||||||
"//vendor/github.com/laramiel/bazel-example-golang-remote:remote",
|
|
||||||
],
|
|
||||||
)
|
|
@ -1,11 +0,0 @@
|
|||||||
package main
|
|
||||||
|
|
||||||
import (
|
|
||||||
"fmt"
|
|
||||||
|
|
||||||
"github.com/laramiel/bazel-example-golang-bare/bare"
|
|
||||||
)
|
|
||||||
|
|
||||||
func main() {
|
|
||||||
fmt.Println("Hello", bare.World())
|
|
||||||
}
|
|
@ -1,11 +0,0 @@
|
|||||||
package main
|
|
||||||
|
|
||||||
import (
|
|
||||||
"fmt"
|
|
||||||
|
|
||||||
"github.com/laramiel/bazel-example-golang-remote/remote"
|
|
||||||
)
|
|
||||||
|
|
||||||
func main() {
|
|
||||||
fmt.Println("Hello", remote.World())
|
|
||||||
}
|
|
Reference in New Issue
Block a user