Skip to content

Commit

Permalink
file removal done
Browse files Browse the repository at this point in the history
  • Loading branch information
Rajan Joshi committed Mar 2, 2020
1 parent d9b884a commit 8a8e633
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion beater/pubsubbeat.go
Original file line number Diff line number Diff line change
Expand Up @@ -175,6 +175,8 @@ func createPubsubClient(config *config.Config) (*pubsub.Client, error) {
if err != nil {
return nil, fmt.Errorf("fail to create temp file for decrypted credentials: %v", err)
}
defer os.Remove(tempFile.Name())

options := []option.ClientOption{option.WithUserAgent(userAgent)}
if config.CredentialsFile != "" {
c, err := ioutil.ReadFile(config.CredentialsFile) // just pass the file name
Expand All @@ -195,7 +197,6 @@ func createPubsubClient(config *config.Config) (*pubsub.Client, error) {
if err != nil {
return nil, fmt.Errorf("fail to create pubsub client: %v", err)
}
os.Remove(tempFile.Name())
return client, nil
}

Expand Down

0 comments on commit 8a8e633

Please sign in to comment.