Skip to content
This repository was archived by the owner on Mar 27, 2024. It is now read-only.

Code improvement in function readErrorsFromChannel() #347

Merged
merged 1 commit into from
Feb 25, 2021

Conversation

nicolasdilley
Copy link
Contributor

I think there could be a code improvement in function readErrorsFromChannel

the for loop declared at line 88 simply behaves as a
for range

- for {
-		err, ok := <-c
-		if !ok {
-			break
-		}
-		errs = append(errs, err.Error())
-	}

+ for err := range c {
+	errs = append(errs, err.Error())
+}

I think there could be a code improvement in function [readErrorsFromChannel](https://github.com/GoogleContainerTools/container-diff/blob/2db69958428be9e21daf3bce6a1c83404e7b161e/cmd/diff.go#L86) 

the for loop declared at [line 88](https://github.com/GoogleContainerTools/container-diff/blob/2db69958428be9e21daf3bce6a1c83404e7b161e/cmd/diff.go#L86) simply behaves as a
`for range`  

```diff
- for {
-		err, ok := <-c
-		if !ok {
-			break
-		}
-		errs = append(errs, err.Error())
-	}

+ for err := range c {
+	errs = append(errs, err.Error())
+}
```
@google-cla
Copy link

google-cla bot commented Feb 2, 2021

Thanks for your pull request. It looks like this may be your first contribution to a Google open source project (if not, look below for help). Before we can look at your pull request, you'll need to sign a Contributor License Agreement (CLA).

📝 Please visit https://cla.developers.google.com/ to sign.

Once you've signed (or fixed any issues), please reply here with @googlebot I signed it! and we'll verify it.


What to do if you already signed the CLA

Individual signers
Corporate signers

ℹ️ Googlers: Go here for more info.

@nicolasdilley
Copy link
Contributor Author

@googlebot I signed it!

Copy link
Contributor

@nkubala nkubala left a comment

Choose a reason for hiding this comment

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

thanks @nicolasdilley!

@nkubala nkubala merged commit a45703e into GoogleContainerTools:master Feb 25, 2021
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants