从pear admin 下载了golang版本的代码,按照要求都配置好了,mac下就是跑不起来,第一感觉是库里边的代码有问题,但是我又没有找到问题,后来我又在ubuntu上down了代码,ubuntu上可以跑起来,这时我才知道应该是mac的golang环境的问题。
192:pear-admin-go sandy$ go run main.go
{"level":"info","time":"2022-05-14 10:20:45.485","caller":"/Volumes/macHDD/go_path/src/github.com/pear-admin-go/app/core/log/log.go:66","msg":"log 初始化成功","serverName":"pear-admin-go"}[2022-05-14 10:20:48] [info] replacing callback `gorm:update_time_stamp` from /Volumes/macHDD/go_path/src/github.com/pear-admin-go/app/core/db/db.go:159 [2022-05-14 10:20:48] [info] replacing callback `gorm:update_time_stamp` from /Volumes/macHDD/go_path/src/github.com/pear-admin-go/app/core/db/db.go:160
{"level":"info","time":"2022-05-14 10:20:48.154","caller":"/Volumes/macHDD/go_path/src/github.com/pear-admin-go/app/core/redis/redis.go:29","msg":"redis connect ping response:","serverName":"pear-admin-go","pong":"PONG"}
[GIN-debug] [WARNING] Running in "debug" mode. Switch to "release" mode in production.- using env: export GIN_MODE=release- using code: gin.SetMode(gin.ReleaseMode)[GIN-debug] GET /runtime/upload/images/*filepath --> github.com/gin-gonic/gin.(*RouterGroup).createStaticHandler.func1 (1 handlers)
[GIN-debug] HEAD /runtime/upload/images/*filepath --> github.com/gin-gonic/gin.(*RouterGroup).createStaticHandler.func1 (1 handlers)
[GIN-debug] GET /runtime/file/*filepath --> github.com/gin-gonic/gin.(*RouterGroup).createStaticHandler.func1 (1 handlers)
[GIN-debug] HEAD /runtime/file/*filepath --> github.com/gin-gonic/gin.(*RouterGroup).createStaticHandler.func1 (1 handlers)
[GIN-debug] GET /static/*filepath --> github.com/gin-gonic/gin.(*RouterGroup).createStaticHandler.func1 (1 handlers)
[GIN-debug] HEAD /static/*filepath --> github.com/gin-gonic/gin.(*RouterGroup).createStaticHandler.func1 (1 handlers)
fatal error: unexpected signal during runtime execution
[signal SIGSEGV: segmentation violation code=0x1 addr=0xb01dfacedebac1e pc=0x7fffb4a702fa]runtime stack:
runtime: unexpected return pc for runtime.sigpanic called from 0x7fffb4a702fa
stack: frame={sp:0x700001fbbd98, fp:0x700001fbbde8} stack=[0x700001f3c278,0x700001fbbe78)
0x0000700001fbbc98: 0x0100700001fbbcb8 0x0000000000000004
0x0000700001fbbca8: 0x000000000000001f 0x00007fffb4a702fa
0x0000700001fbbcb8: 0x0b01dfacedebac1e 0x0000000000000001
0x0000700001fbbcc8: 0x0000000004034991
0x0000700001fbbcd8: 0x000000000499ad97 0x0000700001fbbd20
0x0000700001fbbce8: 0x0000000004034c48
0x0000700001fbbcf8: 0x0000000000000001 0x0000000000000001
0x0000700001fbbd08: 0x0000700001fbbd68 0x0000000004034991
0x0000700001fbbd18: 0x000000c0000011e0 0x0000700001fbbd58
0x0000700001fbbd28: 0x0000000004034bd0
0x0000700001fbbd38: 0x0000000004034c00
0x0000700001fbbd48: 0x0000000004034991
0x0000700001fbbd58: 0x0000700001fbbd88 0x0000000004034991
0x0000700001fbbd68: 0x0000700001fbbd70 0x00000000040349c0
0x0000700001fbbd78: 0x00000000049a6a18 0x000000000000002a
0x0000700001fbbd88: 0x0000700001fbbdd8 0x000000000404a1b6
0x0000700001fbbd98: <0x00000000049a6a18 0x000000000403902d
0x0000700001fbbda8: 0x000005e9f655e64a 0x0000700001fbbde0
0x0000700001fbbdb8: 0x0000700001fbbde0 0x000000000403be4f
0x0000700001fbbdc8: 0x000000c0000001d8 0x0000000200000001
0x0000700001fbbdd8: 0x0000700001fbbe20 !0x00007fffb4a702fa
0x0000700001fbbde8: >0x0000700001fbbe20 0x0000000005d2c020
0x0000700001fbbdf8: 0x00000000000003f3 0x00000000043358e5
0x0000700001fbbe08: 0x00000000040672bf
0x0000700001fbbe18: 0x000000c000062d80 0x000000c00016dc90
0x0000700001fbbe28: 0x0000000004065110
0x0000700001fbbe38: 0x000000000400e4ce
0x0000700001fbbe48: 0x000000c0004649c0 0x0000000006110c00
0x0000700001fbbe58: 0x0000000000000398 0x000000c0000001a0
0x0000700001fbbe68: 0x0000000004063229
runtime.throw({0x49a6a18, 0x403902d})/usr/local/go/src/runtime/panic.go:1198 &#43;0x71
runtime: unexpected return pc for runtime.sigpanic called from 0x7fffb4a702fa
stack: frame&#61;{sp:0x700001fbbd98, fp:0x700001fbbde8} stack&#61;[0x700001f3c278,0x700001fbbe78)
0x0000700001fbbc98: 0x0100700001fbbcb8 0x0000000000000004
0x0000700001fbbca8: 0x000000000000001f 0x00007fffb4a702fa
0x0000700001fbbcb8: 0x0b01dfacedebac1e 0x0000000000000001
0x0000700001fbbcc8: 0x0000000004034991
0x0000700001fbbcd8: 0x000000000499ad97 0x0000700001fbbd20
0x0000700001fbbce8: 0x0000000004034c48
0x0000700001fbbcf8: 0x0000000000000001 0x0000000000000001
0x0000700001fbbd08: 0x0000700001fbbd68 0x0000000004034991
0x0000700001fbbd18: 0x000000c0000011e0 0x0000700001fbbd58
0x0000700001fbbd28: 0x0000000004034bd0
0x0000700001fbbd38: 0x0000000004034c00
0x0000700001fbbd48: 0x0000000004034991
0x0000700001fbbd58: 0x0000700001fbbd88 0x0000000004034991
0x0000700001fbbd68: 0x0000700001fbbd70 0x00000000040349c0
0x0000700001fbbd78: 0x00000000049a6a18 0x000000000000002a
0x0000700001fbbd88: 0x0000700001fbbdd8 0x000000000404a1b6
0x0000700001fbbd98: <0x00000000049a6a18 0x000000000403902d
0x0000700001fbbda8: 0x000005e9f655e64a 0x0000700001fbbde0
0x0000700001fbbdb8: 0x0000700001fbbde0 0x000000000403be4f
0x0000700001fbbdc8: 0x000000c0000001d8 0x0000000200000001
0x0000700001fbbdd8: 0x0000700001fbbe20 !0x00007fffb4a702fa
0x0000700001fbbde8: >0x0000700001fbbe20 0x0000000005d2c020
0x0000700001fbbdf8: 0x00000000000003f3 0x00000000043358e5
0x0000700001fbbe08: 0x00000000040672bf
0x0000700001fbbe18: 0x000000c000062d80 0x000000c00016dc90
0x0000700001fbbe28: 0x0000000004065110
0x0000700001fbbe38: 0x000000000400e4ce
0x0000700001fbbe48: 0x000000c0004649c0 0x0000000006110c00
0x0000700001fbbe58: 0x0000000000000398 0x000000c0000001a0
0x0000700001fbbe68: 0x0000000004063229
runtime.sigpanic()/usr/local/go/src/runtime/signal_unix.go:719 &#43;0x396goroutine 1 [syscall]:
syscall.syscall(0x43358e0, 0x1, 0x40487413, 0xc00016dd50)/usr/local/go/src/runtime/sys_darwin.go:22 &#43;0x3b fp&#61;0xc00016dcc0 sp&#61;0xc00016dca0 pc&#61;0x4061d5b
syscall.syscall(0x40716a6, 0x4, 0xc00016dd78, 0x40715d8)
golang.org/x/sys/unix.ioctl(0x49805ff, 0x4, 0x100c0004126c0)/Volumes/macHDD/go_path/pkg/mod/golang.org/x/sys&#64;v0.0.0-20210423185535-09eb48e85fd7/unix/zsyscall_darwin_amd64.go:690 &#43;0x39 fp&#61;0xc00016dd38 sp&#61;0xc00016dd08 pc&#61;0x4335579
golang.org/x/sys/unix.IoctlGetTermios(...)/Volumes/macHDD/go_path/pkg/mod/golang.org/x/sys&#64;v0.0.0-20210423185535-09eb48e85fd7/unix/ioctl.go:73
github.com/mattn/go-isatty.IsTerminal(0x49805ff)/Volumes/macHDD/go_path/pkg/mod/github.com/mattn/go-isatty&#64;v0.0.12/isatty_bsd.go:10 &#43;0x50 fp&#61;0xc00016dda8 sp&#61;0xc00016dd38 pc&#61;0x4617230
github.com/gin-gonic/gin.LoggerWithConfig({0x0, {0x0, 0x0}, {0x0, 0x0, 0x0}})/Volumes/macHDD/go_path/pkg/mod/github.com/gin-gonic/gin&#64;v1.7.1/logger.go:220 &#43;0x174 fp&#61;0xc00016de28 sp&#61;0xc00016dda8 pc&#61;0x4622c94
github.com/gin-gonic/gin.Logger(...)/Volumes/macHDD/go_path/pkg/mod/github.com/gin-gonic/gin&#64;v1.7.1/logger.go:184
pear-admin-go/app/router.InitRouter({0xc00053bf40}, {0xc00005e6e8})/Volumes/macHDD/go_path/src/github.com/pear-admin-go/app/router/router.go:28 &#43;0x2f8 fp&#61;0xc00016dec8 sp&#61;0xc00016de28 pc&#61;0x47018b8
main.main()/Volumes/macHDD/go_path/src/github.com/pear-admin-go/main.go:36 &#43;0xf8 fp&#61;0xc00016df80 sp&#61;0xc00016dec8 pc&#61;0x4702e18
runtime.main()/usr/local/go/src/runtime/proc.go:255 &#43;0x227 fp&#61;0xc00016dfe0 sp&#61;0xc00016df80 pc&#61;0x4037027
runtime.goexit()/usr/local/go/src/runtime/asm_amd64.s:1581 &#43;0x1 fp&#61;0xc00016dfe8 sp&#61;0xc00016dfe0 pc&#61;0x4065401goroutine 10 [chan receive]:
github.com/natefinch/lumberjack.(*Logger).millRun(0xc0000a8fc0)/Volumes/macHDD/go_path/pkg/mod/github.com/natefinch/lumberjack&#64;v2.0.0&#43;incompatible/lumberjack.go:379 &#43;0x45
created by github.com/natefinch/lumberjack.(*Logger).mill.func1/Volumes/macHDD/go_path/pkg/mod/github.com/natefinch/lumberjack&#64;v2.0.0&#43;incompatible/lumberjack.go:390 &#43;0x93goroutine 11 [select]:
database/sql.(*DB).connectionOpener(0xc00022d380, {0x5854e38, 0xc000494e40})/usr/local/go/src/database/sql/sql.go:1196 &#43;0x93
created by database/sql.OpenDB/usr/local/go/src/database/sql/sql.go:794 &#43;0x188goroutine 12 [select]:
github.com/go-sql-driver/mysql.(*mysqlConn).startWatcher.func1()/Volumes/macHDD/go_path/pkg/mod/github.com/go-sql-driver/mysql&#64;v1.5.0/connection.go:621 &#43;0xb0
created by github.com/go-sql-driver/mysql.(*mysqlConn).startWatcher/Volumes/macHDD/go_path/pkg/mod/github.com/go-sql-driver/mysql&#64;v1.5.0/connection.go:618 &#43;0x105goroutine 50 [chan receive]:
github.com/go-redis/redis/internal/pool.(*ConnPool).reaper(0xc000134e70, 0xc0000a8fc0)/Volumes/macHDD/go_path/pkg/mod/github.com/go-redis/redis&#64;v6.15.9&#43;incompatible/internal/pool/pool.go:449 &#43;0x87
created by github.com/go-redis/redis/internal/pool.NewConnPool/Volumes/macHDD/go_path/pkg/mod/github.com/go-redis/redis&#64;v6.15.9&#43;incompatible/internal/pool/pool.go:99 &#43;0x1be
exit status 2
执行下面这个命令 go get golang.org/x/sys 升级 golang.org/x/sys就解决了