Skip to content

Commit

Permalink
Handle case when function is not a module
Browse files Browse the repository at this point in the history
**What**
- Add check and skip when the funciton folder is not a module
Signed-off-by: Lucas Roesler <roesler.lucas@gmail.com>
  • Loading branch information
LucasRoesler authored and alexellis committed May 5, 2021
1 parent 974861a commit 5d6376e
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 0 deletions.
5 changes: 5 additions & 0 deletions template/golang-http/modules-cleanup.sh
Expand Up @@ -28,6 +28,11 @@ cleanup_gomod() {
return;
fi

if [ ! -f ./function/go.mod ]; then
echo "module not initialized, skipping go.mod cleanup"
return;
fi

echo "cleaning up go.mod"

# Copy the user's go.mod
Expand Down
10 changes: 10 additions & 0 deletions template/golang-middleware/modules-cleanup.sh
Expand Up @@ -28,6 +28,11 @@ cleanup_gomod() {
return;
fi

if [ ! -f ./function/go.mod ]; then
echo "module not initialized, skipping go.mod cleanup"
return;
fi

echo "cleaning up go.mod"

# Copy the user's go.mod
Expand Down Expand Up @@ -98,6 +103,11 @@ cleanup_vendor_modulestxt() {
return;
fi

if [ -f ./function/go.mod ]; then
echo "module not initialized, skipping go.mod cleanup"
return;
fi

echo "cleanup vendor/modules.txt"

# just in case
Expand Down

0 comments on commit 5d6376e

Please sign in to comment.