Skip to content

fix(k8s): Fix inet-type panic#6841

Merged
kodiakhq[bot] merged 2 commits intocloudquery:mainfrom
shimonp21:fix_k8s_inet_panic
Jan 17, 2023
Merged

fix(k8s): Fix inet-type panic#6841
kodiakhq[bot] merged 2 commits intocloudquery:mainfrom
shimonp21:fix_k8s_inet_panic

Conversation

@shimonp21
Copy link
Copy Markdown
Contributor

@shimonp21 shimonp21 commented Jan 16, 2023

Make our resolvers ignore None strings.

The other way to fix is to just leave the incoming field as a string. This way is less breaking for users.

@shimonp21 shimonp21 requested review from a team, hermanschaaf and yevgenypats January 16, 2023 12:26
@cq-bot cq-bot added the k8s label Jan 16, 2023
@yevgenypats
Copy link
Copy Markdown
Contributor

Seems tests are failing

@shimonp21
Copy link
Copy Markdown
Contributor Author

Yeah, the failing tests was the linter complaining about the for-loop-address issue Alex found. Fixed now :)

Comment on lines +83 to +89
for i := range stringArrayValue {
if stringArrayValue[i] != "" && stringArrayValue[i] != "None" {
sanitized = append(sanitized, &stringArrayValue[i])
} else {
sanitized = append(sanitized, nil)
}
}
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Actually, it could be fixed even easier: https://go.dev/play/p/p6YgBjZXixI

Suggested change
for i := range stringArrayValue {
if stringArrayValue[i] != "" && stringArrayValue[i] != "None" {
sanitized = append(sanitized, &stringArrayValue[i])
} else {
sanitized = append(sanitized, nil)
}
}
for _, v := range stringArrayValue {
v := v
if v == "" || v == "None" {
sanitized = append(sanitized, nil)
continue
}
sanitized = append(sanitized, &v)
}

Comment on lines +122 to +128
for i := range stringArrayValue {
if stringArrayValue[i] != "" && stringArrayValue[i] != "None" {
sanitized = append(sanitized, &stringArrayValue[i])
} else {
sanitized = append(sanitized, nil)
}
}
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Actually, it could be fixed even easier: https://go.dev/play/p/p6YgBjZXixI

Suggested change
for i := range stringArrayValue {
if stringArrayValue[i] != "" && stringArrayValue[i] != "None" {
sanitized = append(sanitized, &stringArrayValue[i])
} else {
sanitized = append(sanitized, nil)
}
}
for _, v := range stringArrayValue {
v := v
if v == "" || v == "None" {
sanitized = append(sanitized, nil)
continue
}
sanitized = append(sanitized, &v)
}

@shimonp21 shimonp21 added the automerge Automatically merge once required checks pass label Jan 17, 2023
@kodiakhq kodiakhq bot merged commit 8c301f8 into cloudquery:main Jan 17, 2023
kodiakhq bot pushed a commit that referenced this pull request Jan 17, 2023
🤖 I have created a release *beep* *boop*
---


## [3.0.1](plugins-source-k8s-v3.0.0...plugins-source-k8s-v3.0.1) (2023-01-17)


### Bug Fixes

* **deps:** Update module github.com/cloudquery/plugin-sdk to v1.24.2 ([#6695](#6695)) ([694ab9f](694ab9f))
* **deps:** Update module github.com/cloudquery/plugin-sdk to v1.25.0 ([#6745](#6745)) ([9c41854](9c41854))
* **deps:** Update module github.com/cloudquery/plugin-sdk to v1.25.1 ([#6805](#6805)) ([9da0ce2](9da0ce2))
* **deps:** Update module github.com/cloudquery/plugin-sdk to v1.26.0 ([#6839](#6839)) ([6ccda8d](6ccda8d))
* **deps:** Update module github.com/cloudquery/plugin-sdk to v1.27.0 ([#6856](#6856)) ([545799b](545799b))
* **k8s:** Fix inet-type panic ([#6841](#6841)) ([8c301f8](8c301f8))

---
This PR was generated with [Release Please](https://github.com/googleapis/release-please). See [documentation](https://github.com/googleapis/release-please#release-please).
daniel-garcia pushed a commit to infobloxopen/ibcq-source-k8s that referenced this pull request Feb 24, 2026
🤖 I have created a release *beep* *boop*
---


## [3.0.1](cloudquery/cloudquery@plugins-source-k8s-v3.0.0...plugins-source-k8s-v3.0.1) (2023-01-17)


### Bug Fixes

* **deps:** Update module github.com/cloudquery/plugin-sdk to v1.24.2 ([#6695](cloudquery/cloudquery#6695)) ([7696e57](cloudquery/cloudquery@7696e57))
* **deps:** Update module github.com/cloudquery/plugin-sdk to v1.25.0 ([#6745](cloudquery/cloudquery#6745)) ([1959692](cloudquery/cloudquery@1959692))
* **deps:** Update module github.com/cloudquery/plugin-sdk to v1.25.1 ([#6805](cloudquery/cloudquery#6805)) ([47ada93](cloudquery/cloudquery@47ada93))
* **deps:** Update module github.com/cloudquery/plugin-sdk to v1.26.0 ([#6839](cloudquery/cloudquery#6839)) ([ea438ca](cloudquery/cloudquery@ea438ca))
* **deps:** Update module github.com/cloudquery/plugin-sdk to v1.27.0 ([#6856](cloudquery/cloudquery#6856)) ([15f8751](cloudquery/cloudquery@15f8751))
* **k8s:** Fix inet-type panic ([#6841](cloudquery/cloudquery#6841)) ([fe85578](cloudquery/cloudquery@fe85578))

---
This PR was generated with [Release Please](https://github.com/googleapis/release-please). See [documentation](https://github.com/googleapis/release-please#release-please).
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

automerge Automatically merge once required checks pass

Projects

None yet

Development

Successfully merging this pull request may close these issues.

6 participants