Skip to content

Commit e3c7b0d

Browse files
authored
Merge pull request #8130 from my-git9/chore-errors
🌱 Use errors.Is to check for a specific error
2 parents 41b0fb6 + 0260865 commit e3c7b0d

File tree

2 files changed

+3
-3
lines changed

2 files changed

+3
-3
lines changed

hack/tools/log-push/main.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -192,7 +192,7 @@ func getLogsFromGCS(ctx context.Context, logPath string, logFileRegex *regexp.Re
192192
attrs, err := it.Next()
193193
if err != nil {
194194
// Break if there are no other files.
195-
if err == iterator.Done {
195+
if errors.Is(err, iterator.Done) {
196196
break
197197
}
198198
return nil, errors.Wrapf(err, "failed to get logs from GCS: failed to get next file")

util/yaml/yaml.go

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -116,7 +116,7 @@ func Parse(input ParseInput) (*ParseOutput, error) {
116116
for {
117117
u := &unstructured.Unstructured{}
118118
_, gvk, err := decoder.Decode(nil, u)
119-
if err == io.EOF {
119+
if errors.Is(err, io.EOF) {
120120
break
121121
}
122122
if runtime.IsNotRegisteredError(err) {
@@ -204,7 +204,7 @@ func ToUnstructured(rawyaml []byte) ([]unstructured.Unstructured, error) {
204204
// Read one YAML document at a time, until io.EOF is returned
205205
b, err := reader.Read()
206206
if err != nil {
207-
if err == io.EOF {
207+
if errors.Is(err, io.EOF) {
208208
break
209209
}
210210
return nil, errors.Wrapf(err, "failed to read yaml")

0 commit comments

Comments
 (0)