Skip to content

Conversation

@xuthus5
Copy link
Contributor

@xuthus5 xuthus5 commented Apr 6, 2025

Key changes:

  • Updated version declarations across all build configurations
  • Remove deprecated API ioutil
  • Prepare for adopting modern features (e.g., generics)

BREAKING CHANGE: Development environments must upgrade to Go 1.18+

Summary by CodeRabbit

  • Refactor

    • Modernized file processing and HTTP request handling to align with current standards, ensuring smoother operations.
  • Chores

    • Raised the platform version requirement to Go 1.18 and updated dependency configurations to enhance compatibility and stability.
    • Updated workflow configuration to utilize the latest setup-go action and dynamically determine the Go version from the go.mod file.

@coderabbitai
Copy link

coderabbitai bot commented Apr 6, 2025

Important

Review skipped

Auto reviews are disabled on base/target branches other than the default branch.

Please check the settings in the CodeRabbit UI or the .coderabbit.yaml file in this repository. To trigger a single review, invoke the @coderabbitai review command.

You can disable this status message by setting the reviews.review_status to false in the CodeRabbit configuration file.

Walkthrough

The update replaces deprecated file and response reading functions with their modern counterparts. The ConfigFile.Load method now uses os.ReadFile instead of ioutil.ReadFile, while the HTTP request function in protocol/http/request.go switches from ioutil.ReadAll to io.ReadAll and updates its URL parsing. Additionally, the go.mod file bumps the Go version from 1.13 to 1.18 and introduces several new indirect dependencies.

Changes

File(s) Change Summary
env/.../json_config.go, protocol/.../request.go Replaced deprecated ioutil functions with os.ReadFile/io.ReadAll; updated import statements and variable names (e.g., url2 to url and url to u) to follow newer Go conventions.
go.mod Upgraded Go version from 1.13 to 1.18 and added multiple new indirect dependencies (e.g., fsnotify, hashicorp/hcl, magiconair/properties, mitchellh/mapstructure, go-toml, several spf13 packages, among others).
.github/workflows/go.yml Updated setup-go action from v2 to v5 and changed Go version specification to use the version from go.mod instead of a hardcoded value.

Possibly related PRs

  • feat:update version to go1.20 #322: The changes in the main PR and the retrieved PR are related through the modifications made to the go.mod file, specifically the updates to the Go version and the addition of indirect dependencies.

Suggested reviewers

  • hezhangjian
  • zouyx

Poem

I'm a rabbit in the coding glade,
Hopping over deprecated paths we've swayed.
New functions leap with modern flair,
Imports pruned with utmost care.
Tiny hops, big changes shine—
In Go's garden, all is fine!
🐰💻


🪧 Tips

Chat

There are 3 ways to chat with CodeRabbit:

  • Review comments: Directly reply to a review comment made by CodeRabbit. Example:
    • I pushed a fix in commit <commit_id>, please review it.
    • Generate unit testing code for this file.
    • Open a follow-up GitHub issue for this discussion.
  • Files and specific lines of code (under the "Files changed" tab): Tag @coderabbitai in a new review comment at the desired location with your query. Examples:
    • @coderabbitai generate unit testing code for this file.
    • @coderabbitai modularize this function.
  • PR comments: Tag @coderabbitai in a new PR comment to ask questions about the PR branch. For the best results, please provide a very specific query, as very limited context is provided in this mode. Examples:
    • @coderabbitai gather interesting stats about this repository and render them as a table. Additionally, render a pie chart showing the language distribution in the codebase.
    • @coderabbitai read src/utils.ts and generate unit testing code.
    • @coderabbitai read the files in the src/scheduler package and generate a class diagram using mermaid and a README in the markdown format.
    • @coderabbitai help me debug CodeRabbit configuration file.

Note: Be mindful of the bot's finite context window. It's strongly recommended to break down tasks such as reading entire modules into smaller chunks. For a focused discussion, use review comments to chat about specific files and their changes, instead of using the PR comments.

CodeRabbit Commands (Invoked using PR comments)

  • @coderabbitai pause to pause the reviews on a PR.
  • @coderabbitai resume to resume the paused reviews.
  • @coderabbitai review to trigger an incremental review. This is useful when automatic reviews are disabled for the repository.
  • @coderabbitai full review to do a full review from scratch and review all the files again.
  • @coderabbitai summary to regenerate the summary of the PR.
  • @coderabbitai generate docstrings to generate docstrings for this PR.
  • @coderabbitai resolve resolve all the CodeRabbit review comments.
  • @coderabbitai plan to trigger planning for file edits and PR creation.
  • @coderabbitai configuration to show the current CodeRabbit configuration for the repository.
  • @coderabbitai help to get help.

Other keywords and placeholders

  • Add @coderabbitai ignore anywhere in the PR description to prevent this PR from being reviewed.
  • Add @coderabbitai summary to generate the high-level summary at a specific location in the PR description.
  • Add @coderabbitai anywhere in the PR title to generate the title automatically.

CodeRabbit Configuration File (.coderabbit.yaml)

  • You can programmatically configure CodeRabbit by adding a .coderabbit.yaml file to the root of your repository.
  • Please see the configuration documentation for more information.
  • If your editor has YAML language server enabled, you can add the path at the top of this file to enable auto-completion and validation: # yaml-language-server: $schema=https://coderabbit.ai/integrations/schema.v2.json

Documentation and Community

  • Visit our Documentation for detailed information on how to use CodeRabbit.
  • Join our Discord Community to get help, request features, and share feedback.
  • Follow us on X/Twitter for updates and announcements.

@mergify
Copy link
Contributor

mergify bot commented Apr 6, 2025

感谢您提出Pull Request,我会尽快Review。我会在1-2日内进行查看或者回复,如果遇到节假日可能会处理较慢,敬请谅解。

@xuthus5 xuthus5 force-pushed the chore/gotool branch 4 times, most recently from 2951c8e to a5fbe99 Compare April 7, 2025 15:10
@xuthus5
Copy link
Contributor Author

xuthus5 commented Apr 7, 2025

@nobodyiam PTAL.

@coveralls
Copy link

Pull Request Test Coverage Report for Build 14312814009

Details

  • 4 of 4 (100.0%) changed or added relevant lines in 2 files are covered.
  • No unchanged relevant lines lost coverage.
  • Overall coverage remained the same at 75.613%

Totals Coverage Status
Change from base Build 14280364520: 0.0%
Covered Lines: 1327
Relevant Lines: 1755

💛 - Coveralls

@nobodyiam
Copy link
Member

@xuthus5 Could you share your reasons for upgrading the Go toolchain to 1.18?

@xuthus5
Copy link
Contributor Author

xuthus5 commented Apr 10, 2025

@xuthus5 Could you share your reasons for upgrading the Go toolchain to 1.18?

  • Go 1.18 introduces generic support, so future development can benefit from upgrading to this release
  • In the future, the Kubernetes configmap backup feature will be migrated to this repository. It is recommended that the Kubernetes client-go version be a later version.

@zouyx
Copy link
Member

zouyx commented Apr 10, 2025

这次升级看上去是和之前版本不兼容的是吗?
意思是:如果用户目前使用的是1.14 是无法直接升级的是吗?

@zouyx zouyx changed the base branch from master to develop April 10, 2025 14:13
@mergify
Copy link
Contributor

mergify bot commented Apr 10, 2025

这个 PR 发生了冲突. @xuthus5 是否能帮忙修复呢? 🙏

@xuthus5
Copy link
Contributor Author

xuthus5 commented Apr 10, 2025

这次升级看上去是和之前版本不兼容的是吗?
意思是:如果用户目前使用的是1.14 是无法直接升级的是吗?

是的,如果变更该代码仓go版本号为1.15,则用户1.14版本的项目无法使用最新发布的版本,也就是会使依赖该项目但是项目版本号低于当前代码仓go.mod中定义的版本号的项目,无法使用新的发布版本。

基于你的目标分支修改,我了解前面已经有人在develop分支将go版本号升级到1.20。
我在该分支做修正。

该次修改移除被弃用API与过时的action任务。

Signed-off-by: Young Xu <xuthus5@gmail.com>
@xuthus5 xuthus5 changed the title chore: upgrade go toolchain to 1.18 chore: remove deprecated API and unused action Apr 10, 2025
@mergify mergify bot merged commit 105a1d3 into apolloconfig:develop Apr 11, 2025
6 checks passed
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.

4 participants