-
Notifications
You must be signed in to change notification settings - Fork 4
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
Refactor/enforce stricter go linters #93
base: main
Are you sure you want to change the base?
Conversation
commit ae78197 Author: Jonathan Mayer <jonathan.mayer@telekom.de> Date: Mon Jan 13 09:35:27 2025 +0100 perf: reduce memory allocations (#81) * perf: reduce memory allocations * perf: avoid preallocating the slice with zero values * perf: avoid temporary copies in get resource functions commit ad608b6 Author: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com> Date: Mon Jan 13 08:21:37 2025 +0100 chore(deps): bump github.com/zalando-incubator/stackset-controller from 1.4.84 to 1.4.92 (#94) * chore(deps): bump github.com/zalando-incubator/stackset-controller Bumps [github.com/zalando-incubator/stackset-controller](https://github.com/zalando-incubator/stackset-controller) from 1.4.84 to 1.4.92. - [Release notes](https://github.com/zalando-incubator/stackset-controller/releases) - [Commits](zalando-incubator/stackset-controller@v1.4.84...v1.4.92) --- updated-dependencies: - dependency-name: github.com/zalando-incubator/stackset-controller dependency-type: direct:production update-type: version-update:semver-patch ... Signed-off-by: dependabot[bot] <support@github.com> * chore: bump deps dependabot didnt --------- Signed-off-by: dependabot[bot] <support@github.com> Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com> Co-authored-by: jonathan-mayer <jonathan.mayer@telekom.de> commit 48d222f Author: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com> Date: Fri Jan 10 07:47:01 2025 +0100 chore(deps): bump github.com/prometheus-operator/prometheus-operator/pkg/client (#87) Bumps [github.com/prometheus-operator/prometheus-operator/pkg/client](https://github.com/prometheus-operator/prometheus-operator) from 0.76.2 to 0.79.2. - [Release notes](https://github.com/prometheus-operator/prometheus-operator/releases) - [Changelog](https://github.com/prometheus-operator/prometheus-operator/blob/main/CHANGELOG.md) - [Commits](prometheus-operator/prometheus-operator@v0.76.2...v0.79.2) --- updated-dependencies: - dependency-name: github.com/prometheus-operator/prometheus-operator/pkg/client dependency-type: direct:production update-type: version-update:semver-minor ... Signed-off-by: dependabot[bot] <support@github.com> Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com> commit e856e24 Author: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com> Date: Fri Jan 10 07:38:58 2025 +0100 chore(deps): bump github.com/kedacore/keda/v2 from 2.15.1 to 2.16.1 (#90) * chore(deps): bump github.com/kedacore/keda/v2 from 2.15.1 to 2.16.1 Bumps [github.com/kedacore/keda/v2](https://github.com/kedacore/keda) from 2.15.1 to 2.16.1. - [Release notes](https://github.com/kedacore/keda/releases) - [Changelog](https://github.com/kedacore/keda/blob/main/CHANGELOG.md) - [Commits](kedacore/keda@v2.15.1...v2.16.1) --- updated-dependencies: - dependency-name: github.com/kedacore/keda/v2 dependency-type: direct:production update-type: version-update:semver-minor ... Signed-off-by: dependabot[bot] <support@github.com> * chore: automatically push pre-commit changes * Merge remote-tracking branch 'origin/main' * Squashed commit of the following: commit 5cf9b47 Author: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com> Date: Fri Jan 10 07:19:20 2025 +0100 chore(deps): bump k8s.io/api from 0.31.0 to 0.32.0 (#89) * chore(deps): bump k8s.io/api from 0.31.0 to 0.32.0 Bumps [k8s.io/api](https://github.com/kubernetes/api) from 0.31.0 to 0.32.0. - [Commits](kubernetes/api@v0.31.0...v0.32.0) --- updated-dependencies: - dependency-name: k8s.io/api dependency-type: direct:production update-type: version-update:semver-minor ... Signed-off-by: dependabot[bot] <support@github.com> * fix: bump client-go to match with other dependencies --------- Signed-off-by: dependabot[bot] <support@github.com> Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com> Co-authored-by: jonathan-mayer <jonathan.mayer@telekom.de> commit 7c5dc08 Author: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com> Date: Fri Jan 10 07:03:48 2025 +0100 chore(deps): bump golang from 1.23.1 to 1.23.4 (#91) * chore(deps): bump golang from 1.23.1 to 1.23.4 Bumps golang from 1.23.1 to 1.23.4. --- updated-dependencies: - dependency-name: golang dependency-type: direct:production update-type: version-update:semver-patch ... Signed-off-by: dependabot[bot] <support@github.com> * chore: bump golang from 1.23.1 to 1.23.4 --------- Signed-off-by: dependabot[bot] <support@github.com> Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com> Co-authored-by: jonathan-mayer <jonathan.mayer@telekom.de> commit efe5db1 Author: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com> Date: Fri Jan 10 06:51:57 2025 +0100 chore(deps): bump actions/setup-go from 5.0.2 to 5.2.0 (#85) Bumps [actions/setup-go](https://github.com/actions/setup-go) from 5.0.2 to 5.2.0. - [Release notes](https://github.com/actions/setup-go/releases) - [Commits](actions/setup-go@v5.0.2...v5.2.0) --- updated-dependencies: - dependency-name: actions/setup-go dependency-type: direct:production update-type: version-update:semver-minor ... Signed-off-by: dependabot[bot] <support@github.com> Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com> commit 952f8b2 Author: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com> Date: Fri Jan 10 06:51:28 2025 +0100 chore(deps): bump docker/build-push-action from 5 to 6 (#84) Bumps [docker/build-push-action](https://github.com/docker/build-push-action) from 5 to 6. - [Release notes](https://github.com/docker/build-push-action/releases) - [Commits](docker/build-push-action@v5...v6) --- updated-dependencies: - dependency-name: docker/build-push-action dependency-type: direct:production update-type: version-update:semver-major ... Signed-off-by: dependabot[bot] <support@github.com> Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com> * Squashed commit of the following: commit 5cf9b47 Author: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com> Date: Fri Jan 10 07:19:20 2025 +0100 chore(deps): bump k8s.io/api from 0.31.0 to 0.32.0 (#89) * chore(deps): bump k8s.io/api from 0.31.0 to 0.32.0 Bumps [k8s.io/api](https://github.com/kubernetes/api) from 0.31.0 to 0.32.0. - [Commits](kubernetes/api@v0.31.0...v0.32.0) --- updated-dependencies: - dependency-name: k8s.io/api dependency-type: direct:production update-type: version-update:semver-minor ... Signed-off-by: dependabot[bot] <support@github.com> * fix: bump client-go to match with other dependencies --------- Signed-off-by: dependabot[bot] <support@github.com> Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com> Co-authored-by: jonathan-mayer <jonathan.mayer@telekom.de> commit 7c5dc08 Author: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com> Date: Fri Jan 10 07:03:48 2025 +0100 chore(deps): bump golang from 1.23.1 to 1.23.4 (#91) * chore(deps): bump golang from 1.23.1 to 1.23.4 Bumps golang from 1.23.1 to 1.23.4. --- updated-dependencies: - dependency-name: golang dependency-type: direct:production update-type: version-update:semver-patch ... Signed-off-by: dependabot[bot] <support@github.com> * chore: bump golang from 1.23.1 to 1.23.4 --------- Signed-off-by: dependabot[bot] <support@github.com> Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com> Co-authored-by: jonathan-mayer <jonathan.mayer@telekom.de> commit efe5db1 Author: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com> Date: Fri Jan 10 06:51:57 2025 +0100 chore(deps): bump actions/setup-go from 5.0.2 to 5.2.0 (#85) Bumps [actions/setup-go](https://github.com/actions/setup-go) from 5.0.2 to 5.2.0. - [Release notes](https://github.com/actions/setup-go/releases) - [Commits](actions/setup-go@v5.0.2...v5.2.0) --- updated-dependencies: - dependency-name: actions/setup-go dependency-type: direct:production update-type: version-update:semver-minor ... Signed-off-by: dependabot[bot] <support@github.com> Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com> commit 952f8b2 Author: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com> Date: Fri Jan 10 06:51:28 2025 +0100 chore(deps): bump docker/build-push-action from 5 to 6 (#84) Bumps [docker/build-push-action](https://github.com/docker/build-push-action) from 5 to 6. - [Release notes](https://github.com/docker/build-push-action/releases) - [Commits](docker/build-push-action@v5...v6) --- updated-dependencies: - dependency-name: docker/build-push-action dependency-type: direct:production update-type: version-update:semver-major ... Signed-off-by: dependabot[bot] <support@github.com> Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com> --------- Signed-off-by: dependabot[bot] <support@github.com> Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com> Co-authored-by: github-actions[bot] <github-actions[bot]@users.noreply.github.com> Co-authored-by: jonathan-mayer <jonathan.mayer@telekom.de> commit 5cf9b47 Author: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com> Date: Fri Jan 10 07:19:20 2025 +0100 chore(deps): bump k8s.io/api from 0.31.0 to 0.32.0 (#89) * chore(deps): bump k8s.io/api from 0.31.0 to 0.32.0 Bumps [k8s.io/api](https://github.com/kubernetes/api) from 0.31.0 to 0.32.0. - [Commits](kubernetes/api@v0.31.0...v0.32.0) --- updated-dependencies: - dependency-name: k8s.io/api dependency-type: direct:production update-type: version-update:semver-minor ... Signed-off-by: dependabot[bot] <support@github.com> * fix: bump client-go to match with other dependencies --------- Signed-off-by: dependabot[bot] <support@github.com> Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com> Co-authored-by: jonathan-mayer <jonathan.mayer@telekom.de> commit 7c5dc08 Author: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com> Date: Fri Jan 10 07:03:48 2025 +0100 chore(deps): bump golang from 1.23.1 to 1.23.4 (#91) * chore(deps): bump golang from 1.23.1 to 1.23.4 Bumps golang from 1.23.1 to 1.23.4. --- updated-dependencies: - dependency-name: golang dependency-type: direct:production update-type: version-update:semver-patch ... Signed-off-by: dependabot[bot] <support@github.com> * chore: bump golang from 1.23.1 to 1.23.4 --------- Signed-off-by: dependabot[bot] <support@github.com> Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com> Co-authored-by: jonathan-mayer <jonathan.mayer@telekom.de> commit efe5db1 Author: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com> Date: Fri Jan 10 06:51:57 2025 +0100 chore(deps): bump actions/setup-go from 5.0.2 to 5.2.0 (#85) Bumps [actions/setup-go](https://github.com/actions/setup-go) from 5.0.2 to 5.2.0. - [Release notes](https://github.com/actions/setup-go/releases) - [Commits](actions/setup-go@v5.0.2...v5.2.0) --- updated-dependencies: - dependency-name: actions/setup-go dependency-type: direct:production update-type: version-update:semver-minor ... Signed-off-by: dependabot[bot] <support@github.com> Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com> commit 952f8b2 Author: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com> Date: Fri Jan 10 06:51:28 2025 +0100 chore(deps): bump docker/build-push-action from 5 to 6 (#84) Bumps [docker/build-push-action](https://github.com/docker/build-push-action) from 5 to 6. - [Release notes](https://github.com/docker/build-push-action/releases) - [Commits](docker/build-push-action@v5...v6) --- updated-dependencies: - dependency-name: docker/build-push-action dependency-type: direct:production update-type: version-update:semver-major ... Signed-off-by: dependabot[bot] <support@github.com> Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com> commit 0f9015c Author: Jonathan Mayer <jonathan.mayer@telekom.de> Date: Thu Jan 9 14:39:09 2025 +0100 chore: add dependabot config (#83) commit f0b9f9e Author: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com> Date: Thu Jan 9 14:33:04 2025 +0100 chore(deps): bump golang.org/x/net from 0.28.0 to 0.33.0 (#82) Bumps [golang.org/x/net](https://github.com/golang/net) from 0.28.0 to 0.33.0. - [Commits](golang/net@v0.28.0...v0.33.0) --- updated-dependencies: - dependency-name: golang.org/x/net dependency-type: indirect ... Signed-off-by: dependabot[bot] <support@github.com> Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
} | ||
} | ||
|
||
func scanWorkloads( |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Could have a comment
return nil | ||
} | ||
|
||
func scaleWorkload( |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Could have a comment
"rollouts": getRollouts, | ||
"stacks": getStacks, | ||
"prometheuses": getPrometheuses, | ||
func GetWorkloads(resource, namespace string, clientsets *Clientsets, ctx context.Context) ([]Workload, error) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Comment :(
Kubeconfig string | ||
} | ||
|
||
func (c *RuntimeConfiguration) ParseConfigFlags() { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Comment :(
) | ||
} | ||
|
||
func (c *RuntimeConfiguration) ParseConfigEnvVars() error { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Comment :(
internal/pkg/util/config.go
Outdated
} | ||
|
||
func (c *RuntimeConfiguration) ParseConfigEnvVars() error { | ||
// env runtime configuration |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
// env runtime configuration |
internal/pkg/values/timespan.go
Outdated
const rfc3339Regex = `(.+Z|.+[+-]\d{2}:\d{2})` | ||
|
||
// absoluteTimeSpanRegex matches a absolute timespan. It's groups are the two rfc3339 timestamps | ||
// absoluteTimeSpanRegex matches a absolute timespan. It's groups are the two rfc3339 timestamps. | ||
var absoluteTimeSpanRegex = regexp.MustCompile(fmt.Sprintf(`^%s *- *%s$`, rfc3339Regex, rfc3339Regex)) | ||
|
||
type TimeSpan interface { | ||
// inTimeSpan checks if time is in the timespan or not |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
// inTimeSpan checks if time is in the timespan or not | |
// isTimeInSpan checks if time is in the timespan or not |
Motivation
This PR aims to enable more linters and refactor the project to clean it up and keep it clean.
Blocked by #81
Changes
Tests done
TODO
I definitely think its worth refactoring some of this again in the future. Also i left some functions unfactored since they were fine in my eyes, but they could also get refactored at some point.
Additionally, we should change the code so we dont return a nil error to "skip" things along with #7