-
-
Notifications
You must be signed in to change notification settings - Fork 709
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
First steps on migrating to a new version of mongo.
We're going to write a helper binary for this in Go, because: - The currently maintained driver package supports mongo versions back to 2.6 (what we're using), which is not true for most other languages. - We already have go in our toolchain for boringssl's test suite. - The build is unlikely to break due to bitrot re: Go's toolchain. - The generated binary is static, so all else fails we can just bundle the executable, though I don't anticipate that. - I will be much more productive than in something else.
- Loading branch information
Showing
4 changed files
with
39 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,26 @@ | ||
#!/usr/bin/env bash | ||
|
||
top=$PWD | ||
module_dir="$(dirname $0)" | ||
|
||
echo findProvider special:ekam-interceptor | ||
read INTERCEPTOR | ||
|
||
if test "$INTERCEPTOR" = ""; then | ||
echo "error: couldn't find intercept.so." >&2 | ||
exit 1 | ||
fi | ||
|
||
# The go toolchain itself is statically linked, so we can't just | ||
# run `go build` with the interceptor. But we can just use find. | ||
# Note: it would be tempting at this point to skip the interceptor | ||
# alltogether, but we want to also re-run if new sources files are | ||
# added, even if none of the old ones references them. | ||
LD_PRELOAD=$INTERCEPTOR find $module_dir -type f -name '*.go' | ||
LD_PRELOAD=$INTERCEPTOR find $module_dir -type f -name go.mod | ||
|
||
echo newOutput sandstorm-migrate-mongo | ||
read OUTPUT_DISK_PATH | ||
|
||
cd $module_dir | ||
go build -o $top/$OUTPUT_DISK_PATH |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
module github.com/sandstorm-io/sandstorm/src/sandstorm-migrate-mongo | ||
|
||
go 1.18 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
package main | ||
|
||
import "fmt" | ||
|
||
func main() { | ||
fmt.Println("Hello, World!") | ||
} |