dsa2c2255888 2019-01-12 04:41
浏览 59

转到lib / pq打开方法,返回未定义:time.Until

I'm running into a weird issue with the lib/pq GO Package.

When attempting to open a connection, I'm receiving the following error:

vendor/github.com/lib/pq/notify.go:790: undefined: time.Until

I checked my $GOROOT and it's set correctly. Until is defined inside of the Time package. All the other methods seem to be working correctly, it's just Until that is breaking the build.

My $GOPATH is set correctly as well.

I was see the minimum version lib/pq supports is 1.8, I'm using 1.11 For the life of me, I can't figure out what is causing it. After doing some research, it seems most people were able to fix this by upgrading, but I'm on the most recent version (and I'd rather not downgrade to fix).

Relevant GO environment information below:

set GOARCH=amd64
set GOBIN=
set GOCACHE=C:\Users\Jeff\AppData\Local\go-build
set GOEXE=.exe
set GOFLAGS=
set GOHOSTARCH=amd64
set GOHOSTOS=windows
set GOOS=windows
set GOPATH=C:\Users\Jeff\go
set GOPROXY=
set GORACE=
set GOROOT=C:\Go
set GOTMPDIR=
set GOTOOLDIR=C:\Go\pkg\tool\windows_amd64

My Project path is:

/c/Users/Jeff/go/src/github.com/project/m1

main.go is running the following (which is causing the error)

func initDB(){
    var err error
    db, err = sql.Open("postgres", "dbname=mydb sslmode=disable")
    if err != nil {
        panic(err)
    }
}

Any help would be appreciated.

  • 写回答

1条回答 默认 最新

  • doufeixuan8882 2019-01-12 05:01
    关注

    Go 1.8 Release Notes

    time

    The new function Until complements the analogous Since function.


    You are picking up a package time prior to Go 1.8.

    What is your output from the go version command?

    Clean all caches. For example, go clean -cache. Search for occurrences of pkg file time.a.

    Reinstall the time package, forcing a rebuild: go install -v -a time.

    Reinstall the lib/pq package, forcing a rebuild: cd to vendor/github.com/lib/pq then go install -v -a.

    Where are all the time.go and time.a files on your system?

    评论

报告相同问题?

悬赏问题

  • ¥15 不是,这到底错哪儿了😭
  • ¥15 2020长安杯与连接网探
  • ¥15 关于#matlab#的问题:在模糊控制器中选出线路信息,在simulink中根据线路信息生成速度时间目标曲线(初速度为20m/s,15秒后减为0的速度时间图像)我想问线路信息是什么
  • ¥15 banner广告展示设置多少时间不怎么会消耗用户价值
  • ¥16 mybatis的代理对象无法通过@Autowired装填
  • ¥15 可见光定位matlab仿真
  • ¥15 arduino 四自由度机械臂
  • ¥15 wordpress 产品图片 GIF 没法显示
  • ¥15 求三国群英传pl国战时间的修改方法
  • ¥15 matlab代码代写,需写出详细代码,代价私