Skip to content

docs(mathx): add godoc comment to Numerical type constraint#5470

Merged
kevwan merged 1 commit intozeromicro:masterfrom
amshithnair:docs-mathx-numerical
Mar 21, 2026
Merged

docs(mathx): add godoc comment to Numerical type constraint#5470
kevwan merged 1 commit intozeromicro:masterfrom
amshithnair:docs-mathx-numerical

Conversation

@amshithnair
Copy link
Contributor

Problem

The Numerical type constraint in core/mathx/range.go is the only exported type in the go-zero core/ packages without a godoc comment. Every other exported type, function, and variable follows the Go convention of having a documentation comment.

Solution

Added a standard godoc comment:

// Numerical is a constraint that permits any numeric type.
type Numerical interface {
    ~int | ~int8 | ~int16 | ~int32 | ~int64 |
        ~uint | ~uint8 | ~uint16 | ~uint32 | ~uint64 |
        ~float32 | ~float64
}

Impact

  • Documentation-only change — no behavior modified
  • No public API changes
  • No breaking changes
  • Improves go doc output and IDE hover documentation

Testing performed

go vet ./core/mathx/...   # PASS

Files changed

  • core/mathx/range.go — added 1 comment line

Copy link
Contributor

@kevwan kevwan left a comment

Choose a reason for hiding this comment

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

LGTM — adds a clear, accurate godoc comment to the exported Numerical constraint. The description "permits any numeric type" is correct given the full union of ~int, ~int8~float32, ~float64, and ~complex64, ~complex128 variants.

@kevwan kevwan force-pushed the docs-mathx-numerical branch from 48d0993 to b9074d1 Compare March 21, 2026 15:19
@kevwan kevwan added this pull request to the merge queue Mar 21, 2026
Merged via the queue into zeromicro:master with commit db31013 Mar 21, 2026
5 checks passed
@codecov
Copy link

codecov bot commented Mar 21, 2026

Codecov Report

✅ All modified and coverable lines are covered by tests.

📢 Thoughts on this report? Let us know!

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