Skip to content

fix: fix slice init length#5943

Open
xihuwenhua wants to merge 2 commits into
devtron-labs:mainfrom
xihuwenhua:main
Open

fix: fix slice init length#5943
xihuwenhua wants to merge 2 commits into
devtron-labs:mainfrom
xihuwenhua:main

Conversation

@xihuwenhua

@xihuwenhua xihuwenhua commented Oct 2, 2024

Copy link
Copy Markdown
  • fix - The PR contains a bug fix.

Description

The intention here should be to initialize a slice with a capacity of len(cdPipelines) rather than initializing the length of this slice.

The online demo: https://go.dev/play/p/vNUPNjdb2gJ

Fixes #

Checklist:

  • The title of the PR states what changed and the related issues number (used for the release note).
  • Does this PR requires documentation updates?
  • I've updated documentation as required by this PR.
  • I have performed a self-review of my own code.
  • I have commented my code, particularly in hard-to-understand areas.
  • I have tested it for all user roles.
  • I have added all the required unit/api test cases.

Does this PR introduce a user-facing change?


Summary by Bito

  • Fixes a bug in the slice initialization within the BuildPipelineRestHandler.go file, ensuring the slice is initialized with the correct capacity based on the length of cdPipelines, which prevents potential runtime errors related to slice operations.
  • Improves memory efficiency by correctly initializing the slice.
  • Overall summary: addresses a bug in slice initialization in BuildPipelineRestHandler.go, which fixes potential runtime errors.

@sonarqubecloud

sonarqubecloud Bot commented Oct 2, 2024

Copy link
Copy Markdown

@xihuwenhua

Copy link
Copy Markdown
Author

friendly ping~

@xihuwenhua

Copy link
Copy Markdown
Author

Hi, Anything need I to do?

@xihuwenhua

Copy link
Copy Markdown
Author

@vikramdevtron @abhibhaw Hi, Could you please review this PR at your convenience? Thank you very much.

abhibhaw
abhibhaw previously approved these changes Dec 6, 2025

@abhibhaw abhibhaw left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

LGTM

@abhibhaw abhibhaw changed the base branch from main to develop December 6, 2025 10:12
@abhibhaw abhibhaw dismissed their stale review December 6, 2025 10:12

The base branch was changed.

@gitguardian

gitguardian Bot commented Dec 6, 2025

Copy link
Copy Markdown

️✅ There are no secrets present in this pull request anymore.

If these secrets were true positive and are still valid, we highly recommend you to revoke them.
While these secrets were previously flagged, we no longer have a reference to the
specific commits where they were detected. Once a secret has been leaked into a git
repository, you should consider it compromised, even if it was deleted immediately.
Find here more information about risks.


🦉 GitGuardian detects secrets in your source code to help developers and security teams secure the modern development process. You are seeing this because you or someone else with access to this repository has authorized GitGuardian to scan your pull request.

@abhibhaw abhibhaw changed the base branch from develop to main December 6, 2025 10:13
@sonarqubecloud

sonarqubecloud Bot commented Dec 6, 2025

Copy link
Copy Markdown

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants