Skip to content

Commit

Permalink
Execute chmod for TinyGo gocache on trap (#166)
Browse files Browse the repository at this point in the history
Signed-off-by: Takeshi Yoneda <takeshi@tetrate.io>

Co-authored-by: Crypt Keeper <64215+codefromthecrypt@users.noreply.github.com>
  • Loading branch information
mathetake and codefromthecrypt authored Apr 7, 2021
1 parent 6dbeacb commit 3841240
Showing 1 changed file with 8 additions and 6 deletions.
14 changes: 8 additions & 6 deletions images/extension-builders/tinygo/commands.sh
Original file line number Diff line number Diff line change
Expand Up @@ -16,19 +16,21 @@
set -ue

extension_build() {
set_trap
tinygo build -o "$1" -scheduler=none -target wasi main.go
# This is necessary since the created go caches are with read-only permission,
# and without this, the host user cannot delete the build directory with "rm -rf".
chmod -R u+rw "${GOMODCACHE}"
}

extension_test() {
set_trap
go test -tags=proxytest -v ./...
# This is necessary since the created go caches are with read-only permission,
# and without this, the host user cannot delete the build directory with "rm -rf".
chmod -R u+rw "${GOMODCACHE}"
}

extension_clean() {
rm -rf build
}

set_trap() {
# This is necessary since the created go caches are with read-only permission,
# and without this, the host user cannot delete the build directory with "rm -rf".
trap "chmod -R u+rw ${GOMODCACHE}" EXIT ERR INT TERM
}

0 comments on commit 3841240

Please sign in to comment.