github.com/meulengracht/snapd@v0.0.0-20210719210640-8bde69bcc84e/get-deps.sh (about)

     1  #!/bin/sh
     2  
     3  set -e
     4  
     5  if [ "$GOPATH" = "" ]; then
     6      tmpdir=$(mktemp -d)
     7      export GOPATH=$tmpdir
     8      # shellcheck disable=SC2064
     9      trap "rm -rf $tmpdir" EXIT
    10  
    11      mkdir -p "$tmpdir/src/github.com/snapcore/"
    12      ln -s "$(pwd)" "$tmpdir/src/github.com/snapcore/snapd"
    13      cd "$tmpdir/src/github.com/snapcore/snapd"
    14  fi
    15  
    16  if ! command -v govendor >/dev/null;then
    17      export PATH="$PATH:${GOPATH%%:*}/bin"
    18  
    19      if ! command -v govendor >/dev/null;then
    20  	    echo Installing govendor
    21  	    go get -u github.com/kardianos/govendor
    22      fi
    23  fi
    24  
    25  echo Obtaining dependencies
    26  govendor sync
    27  
    28  
    29  if [ "$1" != "--skip-unused-check" ]; then
    30      unused="$(govendor list +unused)"
    31      if [ "$unused" != "" ]; then
    32          echo "Found unused ./vendor packages:"
    33          echo "$unused"
    34          echo "Please fix via 'govendor remove +unused'"
    35          exit 1
    36      fi
    37  fi