From 9efeb8a41afe97943341739379a710e0d368a49d Mon Sep 17 00:00:00 2001 From: Dawid Pogorzelski Date: Fri, 21 Jan 2022 13:32:52 +0100 Subject: [PATCH] Add meaningful error message when project id is missing --- pkg/speedrun/cloud/instance.go | 3 +++ 1 file changed, 3 insertions(+) diff --git a/pkg/speedrun/cloud/instance.go b/pkg/speedrun/cloud/instance.go index de8e188..47fe112 100644 --- a/pkg/speedrun/cloud/instance.go +++ b/pkg/speedrun/cloud/instance.go @@ -28,6 +28,9 @@ func (i Instance) GetAddress(private bool) string { func GetInstances(target string) ([]Instance, error) { project := viper.GetString("gcp.projectid") + if project == "" { + return nil, fmt.Errorf("missing Google Cloud project ID, consider adding it to your config file: %s", viper.ConfigFileUsed()) + } gcpClient, err := NewGCPClient() if err != nil {