Skip to content

Commit fe4d543

Browse files
committed
use switch statement for cloudRunType check
1 parent 6860646 commit fe4d543

1 file changed

Lines changed: 5 additions & 4 deletions

File tree

cmd/serverless-init/cloudservice/cloudrun.go

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -280,13 +280,14 @@ func GetMetaData(config *GCPConfig, cloudRunType CloudRunType) map[string]string
280280
getMeta := func(fnMetadata func(*http.Client, string) string, url string, baseKey string) {
281281
val := fnMetadata(httpClient, url)
282282
metaChan <- keyVal{baseKey, val}
283-
if cloudRunType == CloudRunJob {
283+
switch cloudRunType {
284+
case CloudRunJob:
284285
metaChan <- keyVal{cloudRunJobTagPrefix + baseKey, val}
285-
} else if cloudRunType == CloudRunService {
286+
case CloudRunService:
286287
metaChan <- keyVal{cloudRunServiceTagPrefix + baseKey, val}
287-
} else if cloudRunType == CloudRunFunction {
288+
case CloudRunFunction:
288289
metaChan <- keyVal{cloudRunFunctionTagPrefix + baseKey, val}
289-
} else {
290+
default:
290291
panic(fmt.Sprintf("unexpected cloudRunType for GCP metadata: %d", cloudRunType))
291292
}
292293
}

0 commit comments

Comments
 (0)