Skip to content

Commit 3a3190e

Browse files
committed
fix: Lint fixes
1 parent 74169c3 commit 3a3190e

File tree

1 file changed

+5
-7
lines changed

1 file changed

+5
-7
lines changed

examples/iaasalpha/image/image.go

Lines changed: 5 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -38,9 +38,8 @@ func main() {
3838
if err != nil {
3939
fmt.Fprintf(os.Stderr, "[iaasalpha API] Error when calling `CreateImage`: %v\n", err)
4040
os.Exit(1)
41-
} else {
42-
fmt.Printf("[iaasalpha API] Image %q has been successfully created.\n", *imageCreateResp.Id)
4341
}
42+
fmt.Printf("[iaasalpha API] Image %q has been successfully created.\n", *imageCreateResp.Id)
4443

4544
// Upload the image by making a PUT request to upload URL
4645
fileContents, err := os.ReadFile(imageFilePath)
@@ -63,13 +62,13 @@ func main() {
6362
fmt.Fprintf(os.Stderr, "[iaasalpha API] Error when making request: %v\n", err)
6463
os.Exit(1)
6564
}
66-
defer resp.Body.Close()
6765
if resp.StatusCode != http.StatusOK {
6866
fmt.Fprintf(os.Stderr, "[iaasalpha API] Error when uploading image: %v\n", resp.Status)
67+
_ = resp.Body.Close()
6968
os.Exit(1)
70-
} else {
71-
fmt.Printf("[iaasalpha API] Image %q has been successfully uploaded.\n", *imageCreateResp.Id)
7269
}
70+
_ = resp.Body.Close()
71+
fmt.Printf("[iaasalpha API] Image %q has been successfully uploaded.\n", *imageCreateResp.Id)
7372

7473
// Wait for image to become available
7574
image, err := wait.ImageUploadWaitHandler(ctx, iaasalphaClient, projectId, *imageCreateResp.Id).WaitWithContext(ctx)
@@ -84,9 +83,8 @@ func main() {
8483
err = iaasalphaClient.DeleteImage(ctx, projectId, *imageCreateResp.Id).Execute()
8584
if err != nil {
8685
fmt.Fprintf(os.Stderr, "[iaasalpha API] Error when calling `DeleteImage`: %v\n", err)
87-
} else {
88-
fmt.Printf("[iaasalpha API] public IP %q has been successfully deleted.\n", *imageCreateResp.Id)
8986
}
87+
fmt.Printf("[iaasalpha API] Triggered deletion of image with ID %q.\n", *image.Id)
9088

9189
// Wait for image to be deleted
9290
_, err = wait.DeleteImageWaitHandler(ctx, iaasalphaClient, projectId, *imageCreateResp.Id).WaitWithContext(ctx)

0 commit comments

Comments
 (0)