Code Monkey home page Code Monkey logo

Comments (4)

qwqcode avatar qwqcode commented on September 24, 2024

这确实是一个问题,感谢反馈。

这个问题仅发生在 Windows 操作系统,目前临时的解决办法是:

  1. 下载一份时间数据库 zoneinfo.zip 到你的 Windows Server 服务器,例如:D:/zoneinfo.zip

    https://github.com/golang/go/blob/master/lib/time/zoneinfo.zip

  2. 配置环境变量 ZONEINFO 如图:

image

  1. 重新打开命令行运行即可

或者可以直接命令行执行 set ZONEINFO=D:/zoneinfo.zip 临时修改环境变量。

from artalkgo.

qwqcode avatar qwqcode commented on September 24, 2024

这是 Go 程序一个普遍存在的问题(如果用了 time.LoadLocation 函数),LoadLocation 这个函数依赖于 IANA Time Zone Database (简称 tzdata) 数据库,一般 Linux 系统都是自带的,而 Windows 系统没有。

所以如果没有这个数据库文件的话,就会去查 $GOROOT/lib/time/zoneinfo.zip,但需要装了 Golang 编译器才有。

可以手动配置 ZONEINFO 这个环境变量来指定时间数据库文件。

为了简单起见,之后我打算把这个文件内置到程序 exe 文件中,无需再额外配置。

from artalkgo.

qwqcode avatar qwqcode commented on September 24, 2024

看了一些相关内容,最后打算仅在编译 Windows 版的时候,给 Golang 编译器带上 -tags timetzdata 参数,内置到 exe 文件中,但 exe 文件会增大 800K

from artalkgo.

qwqcode avatar qwqcode commented on September 24, 2024

新版构建已发布 v2.1.9

from artalkgo.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.