mirror of
https://github.com/prometheus-community/json_exporter
synced 2024-12-24 23:42:41 +00:00
21 lines
528 B
Bash
Executable File
21 lines
528 B
Bash
Executable File
#!/bin/bash
|
|
set -e
|
|
|
|
GO=go
|
|
PACKAGE_LOCATION_GIT_REMOTE=origin
|
|
PACKAGE_LOCATION=$(git config --get "remote.$PACKAGE_LOCATION_GIT_REMOTE.url" | sed 's/^[^@]*@//' | sed 's/^.*:\/\///' | sed 's/\.git$//')
|
|
|
|
PROJECT_ROOT_DIR=$(cd $(dirname $0); pwd)
|
|
GOPATH=$PROJECT_ROOT_DIR/build
|
|
|
|
LOCAL_PACKAGE_PATH=$GOPATH/src/$(echo "$PACKAGE_LOCATION" | tr ':' '/')
|
|
LOCAL_PACKAGE_DIR=$(dirname $LOCAL_PACKAGE_PATH)
|
|
|
|
mkdir -p $LOCAL_PACKAGE_DIR
|
|
ln -sfn $PROJECT_ROOT_DIR $LOCAL_PACKAGE_PATH
|
|
|
|
export GOBIN="$GOPATH/bin"
|
|
export GOPATH
|
|
|
|
exec $GO "$@"
|