dromara / carbon

A simple, semantic and developer-friendly golang package for time
https://pkg.go.dev/github.com/golang-module/carbon/v2
MIT License
4.77k stars 238 forks source link

build for windows_386 (untyped int constant) overflows int #219

Closed iTanken closed 9 months ago

iTanken commented 9 months ago

Hello,

I encountered an issue with the following code:

github.com\golang-module\carbon\v2\calendar\lunar\lunar.go:161:31

golang version: 1.20.13

carbon version: 2.3.6

I expected to get:

exit status 0

But I actually get:

failed to build for windows_386: exit status 1: # github.com/golang-module/carbon/v2/calendar/lunar
vendor\github.com\golang-module\carbon\v2\calendar\lunar\lunar.go:161:31: -2206512000 (untyped int constant) overflows int

exit status 1

Thanks!

gouguoyin commented 9 months ago

failed when install?

iTanken commented 9 months ago

failed when install?

when building 32-bit programs

gouguoyin commented 9 months ago

安装时没问题,交叉编译时出错吗?

Issues-translate-bot commented 9 months ago

The issue body's language is not English, translate it automatically, please use English next time. 👯👭🏻🧑‍🤝‍🧑👫🧑🏿‍🤝‍🧑🏻👩🏾‍🤝‍👨🏿👬🏿


There is no problem during installation, but is there an error when cross-compiling?

iTanken commented 9 months ago

安装时没问题,交叉编译时出错吗?

嗯,64 位编译运行没有问题,设置 GOARCH=386 编译 32 位程序的时候 lunar.go 第 161 行 int 溢出。

v2.3.5 在 32位环境下是编译运行正常的。

Issues-translate-bot commented 9 months ago

The issue body's language is not English, translate it automatically, please use English next time. 👯👭🏻🧑‍🤝‍🧑👫🧑🏿‍🤝‍🧑🏻👩🏾‍🤝‍👨🏿👬🏿


There is no problem during installation. Is there an error during cross compilation?

Well, there is no problem in 64-bit compilation and operation. When setting GOARCH=386 to compile a 32-bit program, int overflows in line 161 of lunar.go.

v2.3.5 compiles and runs normally in a 32-bit environment.