#339·ferry

手动部署在Windows环境下提示空指针异常

Author: Atwood1Created Mar 14, 2025Updated Jun 3, 2026

我用的是这个git命令拉去的代码git clone https://gitee.com/yllan/ferry.git

执行到第五步的时候提示空指针异常

PS D:\Demo1\ferry> go run main.go init -c=./config/settings.dev.yml start init panic: runtime error: invalid memory address or nil pointer dereference [signal 0xc0000005 code=0x0 addr=0x0 pc=0x73c4a0]

goroutine 1 [running]: go.uber.org/zap.(*SugaredLogger).log(0x0, 0x5, {0x0?, 0xc000a9fc00?}, {0xc000a9fbe0?, 0xc00009c070?, 0xc000e4e000?}, {0x0, 0x0, 0x0}) C:/Users/19821/go/pkg/mod/go.uber.org/[email protected]/sugar.go:315 +0xa0 go.uber.org/zap.(*SugaredLogger).Fatal(...) C:/Users/19821/go/pkg/mod/go.uber.org/[email protected]/sugar.go:165 ferry/pkg/logger.Fatal(...) D:/Demo1/ferry/pkg/logger/logger.go:116 ferry/tools/config.ConfigSetup({0xc00000a122, 0x1}) D:/Demo1/ferry/tools/config/config.go:87 +0x127 ferry/cmd/migrate.run() D:/Demo1/ferry/cmd/migrate/server.go:36 +0x85 ferry/cmd/migrate.init.func1(0xc000c6f300?, {0x15ea990?, 0x4?, 0x15ea994?}) D:/Demo1/ferry/cmd/migrate/server.go:22 +0xf github.com/spf13/cobra.(*Command).execute(0x2931ae0, {0xc000dbfce0, 0x2, 0x2}) C:/Users/19821/go/pkg/mod/github.com/spf13/[email protected]/command.go:987 +0xa91 github.com/spf13/cobra.(*Command).ExecuteC(0x2931520) C:/Users/19821/go/pkg/mod/github.com/spf13/[email protected]/command.go:1115 +0x3ff github.com/spf13/cobra.(*Command).Execute(...) C:/Users/19821/go/pkg/mod/github.com/spf13/[email protected]/command.go:1039 ferry/cmd.Execute() D:/Demo1/ferry/cmd/cobra.go:39 +0x1a main.main() D:/Demo1/ferry/main.go:8 +0xf exit status 2 PS D:\Demo1\ferry>