Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

add error handling #82568

Closed
wants to merge 1 commit into from
Closed
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
14 changes: 11 additions & 3 deletions cluster/gce/gci/configure_helper_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -112,7 +112,11 @@ func (c *ManifestTestCase) mustCreateEnv(envTemplate string, env interface{}) st
if err != nil {
c.t.Fatalf("Failed to create envScript: %v", err)
}
defer f.Close()
defer func() {
if err = f.Close(); err != nil {
c.t.Fatalf("Failed to close envScript: %v", err)
}
}()

t := template.Must(template.New("env").Parse(envTemplate))

Expand Down Expand Up @@ -147,8 +151,12 @@ func (c *ManifestTestCase) mustLoadPodFromManifest() {
}
}

func (c *ManifestTestCase) tearDown() {
os.RemoveAll(c.kubeHome)
func (c *ManifestTestCase) tearDown() (err error) {
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

don't need named return value

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I don't find any use of this return value, not sure why we are adding it.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

ok, I am sorry about that, And I will close it.

err = os.RemoveAll(c.kubeHome)
if err != nil {
return err
}
return err
}

func copyFile(src, dst string) (err error) {
Expand Down