[PR #4616] [MERGED] Fix integer constant overflows in tests #17433

Closed
opened 2025-11-02 13:21:13 -06:00 by GiteaMirror · 0 comments
Owner

📋 Pull Request Information

Original PR: https://github.com/go-gitea/gitea/pull/4616
Author: @menschel-d
Created: 8/4/2018
Status: Merged
Merged: 8/6/2018
Merged by: @lafriks

Base: masterHead: fix_constant_overflow


📝 Commits (2)

  • 940fa30 Fix integer constant overflows in tests
  • 61faad5 Merge branch 'master' into fix_constant_overflow

📊 Changes

1 file changed (+2 additions, -1 deletions)

View changed files

📝 models/unit_tests.go (+2 -1)

📄 Description

Explicitly use int64 in order to avoid the following errors on 32 bit
architectures:

# code.gitea.io/gitea/integrations
./api_admin_test.go:50:34: constant 9223372036854775807 overflows int
./api_token_test.go:47:34: constant 9223372036854775807 overflows int
[...]
# code.gitea.io/gitea/models
./action_test.go:179:15: constant 9223372036854775807 overflows int

Futhermore, the magic constant 9223372036854775807 has been substituted with a numerically equivalent integer limit value.


I'm currently working on a BitBake recipe for Gitea in the context of Yocto/OpenEmbedded, and have stumbled upon the mentioned problems when compiling for the qemuarm target.
As I have little experience in Go programming, I've adapted the solution from [1].
If there are any problems in the code changes, just let me know.

[1] https://stackoverflow.com/a/16475045


🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.

## 📋 Pull Request Information **Original PR:** https://github.com/go-gitea/gitea/pull/4616 **Author:** [@menschel-d](https://github.com/menschel-d) **Created:** 8/4/2018 **Status:** ✅ Merged **Merged:** 8/6/2018 **Merged by:** [@lafriks](https://github.com/lafriks) **Base:** `master` ← **Head:** `fix_constant_overflow` --- ### 📝 Commits (2) - [`940fa30`](https://github.com/go-gitea/gitea/commit/940fa30da74125c6824025a69395759615b8de3a) Fix integer constant overflows in tests - [`61faad5`](https://github.com/go-gitea/gitea/commit/61faad5144736f9d9b4b1fa75096e645c9c75a97) Merge branch 'master' into fix_constant_overflow ### 📊 Changes **1 file changed** (+2 additions, -1 deletions) <details> <summary>View changed files</summary> 📝 `models/unit_tests.go` (+2 -1) </details> ### 📄 Description Explicitly use int64 in order to avoid the following errors on 32 bit architectures: ``` # code.gitea.io/gitea/integrations ./api_admin_test.go:50:34: constant 9223372036854775807 overflows int ./api_token_test.go:47:34: constant 9223372036854775807 overflows int [...] # code.gitea.io/gitea/models ./action_test.go:179:15: constant 9223372036854775807 overflows int ``` Futhermore, the magic constant 9223372036854775807 has been substituted with a numerically equivalent integer limit value. --- I'm currently working on a BitBake recipe for Gitea in the context of Yocto/OpenEmbedded, and have stumbled upon the mentioned problems when compiling for the `qemuarm` target. As I have little experience in Go programming, I've adapted the solution from [1]. If there are any problems in the code changes, just let me know. [1] https://stackoverflow.com/a/16475045 --- <sub>🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.</sub>
GiteaMirror added the pull-request label 2025-11-02 13:21:13 -06:00
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: github-starred/gitea#17433