1

rename/fix the package

This commit is contained in:
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:map_kind go_binary go_binary //rules:rules_go.bzl
# gazelle:build_file_name BUILD # 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") gazelle(name = "gazelle")
buildifier(name = "buildifier") 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 go 1.16

View File

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

View File

@ -7,18 +7,25 @@ go_library(
cgo = True, cgo = True,
importpath = "github.com/motiejus/bazel-zig-cc/test", importpath = "github.com/motiejus/bazel-zig-cc/test",
visibility = ["//visibility:private"], visibility = ["//visibility:private"],
deps = ["@com_github_mattn_go_sqlite3//:go-sqlite3"],
) )
go_binary( go_binary(
name = "hello", name = "hello",
embed = [":hello_lib"], embed = [":test_lib"],
static = "on", static = "on",
visibility = ["//visibility:public"], visibility = ["//visibility:public"],
) )
go_test( go_test(
name = "hello_test", name = "test_test",
srcs = ["hello_test.go"], 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() C.printhello()
} }
func chello() string { func Chello() string {
return C.GoString(C.hello()) return C.GoString(C.hello())
} }

View File

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