Skip to content

Commit 890e234

Browse files
committed
Replace switch with if
Signed-off-by: Timo Sand <timo.sand@f-secure.com>
1 parent 5938cb5 commit 890e234

1 file changed

Lines changed: 7 additions & 10 deletions

File tree

github/resource_github_repository_pages.go

Lines changed: 7 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -376,16 +376,13 @@ func resourceGithubRepositoryPagesDiff(ctx context.Context, d *schema.ResourceDi
376376
}
377377

378378
buildType := d.Get("build_type").(string)
379-
switch buildType {
380-
case "workflow":
381-
if _, ok := d.GetOk("source"); ok {
382-
return fmt.Errorf("'source' is not supported for workflow build type")
383-
}
384-
return nil
385-
case "legacy":
386-
if _, ok := d.GetOk("source"); !ok {
387-
return fmt.Errorf("'source' is required for legacy build type")
388-
}
379+
_, ok := d.GetOk("source")
380+
381+
if buildType == "workflow" && ok {
382+
return fmt.Errorf("'source' is not supported for workflow build type")
383+
}
384+
if buildType == "legacy" && !ok {
385+
return fmt.Errorf("'source' is required for legacy build type")
389386
}
390387

391388
return nil

0 commit comments

Comments
 (0)