-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
42f0fe0
commit 8e81649
Showing
2 changed files
with
17 additions
and
8 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,19 +1,28 @@ | ||
#!/bin/bash | ||
|
||
export TOOL_VERSION=v0.3.0 | ||
export TOOL_VERSION=v0.4.0 | ||
|
||
go install github.com/qiansheng91/go-instrumentation-tool@${TOOL_VERSION} | ||
wget -O /tmp/configuration.yaml "https://github.com/qiansheng91/go-instrumentation-tool/releases/download/${TOOL_VERSION}/configuration.yaml" | ||
|
||
if [[ ! -f /tmp/configuration.yaml ]]; then | ||
wget -O /tmp/configuration.yaml "https://github.com/qiansheng91/go-instrumentation-tool/releases/download/${TOOL_VERSION}/configuration.yaml" | ||
fi | ||
|
||
echo "back up go mod files" | ||
[[ -f go.mod.bak ]] && cp go.mod go.mod.bak | ||
[[ -f go.sum.bak ]] && cp go.sum go.sum.bak | ||
[[ -f addition_deps.go]] && rm addition_deps.go | ||
|
||
export INSTRUMENT_CONFIG_FILE=/tmp/configuration.yaml | ||
|
||
${GOPATH}/bin/go-instrumentation-tool rewrite-deps . | ||
go build -a -toolexec "${GOPATH}/bin/go-instrumentation-tool wrap" . | ||
|
||
echo "restore go mod files" | ||
[[ -f go.mod.bak ]] && cp go.mod.bak go.mod && rm go.mod.bak | ||
[[ -f go.sum.bak ]] && cp go.sum.bak go.sum && rm go.sum.bak | ||
if [[ $? -ne 0 ]]; then | ||
echo "failed to build package, Please check the error message above" | ||
exit -1 | ||
else | ||
echo "build package successfully" | ||
[[ -f go.mod.bak ]] && cp go.mod.bak go.mod && rm go.mod.bak | ||
[[ -f go.sum.bak ]] && cp go.sum.bak go.sum && rm go.sum.bak | ||
[[ -f addition_deps.go]] && rm addition_deps.go | ||
fi |
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