treewide: replace hardcoded runfiles paths

We hardcoded some of the runfiles paths to find specific files. This replaces the hardcoded paths by a call to rlocationpath. This prevents running a target without the correct dependencies at build time instead of at runtime

Change-Id: I7ce56935ac80be6b28b824ccb0781ab401bd6521
Reviewed-on: https://review.monogon.dev/c/monogon/+/3301
Reviewed-by: Serge Bazanski <serge@monogon.tech>
Tested-by: Jenkins CI
diff --git a/go/qcow2/BUILD.bazel b/go/qcow2/BUILD.bazel
index 07afa58..c4806eb 100644
--- a/go/qcow2/BUILD.bazel
+++ b/go/qcow2/BUILD.bazel
@@ -3,16 +3,19 @@
 go_library(
     name = "qcow2",
     srcs = ["qcow2.go"],
+    data = [
+        "@qemu//:qemu-img",
+    ],
     importpath = "source.monogon.dev/go/qcow2",
     visibility = ["//visibility:public"],
+    x_defs = {
+        "xQemuImgPath": "$(rlocationpath @qemu//:qemu-img )",
+    },
 )
 
 go_test(
     name = "qcow2_test",
     srcs = ["qcow2_test.go"],
-    data = [
-        "@qemu//:qemu-img",
-    ],
     embed = [":qcow2"],
     deps = ["@io_bazel_rules_go//go/runfiles:go_default_library"],
 )