Skip to content

Commit 5d6376e

Browse files
LucasRoesleralexellis
authored andcommitted
Handle case when function is not a module
**What** - Add check and skip when the funciton folder is not a module Signed-off-by: Lucas Roesler <roesler.lucas@gmail.com>
1 parent 974861a commit 5d6376e

File tree

2 files changed

+15
-0
lines changed

2 files changed

+15
-0
lines changed

template/golang-http/modules-cleanup.sh

+5
Original file line numberDiff line numberDiff line change
@@ -28,6 +28,11 @@ cleanup_gomod() {
2828
return;
2929
fi
3030

31+
if [ ! -f ./function/go.mod ]; then
32+
echo "module not initialized, skipping go.mod cleanup"
33+
return;
34+
fi
35+
3136
echo "cleaning up go.mod"
3237

3338
# Copy the user's go.mod

template/golang-middleware/modules-cleanup.sh

+10
Original file line numberDiff line numberDiff line change
@@ -28,6 +28,11 @@ cleanup_gomod() {
2828
return;
2929
fi
3030

31+
if [ ! -f ./function/go.mod ]; then
32+
echo "module not initialized, skipping go.mod cleanup"
33+
return;
34+
fi
35+
3136
echo "cleaning up go.mod"
3237

3338
# Copy the user's go.mod
@@ -98,6 +103,11 @@ cleanup_vendor_modulestxt() {
98103
return;
99104
fi
100105

106+
if [ -f ./function/go.mod ]; then
107+
echo "module not initialized, skipping go.mod cleanup"
108+
return;
109+
fi
110+
101111
echo "cleanup vendor/modules.txt"
102112

103113
# just in case

0 commit comments

Comments
 (0)