Giter Club home page Giter Club logo

Comments (3)

lynzhai avatar lynzhai commented on August 21, 2024
    connString := "root:12344321@/giligili?charset=utf8&parseTime=True&loc=Local"
//connString := "root:12344321@/giligili?charset=utf8&parseTime=True&loc=Local"
dbConnectString := os.Getenv("MYSQL_DSN")
fmt.Println("dbConnectString:", dbConnectString)
model.Database(connString)

如果直接用connString 在model.Database(connString) ,就不会报错
如果从环境中获取,就会报错,我打印了环境变量中的os.Getenv("MYSQL_DSN") 和connString,是一摸一样的,但是用环境变量的就是不行

from giligili.

bydmm avatar bydmm commented on August 21, 2024

你的说法很奇怪,似乎在说os.Getenv得到的string和直接的string,两个string不是===似的

from giligili.

9547 avatar 9547 commented on August 21, 2024

go run main.go 运行时出现 panic: unknown time zone Local",是我哪里配置有问题吗

错误信息是指 unknown time zone Local"(末尾多了个 ")

这个问题可能是由于环境变量设置的时候有问题,比如以下面这种方式设置:

MYSQL_DSN="root:12344321@/giligili?charset=utf8&parseTime=True&loc=Local\"" 

末尾多了一个 ".

from giligili.

Related Issues (15)

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.