mix-go / mix Goto Github PK
View Code? Open in Web Editor NEW✨ Standard Toolkit for Go fast development / Go 快速开发标准工具包
Home Page: https://openmix.org/mix-go
License: Apache License 2.0
✨ Standard Toolkit for Go fast development / Go 快速开发标准工具包
Home Page: https://openmix.org/mix-go
License: Apache License 2.0
issue:
建议 修改 配置路径 拼接的 逻辑.
Can you introduce the framework loading process of the following rectification projects? Because gin's default loading process, such as DB Error Logger, is for a Beans instance. These components, if a server provided by GIN is not available, how to replenish the corresponding Error message instead of the service being unavailable due to panic
按照文档demo,一步步做:
https://www.kancloud.cn/onanying/mixgo1/1894807
错误信息:
go build -o bin/go_build_main_go.exe main.go
# hello/commands
commands\server.go:15:7: Addr redeclared in this block
previous declaration at commands\api.go:21:14
commands\web.go:22:7: Addr redeclared in this block
previous declaration at commands\server.go:15:14
提示显示可能是端口冲突,改了commands/api.go 里的端口为 8081,改commands/web.go里的端口为8082,server.go里没有动(8080)。接着跑还是报这个错误。
编辑器使用的:vscode. 安装的插件:go 0.18.1
看来swoole是走下坡路了。。对了老大 你这有和gin fiber goframe等主流框架的性能测试对比么
如果数据库服务重启,gorm.go会panic,整个app就crash了。。
作者可以考虑一下内置viper库来提供选择,现在很多项目用viper的挺多的。
根据文档使用Gorm的方法:
db := di.Gorm()
user := User{Name: "Jinzhu", Age: 18, Birthday: time.Now()}
result := db.Create(&user)
fmt.Println(result)
在Controller实现数据库查询业务时,对于db := di.Gorm()
的使用,应该每次都db := di.Gorm()
创建一个新的db变量,还是在某个位置声明并创建一个全局的db变量,所有controller公用这个db变量?
golang纯小白, 运行示例应用报错
平台
raspberry pi 2 model b
系统
Linux ubuntu 5.4.0-1022-raspi #25-Ubuntu SMP PREEMPT Thu Oct 15 14:22:53 UTC 2020 armv7l armv7l armv7l GNU/Linux
报错信息
ubuntu@ubuntu:~/projects/hello/bin$ ./go_build_main_go api
time=2020-11-13 08:18:05.454 level=error msg=dial tcp 127.0.0.1:3306: connect: connection refused
goroutine 1 [running]:
runtime/debug.Stack(0x69c658, 0x1288060, 0x6da108)
/usr/lib/go-1.13/src/runtime/debug/stack.go:24 +0x78
github.com/mix-go/console.(*ErrorHandler).Handle(0x100e9e0, 0x6d43d8, 0x1282050)
/home/ubuntu/go/pkg/mod/github.com/mix-go/[email protected]/error.go:52 +0x60
github.com/mix-go/console.(*Application).Run.func1(0x12932c0)
/home/ubuntu/go/pkg/mod/github.com/mix-go/[email protected]/application.go:122 +0xc4
panic(0x6d43d8, 0x1282050)
/usr/lib/go-1.13/src/runtime/panic.go:679 +0x194
github.com/mix-go/bean.(*BeanDefinition).instance.func1.1(0x1286ae0, 0x12139ac)
/home/ubuntu/go/pkg/mod/github.com/mix-go/[email protected]/definition.go:94 +0x16c
panic(0x6d43d8, 0x1282050)
/usr/lib/go-1.13/src/runtime/panic.go:679 +0x194
github.com/mix-go/bean.(*BeanDefinition).instance.func1(0x1286ae0, 0x12139ac, 0x100d540, 0x2, 0x2)
/home/ubuntu/go/pkg/mod/github.com/mix-go/[email protected]/definition.go:102 +0x1b0
github.com/mix-go/bean.(*BeanDefinition).instance(0x1286ae0, 0x6c0750, 0x1213bbc)
/home/ubuntu/go/pkg/mod/github.com/mix-go/[email protected]/definition.go:106 +0x2d4
github.com/mix-go/bean.(*ApplicationContext).GetBean(0x12c54c0, 0x774aa5, 0x2, 0x1213c14, 0x1213bec, 0x0, 0x0, 0x75fe58, 0x1010680)
/home/ubuntu/go/pkg/mod/github.com/mix-go/[email protected]/context.go:60 +0x118
github.com/mix-go/bean.(*ApplicationContext).Get(...)
/home/ubuntu/go/pkg/mod/github.com/mix-go/[email protected]/context.go:69
github.com/mix-go/console.(*Application).Get(...)
/home/ubuntu/go/pkg/mod/github.com/mix-go/[email protected]/application.go:109
hello/globals.DB(...)
/home/ubuntu/projects/hello/globals/db.go:9
hello/globals.Init()
/home/ubuntu/projects/hello/globals/init.go:23 +0x220
hello/listeners.(*CommandListener).Process(0xd32aa0, 0x87eb50, 0x1010710)
/home/ubuntu/projects/hello/listeners/command.go:24 +0x3c
github.com/mix-go/event.(*ListenerProvider).getListenersForEvent.func1(0x87eb50, 0x1010710)
/home/ubuntu/go/pkg/mod/github.com/mix-go/[email protected]/provider.go:17 +0x38
github.com/mix-go/event.(*EventDispatcher).Dispatch(0x1010618, 0x87eb50, 0x1010710, 0xe1901, 0x4)
/home/ubuntu/go/pkg/mod/github.com/mix-go/[email protected]/dispatcher.go:11 +0x80
github.com/mix-go/console.(*Application).call(0x12932c0)
/home/ubuntu/go/pkg/mod/github.com/mix-go/[email protected]/application.go:202 +0x120
github.com/mix-go/console.(*Application).Run(0x12932c0)
/home/ubuntu/go/pkg/mod/github.com/mix-go/[email protected]/application.go:161 +0x3b4
main.main()
/home/ubuntu/projects/hello/main.go:28 +0xac
file=logger.go:19
非常好,屌爆了
如题
只能每次build 然后运行吗, 直接 go run mian.go 会提示配置文件路径错误,需要去改 viper 或者 dotnev 读取路径
对于子命令的帮助,只支持--help 不支持 -h
myapp command1 -help
不支持
myapp command1 -h
A declarative, efficient, and flexible JavaScript library for building user interfaces.
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google ❤️ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.