diff --git a/build-wg-go.sh b/build-wg-go.sh index 25fd4da..cb3bb9e 100644 --- a/build-wg-go.sh +++ b/build-wg-go.sh @@ -8,4 +8,7 @@ set -e GOPATH=`pwd` go get -v -d golang.zx2c4.com/wireguard # Build -GOPATH=`pwd` GOOS=linux GOARCH=amd64 go build -v -o wireguard-go `find . -type d -name "wireguard"` +OLD_PATH=`pwd` +NEW_PATH=`dirname $(find . -type f -name "go.mod" | grep "wireguard")` +cd ${NEW_PATH} +GOPATH=${OLD_PATH} GOOS=linux GOARCH=amd64 go build -v -o "${OLD_PATH}/wireguard-go"