Ensure nogo has a working env during `make deps-update`
If the sandbox is not already generated, bazel calls which happen in
`hack/bootstrap.sh` need the inefassign BUILD.bazel already before the
bootstrap file is sourced. Moving it to the beginning of the file.
#!/usr/bin/env bash
-source hack/common.sh
-source hack/bootstrap.sh
-source hack/config.sh
-
-# remove libvirt BUILD file to regenerate it each time
-rm -f vendor/libvirt.org/go/libvirt/BUILD.bazel
-
+# first ensure this file, so that sandbox bootstrapping has a working nogo setup
+# without this sourcin hack/bootstraph.sh will fail
cat >vendor/github.com/gordonklaus/ineffassign/pkg/ineffassign/BUILD.bazel <<EOT
# gazelle:ignore
load("@io_bazel_rules_go//go:def.bzl", "go_tool_library")
@@ -21,6 +16,13 @@ go_tool_library(
)
EOT
+source hack/common.sh
+source hack/bootstrap.sh
+source hack/config.sh
+
+# remove libvirt BUILD file to regenerate it each time
+rm -f vendor/libvirt.org/go/libvirt/BUILD.bazel
+
# generate BUILD files
bazel run \
--config=${ARCHITECTURE} \
