Skip to content

fix(json): update build constraints for Go version comp#6064

Merged
ehsandeep merged 1 commit intodevfrom
dwisiswant0/fix/json/update-build-constraints-for-Go-version-compatibility
Feb 21, 2025
Merged

fix(json): update build constraints for Go version comp#6064
ehsandeep merged 1 commit intodevfrom
dwisiswant0/fix/json/update-build-constraints-for-Go-version-compatibility

Conversation

@dwisiswant0
Copy link
Member

@dwisiswant0 dwisiswant0 commented Feb 21, 2025

Proposed changes

Fix #6063

Checklist

  • Pull request is created against the dev branch
  • All checks passed (lint, unit/integration/regression tests etc.) with my changes
  • I have added tests that prove my fix is effective or that my feature works
  • I have added necessary documentation (if appropriate)

Summary by CodeRabbit

  • Documentation

    • Clarified the supported version range for the enhanced performance implementation in the documentation.
  • Chores

    • Updated compatibility settings so that the enhanced performance features are only activated under specific environment conditions.
    • Refined fallback behavior to ensure reliable operation on platforms and versions not meeting the primary criteria.

Signed-off-by: Dwi Siswanto <git@dw1.io>
@coderabbitai
Copy link
Contributor

coderabbitai bot commented Feb 21, 2025

Walkthrough

This pull request updates documentation and build constraints within the JSON utilities package. The documentation now limits the high-performance sonic library to Go versions >= 1.20 and <= 1.23. Meanwhile, the build constraints in two JSON files have been adjusted to exclude or include Go version 1.24 based on the file, while still targeting specific operating systems and architectures.

Changes

File(s) Change Summary
pkg/.../doc.go Updated documentation to specify the sonic library is used only for Go versions >= 1.20 and <= 1.23.
pkg/.../json.go and pkg/.../json_fallback.go Modified build constraints: in json.go, Go 1.24 is excluded; in json_fallback.go, constraints are updated to include Go 1.24 or non-targeted OS/arch.

Suggested reviewers

  • dogancanbakir
  • ehsandeep

Poem

I'm a rabbit hopping with delight,
Celebrating changes both clear and bright.
New build tags and docs align,
Keeping Go versions in a tidy line.
With a twitch of nose and a joyful leap,
CodeRabbit Inc. makes these fixes deep!
🐇✨


📜 Recent review details

Configuration used: CodeRabbit UI
Review profile: CHILL
Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between cbd90df and 2253ea8.

📒 Files selected for processing (3)
  • pkg/utils/json/doc.go (1 hunks)
  • pkg/utils/json/json.go (1 hunks)
  • pkg/utils/json/json_fallback.go (1 hunks)
✅ Files skipped from review due to trivial changes (2)
  • pkg/utils/json/doc.go
  • pkg/utils/json/json.go
🔇 Additional comments (2)
pkg/utils/json/json_fallback.go (2)

4-22: Implementation maintains compatibility with standard JSON interface.

The fallback implementation correctly:

  • Uses go-json as the underlying implementation
  • Exports standard JSON interface functions (Marshal, Unmarshal, etc.)
  • Maintains type compatibility through type aliases

1-2:

Details

✅ Verification successful

Verify the build constraint logic.

The updated build constraints now correctly handle Go 1.24 compatibility by making this fallback implementation active for:

  1. Go 1.24 (new condition)
  2. Non-supported OS (unchanged)
  3. Non-supported architectures (unchanged)

Let's verify the build constraints across all JSON-related files to ensure consistent version handling:


🏁 Script executed:

#!/bin/bash
# Description: Check build constraints in JSON-related files
# Expected: Should see consistent Go 1.24 handling across files

echo "Checking build constraints in JSON package files..."
rg -A 1 "^//go:build" pkg/utils/json/

Length of output: 481


Build constraint logic verified and confirmed across JSON files.

  • The primary JSON implementation in pkg/utils/json/json.go is compiled for non-Go 1.24 environments on supported OS/architectures.
  • The fallback implementation in pkg/utils/json/json_fallback.go is now correctly activated when using Go 1.24 or when running on unsupported OS/architectures.
  • The complementary build constraints across the two files ensure the intended version and platform handling.
✨ Finishing Touches
  • 📝 Generate Docstrings (Beta)

🪧 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. (Beta)
  • @coderabbitai resolve resolve all the CodeRabbit review comments.
  • @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.

Copy link
Member

@Mzack9999 Mzack9999 left a comment

Choose a reason for hiding this comment

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

lgtm! we will need to update later when the library gets support for go 1.24

@ehsandeep ehsandeep merged commit 047d49f into dev Feb 21, 2025
19 checks passed
@ehsandeep ehsandeep deleted the dwisiswant0/fix/json/update-build-constraints-for-Go-version-compatibility branch February 21, 2025 06:34
@ehsandeep ehsandeep removed the request for review from dogancanbakir February 21, 2025 06:34
@dwisiswant0
Copy link
Member Author

lgtm! we will need to update later when the library gets support for go 1.24

bytedance/sonic#741

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.

bytedance/sonic prints unwated warning messages

3 participants