Skip to content

Instantly share code, notes, and snippets.

@mschoch
Last active March 31, 2020 14:48
Show Gist options
  • Save mschoch/18db54192754e16e149b1546b7ae58af to your computer and use it in GitHub Desktop.
Save mschoch/18db54192754e16e149b1546b7ae58af to your computer and use it in GitHub Desktop.
#!/bin/sh
# create temp directory to do all work
tmpfile=$(mktemp -d)
echo "Working in $tmpfile"
cd $tmpfile
# check out gocbcore
git clone [email protected]:couchbase/gocbcore.git
# start cbcore changes
cd gocbcore
# switch to commit needed by cbft/cbgt
git checkout c6e079e95daae3c480d0ba3644c28eeef6a43fef
# end gocbcore
cd $tmpfile
# checkout cbgt
git clone [email protected]:couchbase/cbgt.git
# start cbgt changes
cd cbgt
# make this a Go module
go mod init github.com/couchbase/cbgt
# modify how it refers to gocbcore
# in the Go modules world it must use gocbcore/v8
sed -i 's#"github.com/couchbase/gocbcore"#"github.com/couchbase/gocbcore/v8"#' feed_dcp_gocbcore.go
sed -i 's#"github.com/couchbase/gocbcore"#"github.com/couchbase/gocbcore/v8"#' gocbcore_helper.go
# end cbgt
cd $tmpfile
# check out bleve
git clone [email protected]:blevesearch/bleve.git
# start bleve changes
cd bleve
# check out bleve branch gomod-refactor-from-blugelabs (PR #1342)
git checkout gomod-refactor-from-blugelabs
# end bleve changes
cd $tmpfile
# check out cbft
git clone [email protected]:couchbase/cbft.git
# start cbft changes
cd cbft
# make this a Go module
go mod init github.com/couchbase/cbft
# point Go modules to our local versions
go mod edit -replace github.com/couchbase/gocbcore/v8=$tmpfile/gocbcore
go mod edit -replace github.com/couchbase/cbgt=$tmpfile/cbgt
go mod edit -replace github.com/blevesearch/bleve=$tmpfile/bleve
# build main cbft binary
cd cmd/cbft
go build
# done
echo "final binary should be found in $tmpfile/cbft/cmd/cbft/cbft"
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment