diff --git a/README.md b/README.md index c48ca24..76f8d9e 100644 --- a/README.md +++ b/README.md @@ -168,9 +168,9 @@ may apply to aarch64, but the author didn't find a need to test it (yet). ## linux cgo + glibc 2.28 ``` -$ bazel build --platforms @zig_sdk//:linux_amd64_platform //test:hello -$ file bazel-out/k8-fastbuild-ST-d17813c235ce/bin/test/hello_/hello -bazel-out/k8-fastbuild-ST-d17813c235ce/bin/test/hello_/hello: ELF 64-bit LSB executable, x86-64, version 1 (SYSV), dynamically linked, interpreter /lib64/ld-linux-x86-64.so.2, for GNU/Linux 2.0.0, Go BuildID=redacted, with debug_info, not stripped +$ bazel build --platforms @zig_sdk//:linux_amd64_platform //test/go:go +$ file bazel-out/k8-opt-ST-d17813c235ce/bin/test/go/go_/go +bazel-out/k8-opt-ST-d17813c235ce/bin/test/go/go_/go: ELF 64-bit LSB executable, x86-64, version 1 (SYSV), dynamically linked, interpreter /lib64/ld-linux-x86-64.so.2, for GNU/Linux 2.0.0, Go BuildID=redacted, with debug_info, not stripped ``` ## linux cgo + musl @@ -178,21 +178,21 @@ bazel-out/k8-fastbuild-ST-d17813c235ce/bin/test/hello_/hello: ELF 64-bit LSB exe ``` $ bazel build \ --platforms @zig_sdk//:linux_amd64_platform \ - --extra_toolchains @zig_sdk//:linux_amd64_musl_toolchain //test:hello + --extra_toolchains @zig_sdk//:linux_amd64_musl_toolchain //test/go:go ... -$ file ../bazel-out/k8-fastbuild-ST-d17813c235ce/bin/test/hello_/hello -../bazel-out/k8-fastbuild-ST-d17813c235ce/bin/test/hello_/hello: ELF 64-bit LSB executable, x86-64, version 1 (SYSV), statically linked, Go BuildID=redacted, with debug_info, not stripped -$ ../bazel-out/k8-fastbuild-ST-d17813c235ce/bin/test/hello_/hello +$ file bazel-out/k8-opt-ST-d17813c235ce/bin/test/go/go_/go +bazel-out/k8-opt-ST-d17813c235ce/bin/test/go/go_/go: ELF 64-bit LSB executable, x86-64, version 1 (SYSV), statically linked, Go BuildID=redacted, stripped +$ bazel-out/k8-opt-ST-d17813c235ce/bin/test/go/go_/go hello, world ``` ## macos cgo ``` -$ bazel build --platforms @zig_sdk//:darwin_amd64_platform //test:hello +$ bazel build --platforms @zig_sdk//:darwin_amd64_platform //test/go:go ... -$ file bazel-bin/test/hello_/hello -bazel-bin/test/hello_/hello: Mach-O 64-bit x86_64 executable, flags: +$ file bazel-out/k8-opt-ST-d17813c235ce/bin/test/go/go_/go +bazel-out/k8-opt-ST-d17813c235ce/bin/test/go/go_/go: Mach-O 64-bit x86_64 executable, flags: ``` ## Transient docker environment diff --git a/ci/test b/ci/test index 070f757..ef778dd 100755 --- a/ci/test +++ b/ci/test @@ -21,9 +21,9 @@ _test() { >&2 echo >&2 echo "Testing $name and looking for '$glob':" >&2 echo - >&2 echo " bazel build $* //test:test" + >&2 echo " bazel build $* //test/go:go" >&2 echo - if _build_and_file "$@" //test:test | grep -q "$glob"; then + if _build_and_file "$@" //test/go:go | grep -q "$glob"; then >&2 echo "OK $name" return 0 else diff --git a/test/BUILD b/test/go/BUILD similarity index 64% rename from test/BUILD rename to test/go/BUILD index 25e7dae..e126529 100644 --- a/test/BUILD +++ b/test/go/BUILD @@ -2,22 +2,22 @@ load("@io_bazel_rules_go//go:def.bzl", "go_library", "go_test") load("//rules:rules_go.bzl", "go_binary") go_library( - name = "test_lib", + name = "go_lib", srcs = ["hello.go"], cgo = True, - importpath = "git.sr.ht/~motiejus/bazel-zig-cc/test", + importpath = "git.sr.ht/~motiejus/bazel-zig-cc/test/go", visibility = ["//visibility:private"], ) go_binary( - name = "test", - embed = [":test_lib"], + name = "go", + embed = [":go_lib"], static = "on", visibility = ["//visibility:public"], ) go_test( - name = "test_test", + name = "go_test", srcs = ["hello_test.go"], - embed = [":test_lib"], + embed = [":go_lib"], ) diff --git a/test/hello.go b/test/go/hello.go similarity index 100% rename from test/hello.go rename to test/go/hello.go diff --git a/test/hello_test.go b/test/go/hello_test.go similarity index 100% rename from test/hello_test.go rename to test/go/hello_test.go