Synthesize fake GOPATH and remove bazel_copy_generated_for_ide.sh
We can use rules_go to create a fake symlink farm GOPATH. This can be
set as the GOPATH in IDEs that do not have native support for Bazel,
and we can stop maintaining the bazel_copy_generated_for_ide.sh hack.
The remaining issue is that we still need Go tooling to manage our
go.mod file that serves as the input to Gazelle, so we need to add
replace directives to ensure that Go tools can resolve generated code.
The proper fix for all this is the upcoming native Bazel support in Go:
https://github.com/bazelbuild/rules_go/issues/512
Test Plan:
Ran `bazel build :gopath`, and a wild
`bazel-bin/gopath/src/git.monogon.dev/source/nexantic.git/core/generated/api/schema.pb.go`
appeared.
`scripts/symlink_generated_files.sh` created a valid symlink in core/generated
and `go mod tidy` ran successfully (despite complaining about the symlink).
Running `scripts/gazelle.sh` twice worked.
X-Origin-Diff: phab/D305
GitOrigin-RevId: 0d456bc57d4a2d72e30865ffef777d2f5be5c407
diff --git a/scripts/symlink_generated_files.sh b/scripts/symlink_generated_files.sh
new file mode 100755
index 0000000..5596efd
--- /dev/null
+++ b/scripts/symlink_generated_files.sh
@@ -0,0 +1,10 @@
+#!/bin/bash
+
+create_symlinks() {
+ local package=$1
+
+ rm -rf "$package"
+ ln -r -s "bazel-bin/gopath/src/git.monogon.dev/source/nexantic.git/$package" "$package"
+}
+
+create_symlinks core/generated