Skip to content
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

style: remove unused utils #3830

Merged
merged 1 commit into from
Sep 4, 2023
Merged

Conversation

fengxsong
Copy link
Collaborator

@fengxsong fengxsong commented Sep 4, 2023

🤖 Generated by Copilot at a9b6c29

Summary

🛠️🧹📦

This pull request refactors and simplifies various functions and packages in the sealos project by using more descriptive, consistent, and concise names and methods from the golang.org/x/exp, maps, and yaml packages. It also fixes a bug in the delete package and improves the logic of checking image types in the checker and gen packages.

Sing, O Muse, of the valiant code reviewers who strove
To improve the clarity and quality of the sealos project,
Which harnesses the power of Kubernetes to deploy clusters
With ease and speed, like the swift-footed Achilles in battle.

Walkthrough

  • Simplify and avoid redundancy in function names from the yaml and maps packages (link, link, link, link, link, link, link, link, link, link, link, link, link)
  • Use the slices package from golang.org/x/exp to check if slices contain elements, instead of custom functions from the stringsutil package (link, link, link, link, link, link, link, link, link, link, link, link, link)
  • Use the IsRootFs and IsPatch methods of the Image struct to check the image type, instead of directly comparing the type field with constants (link, link)
  • Fix a bug in the logic of checking if the registry IP and port is already in the hosts list, by using the strings.NotInIPList function instead of the strings.InIPList function (link)
  • Fix a bug in the logic of checking if the master0 machine is in the list of masters to be deleted, by using the slices.Contains function instead of the stringsutil.InList function (link)
  • Use the DeepCopy method of the SSH struct to create a deep copy of the SSH configuration, instead of a custom function from the cluster package that only returns a shallow copy (link)
  • Use more descriptive and consistent function names from the stringsutil package, such as FilterNonEmptyFromString and RemoveSubSlice, instead of custom functions with vague names and behavior, such as SplitRemoveEmpty and RemoveStrSlice (link, link, link, link, link)
  • Remove unused imports from the processor, apply, and env packages (link, link, link)
  • Add a break statement after assigning the pauseImage variable in the Check function of the checker package, to avoid unnecessary iterations over the cluster status mounts (link)

@sealos-ci-robot
Copy link
Member

🤖 Generated by lychee action

Summary

Status Count
🔍 Total 932
✅ Successful 392
⏳ Timeouts 0
🔀 Redirected 0
👻 Excluded 539
❓ Unknown 0
🚫 Errors 0

Full action output

Full Github Actions output

@codecov
Copy link

codecov bot commented Sep 4, 2023

Codecov Report

Patch coverage is 84.00% of modified lines.

Files Changed Coverage
pkg/apply/gen.go 0.00%
pkg/apply/run.go 60.00%
pkg/apply/scale.go 88.88%
pkg/apply/reset.go 100.00%
pkg/apply/utils.go 100.00%
pkg/env/env.go 100.00%

📢 Thoughts on this report? Let us know!.

@cuisongliu cuisongliu added this to the v4.4 milestone Sep 4, 2023
@cuisongliu cuisongliu merged commit 1557b7d into labring:main Sep 4, 2023
@fengxsong fengxsong deleted the fix_remove_utils branch September 4, 2023 08:32
@sealos-ci-robot
Copy link
Member

/cherry-pick release-v4.4

@sealos-ci-robot
Copy link
Member

🤖 says: Error cherry-picking.

Auto-merging go.mod
CONFLICT (content): Merge conflict in go.mod
error: could not apply 1557b7d... style: remove unused utils (#3830)
hint: After resolving the conflicts, mark them with
hint: "git add/rm ", then run
hint: "git cherry-pick --continue".
hint: You can instead skip this commit with "git cherry-pick --skip".
hint: To abort and get back to the state before "git cherry-pick",
hint: run "git cherry-pick --abort".

@sealos-ci-robot
Copy link
Member

🤖 says: ‼️ cherry pick action failed.
See: https://github.com/labring/sealos/actions/runs/6071052003

cuisongliu pushed a commit to cuisongliu/sealos that referenced this pull request Sep 4, 2023
(cherry picked from commit 1557b7d)
Signed-off-by: cuisongliu <cuisongliu@qq.com>
cuisongliu added a commit that referenced this pull request Sep 4, 2023
(cherry picked from commit 1557b7d)
Signed-off-by: cuisongliu <cuisongliu@qq.com>

Co-authored-by: fengxsong <fengxsong@outlook.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants