github.com/replit/upm@v0.0.0-20240423230255-9ce4fc3ea24c/scripts/docker-prefetch.bash (about)

     1  #!/usr/bin/env bash
     2  
     3  set -e
     4  set -o pipefail
     5  
     6  cd /tmp
     7  
     8  # Turns out 'go mod' is hardcoded to disallow go.mod in /tmp
     9  # specifically, so we have to move to a subdirectory. See
    10  # <https://github.com/golang/vgo/blob/9d567625acf4c5e156b9890bf6feb16eb9fa5c51/vendor/cmd/go/internal/modload/init.go#L157-L166>.
    11  mkdir tmp-go
    12  mv go.* tmp-go/
    13  
    14  pushd tmp-go >/dev/null
    15  go mod download
    16  popd >/dev/null
    17  
    18  rm -rf tmp-go
    19  
    20  rm "$0"