Skip to content

Commit

Permalink
Add Validation check to see if func is already initialized (#2574)
Browse files Browse the repository at this point in the history
* Add Validation check to see if func is already initialized

* Refactor func init check in build.go
  • Loading branch information
tarunsunny3 authored Nov 15, 2024
1 parent c95f77e commit bf9a70a
Showing 1 changed file with 3 additions and 0 deletions.
3 changes: 3 additions & 0 deletions cmd/build.go
Original file line number Diff line number Diff line change
Expand Up @@ -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 <your 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(
Expand Down

0 comments on commit bf9a70a

Please sign in to comment.