hb-chen / echo-web Goto Github PK
View Code? Open in Web Editor NEWGo web framework Echo example.
Home Page: http://echo.www.hbchen.com
License: MIT License
Go web framework Echo example.
Home Page: http://echo.www.hbchen.com
License: MIT License
{"time":"2018-03-28T15:33:28+08:00","level":"DEBUG","prefix":"log","file":"/root/go/src/echo-web/model/orm/logger.go","line":"14","message":"orm log:[log /root/go/src/echo-web/vendor/github.com/hb-go/gorm/main.go:684 redigo: connection pool exhausted] \n"}
你好,当我go run server.go 的时候出现no buildable Go source files
[ go run server.go
| done: 1.976113s ]
router\www\router.go:11:2: no buildable Go source files in D:\workspace\go\src\echo-web\assets
module\render\render.go:20:2: no buildable Go source files in D:\workspace\go\src\echo-web\template
minfo := MaterialInfo{}
var count int64
db := DB().Where("db_internal_id = ?", id)
if err := Cache(db).First(&minfo).Count(&count).Error; err != nil {
log.Debugf("GetMaterialInfoById error: %v", err)
return nil
}
上面这种写法你们那没问题吗,我的怎么报错
{"time":"2018-12-18T18:14:53.3992271+08:00","level":"-","prefix":"api","file":"recover.go","line":"73","message":"[PANIC RECOVER] reflect.Set: value of type *model.MaterialInfo is not assignable to type model.MaterialInfo goroutine 37 [running]
我在set之前加了以下代码才通过
var value interface{}
v := reflect.ValueOf(out)
value = v.Interface()
if v.Kind() == reflect.Ptr {
p := v.Elem()
value = p.Interface()
}
c.store.Set(key, value, c.Expire)
usr/local/Cellar/go/1.7.4_2/libexec/pkg/tool/darwin_amd64/link: cannot open file /usr/local/Cellar/go/1.7.4_2/libexec/pkg/darwin_amd64/github.com/labstack/echo.a: open /usr/local/Cellar/go/1.7.4_2/libexec/pkg/darwin_amd64/github.com/labstack/echo.a: no such file or directory
?
谢谢楼主,去掉子域名部署更好.少即是多.一般采用e.Group("/api"),e.Group("/ws").
编译失败,错误: “pkg\mod\github.com\garyburd\[email protected]+incompatible\redis\pool.go:28:2: use of internal package github.com/gomodule/redigo/internal not allowed”
经查原因如下:
redigo已经移到新地址: github.com/gomodule/redigo
但是middleware/cache/redis.go引用的还是旧库: github.com/garyburd/redigo
有些地方不是很懂。或者加个微信交流交流?qianguozheng
您好,我是go新手,无意间发现echo框架,非常喜欢,但水平有限希望您能解释以下内容
日志中间件配置的output 如何以当天的日期创建一个文档 配置给output 以下代码 日志并没有写入任何信息
如果方便的话 能否加我一下qq 619735688 谢谢
var fd *os.File
e := echo.New()
e.Use(func(next echo.HandlerFunc) echo.HandlerFunc {
return func(c echo.Context) error {
fd, _ = os.OpenFile("这里通过time获取当天日期2017-02-01.log", os.O_APPEND|os.O_CREATE, 0644)
return next(c)
}
})
e.Use(middleware.LoggerWithConfig(middleware.LoggerConfig{Output: fd}))
e.GET("/", func(c echo.Context) error {
return c.JSON(http.StatusOK, "asd")
})
e.Use(func(next echo.HandlerFunc) echo.HandlerFunc {
return func(c echo.Context) error {
fd.Close()
return next(c)
}
})
登陆http://echo.www.localhost.com/user 的时候 Authorization 验证用户名和密码是什么啊 .......................无法登登陆上去
我自己的机器的问题已经解决
./run.sh
>>>> 18:30:22 remove pkg
>>>> 18:30:22 [ run ] server
# github.com/hb-go/echo-web/middleware/session
../github.com/hb-go/echo-web/middleware/session/redis.go:53:3: cannot use "github.com/garyburd/redigo/redis".Pool literal (type *"github.com/garyburd/redigo/redis".Pool) as type *"github.com/gomodule/redigo/redis".Pool in argument to redistore.NewRediStoreWithPool
# github.com/uber/jaeger-client-go
../github.com/uber/jaeger-client-go/metrics.go:100:35: too many arguments in call to factory.Namespace
have (string, nil)
want (metrics.NSOptions)
echo: http: Accept error: accept tcp [::]:8080: accept4: too many open files; retrying in 20ms
echo: http: Accept error: accept tcp [::]:8080: accept4: too many open files; retrying in 40ms
echo: http: Accept error: accept tcp [::]:8080: accept4: too many open files; retrying in 80ms
echo: http: Accept error: accept tcp [::]:8080: accept4: too many open files; retrying in 160ms
echo: http: Accept error: accept tcp [::]:8080: accept4: too many open files; retrying in 320ms
echo: http: Accept error: accept tcp [::]:8080: accept4: too many open files; retrying in 640ms
echo: http: Accept error: accept tcp [::]:8080: accept4: too many open files; retrying in 1s
e.Pre(pprof.Serve())
添加的这个中间件,是不能够使用一下命令行的吧,
go tool pprof http://localhost:9293/debug/pprof/profile
pprof.Index(c.Response(), c.Request()) 函数只支持以下几个路径
profiles.m = map[string]*Profile{
"goroutine": goroutineProfile,
"threadcreate": threadcreateProfile,
"heap": heapProfile,
"block": blockProfile,
"mutex": mutexProfile,
}
对 go tool pprof http://localhost:9293/debug/pprof/profile 命令行
应该使用这个函数
pprof.Profile(c.Response(), c.Request())
这块是不是应该针对各种pprof单独设置路由。
Hello! I've managed to setup most of the package, but when I run build.sh I get the following message:
/home/vagrant/go/src/github.com/hobo-go/echo-web/echo/echo.go:13:2: no buildable Go source files in /home/vagrant/go/src/github.com/hobo-go/echo-web/assets /home/vagrant/go/src/github.com/hobo-go/echo-web/modules/render/render.go:19:2: no buildable Go source files in /home/vagrant/go/src/github.com/hobo-go/echo-web/templates
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.