Start failed - sonyflake not created
carrey-k opened this issue · 2 comments
carrey-k commented
make start
panic: sonyflake not created
goroutine 1 [running]:
github.com/LyricTian/gin-admin/v8/pkg/util/snowflake.init.0()
gin-admin/pkg/util/snowflake/snowflake.go:16 +0xe5
exit status 2
make: *** [start] Error 1
Go version
go version go1.16.15 darwin/amd64
Conight commented
Change this line and print error detail to console to see that happened.
gin-admin/pkg/util/snowflake/snowflake.go
Line 16 in a904050
mlsjla commented
我这边也遇到过, 大概是不支持部分内网段IP导致的。
func isPrivateIPv4(ip net.IP) bool { return ip != nil && (ip[0] == 10 || ip[0] == 172 && (ip[1] >= 16 && ip[1] < 32) || ip[0] == 192 && ip[1] == 168) }
解决办法,使用自定义获取机器码
getMachineID