无法在Mac上使用run.sh来运行Go项目,而PostgreSQL在Docker上运行

时间:2019-08-14 07:12:33

标签: postgresql docker go

我最近开始从事Go项目,该项目在Docker上使用PostgreSQL。每次使用“ run.sh”运行项目时,都会出现以下错误。

(base) Rishikeshs-MacBook-Pro:src rishikeshchandra$ ta_api/run.sh
[gin] Listening on port 3507
[gin] Building...
panic: runtime error: invalid memory address or nil pointer dereference
[signal SIGSEGV: segmentation violation code=0x1 addr=0x8 pc=0x12aad91]

goroutine 1 [running]:
os.(*ProcessState).success(...)
    /usr/local/go/src/os/exec_posix.go:74
os.(*ProcessState).Success(...)
    /usr/local/go/src/os/exec.go:152
github.com/codegangsta/gin/lib.(*builder).Build(0xc0000227e0, 0xc0000c5350, 0x1)
    /Users/rishikeshchandra/go/src/github.com/codegangsta/gin/lib/builder.go:62 +0x321
main.build(0x143a460, 0xc0000227e0, 0x143ae60, 0xc000022840, 0xc0000a4190)
    /Users/rishikeshchandra/go/src/github.com/codegangsta/gin/main.go:234 +0xb5
main.MainAction(0xc0000e0b00)
    /Users/rishikeshchandra/go/src/github.com/codegangsta/gin/main.go:203 +0xa0c
gopkg.in/urfave/cli%2ev1.HandleAction(0x134f940, 0x13ee4d0, 0xc0000e0b00, 0xc0000e0b00, 0x0)
    /Users/rishikeshchandra/go/src/gopkg.in/urfave/cli.v1/app.go:516 +0x127
gopkg.in/urfave/cli%2ev1.Command.Run(0x13d68cf, 0x3, 0x13d6612, 0x1, 0x0, 0x0, 0x0, 0x13e66cf, 0x32, 0x0, ...)
    /Users/rishikeshchandra/go/src/gopkg.in/urfave/cli.v1/command.go:171 +0x4a4
gopkg.in/urfave/cli%2ev1.(*App).Run(0xc000102000, 0xc0000100f0, 0xf, 0xf, 0x0, 0x0)
    /Users/rishikeshchandra/go/src/gopkg.in/urfave/cli.v1/app.go:265 +0x70b
main.main()
    /Users/rishikeshchandra/go/src/github.com/codegangsta/gin/main.go:140 +0xd17

这是我的run.sh文件中的代码

   #!/bin/bash

export PORT=3070
export PUBLIC_URL=http://localhost:3540
#export FRONT_TOKEN_CATCH=http://m.com:8080/_tokenCatch/
export SECRET=secret
export DEBUG=true
export SKIP_ROLE_ON_ADMIN=true
export AUTO_MIGRATIONS=true
export MARKETDATA_SYNC=true
#export STOCKS_SEED_DIR=./models/stocks/seeds/

export DB_PG=postgres://postgres:postgres@localhost:5531/postgres?sslmode=disable

gin --appPort 3540 --port 3507 -i -x .git -x .postgress_data -x vendor --build ./cmd/server/ run

0 个答案:

没有答案
相关问题