wails icon indicating copy to clipboard operation
wails copied to clipboard

int64 number truncation problem

Open dwSun opened this issue 1 year ago • 2 comments

Description

I'm passing data between golang and the front end, there are two fields, one data field uses int64 but the number is larger, the other is timestamp. the last few digits of the data field are truncated to 0, which is causing some issues with running.

To Reproduce

Just set a function in golang that returns an int64.

Expected behaviour

Both data fields should be returned properly, or a hint should be provided about the truncation of the int64 data field.

Screenshots

FLAMESHOT-2024-10-03_23-31-42

Attempted Fixes

我现在用string代替了int64,但是用起来不是很方便

System Details

10.8.2

                                
          Wails Doctor          
                                

                                                                                                                                                                            
# Wails
Version         | v2.9.1
Package Manager | pacman

# System
┌──────────────────────────────────────────────────────────────────────────────────────┐
| OS           | Arch Linux                                                            |
| Version      | Unknown                                                               |
| ID           | arch                                                                  |
| Go Version   | go1.23.0                                                              |
| Platform     | linux                                                                 |
| Architecture | amd64                                                                 |
| CPU          | Intel(R) Core(TM) Ultra 7 155H                                        |
| GPU          | Meteor Lake-P [Intel Arc Graphics] (Intel Corporation) - Driver: i915 |
| Memory       | 31GB                                                                  |
└──────────────────────────────────────────────────────────────────────────────────────┘

# Dependencies
┌─────────────────────────────────────────────────────────────────────┐
| Dependency | Package Name | Status    | Version                     |
| *docker    | docker       | Installed |                             |
| gcc        | gcc          | Installed | 14.2.1+r134+gab884fffe3fc-1 |
| libgtk-3   | gtk3         | Installed | 1:3.24.43-3                 |
| libwebkit  | webkit2gtk   | Installed | 2.46.1-1                    |
| npm        | npm          | Installed | 10.8.2                      |
| pkg-config | pkgconf      | Installed | 2.1.1-1                     |
└────────────────────── * - Optional Dependency ──────────────────────┘

# Diagnosis
 SUCCESS  Your system is ready for Wails development!

Additional context

No response

dwSun avatar Oct 03 '24 15:10 dwSun

This is related to JS number range, not a bug in Wails. Try using any JS console, set value 5_130_080_350_652_859_609 to a variable and print it.

ankitpatial avatar Oct 04 '24 12:10 ankitpatial

Is it possible to provide a warning about possible data truncation issues when using int64.

dwSun avatar Oct 04 '24 13:10 dwSun

Personally, I think this should be a problem that developers should pay attention, not the framework needs to remind

northes avatar Oct 22 '24 09:10 northes