From bf9a70a648c6240f2dbc64e40a519af1ab0ce834 Mon Sep 17 00:00:00 2001 From: Tarun Chinthakindi <46301788+tarunsunny3@users.noreply.github.com> Date: Fri, 15 Nov 2024 06:07:43 -0700 Subject: [PATCH] Add Validation check to see if func is already initialized (#2574) * Add Validation check to see if func is already initialized * Refactor func init check in build.go --- cmd/build.go | 3 +++ 1 file changed, 3 insertions(+) diff --git a/cmd/build.go b/cmd/build.go index aab47aa27c..4917997675 100644 --- a/cmd/build.go +++ b/cmd/build.go @@ -307,6 +307,9 @@ func (c buildConfig) Prompt() (buildConfig, error) { if err != nil { return c, err } + if !f.Initialized() { + return c, fmt.Errorf("no function has been initialized in %q. Please initialize a function by running:\n- func init --language ", c.Path) + } if (f.Registry == "" && c.Registry == "" && c.Image == "") || c.Confirm { fmt.Println("A registry for function images is required. For example, 'docker.io/tigerteam'.") err := survey.AskOne(