1
Fork 0

rename/fix the package

nix
Motiejus Jakštys 2022-01-28 15:57:22 +02:00
parent f19927ac17
commit 1cd04478b7
6 changed files with 18 additions and 11 deletions

2
BUILD
View File

@ -4,7 +4,7 @@ load("@com_github_bazelbuild_buildtools//buildifier:def.bzl", "buildifier")
# gazelle:map_kind go_binary go_binary //rules:rules_go.bzl
# gazelle:build_file_name BUILD
# gazelle:prefix github.com/motiejus/bazel-zig-cc
# gazelle:prefix git.sr.ht/~motiejus/bazel-zig-cc
gazelle(name = "gazelle")
buildifier(name = "buildifier")

2
go.mod
View File

@ -1,3 +1,3 @@
module github.com/motiejus/bazel-zig-cc/test
module git.sr.ht/~motiejus/bazel-zig-cc
go 1.16

View File

@ -1,4 +1,2 @@
load("@bazel_gazelle//:deps.bzl", "go_repository")
def go_repositories():
pass

View File

@ -7,18 +7,25 @@ go_library(
cgo = True,
importpath = "github.com/motiejus/bazel-zig-cc/test",
visibility = ["//visibility:private"],
deps = ["@com_github_mattn_go_sqlite3//:go-sqlite3"],
)
go_binary(
name = "hello",
embed = [":hello_lib"],
embed = [":test_lib"],
static = "on",
visibility = ["//visibility:public"],
)
go_test(
name = "hello_test",
name = "test_test",
srcs = ["hello_test.go"],
embed = [":hello_lib"],
embed = [":test_lib"],
)
go_library(
name = "test_lib",
srcs = ["hello.go"],
cgo = True,
importpath = "git.sr.ht/~motiejus/bazel-zig-cc/test",
visibility = ["//visibility:private"],
)

View File

@ -9,6 +9,6 @@ func main() {
C.printhello()
}
func chello() string {
func Chello() string {
return C.GoString(C.hello())
}

View File

@ -1,10 +1,12 @@
package main
import "testing"
import (
"testing"
)
func TestHello(t *testing.T) {
want := "hello, world"
got := chello()
got := Chello()
if got != want {
t.Errorf("expected %q, got %q", want, got)
}