eyecuelab / kit Goto Github PK
View Code? Open in Web Editor NEWGoLang Kit Repo (see: https://www.goinggo.net/2017/02/package-oriented-design.html)
License: Apache License 2.0
GoLang Kit Repo (see: https://www.goinggo.net/2017/02/package-oriented-design.html)
License: Apache License 2.0
This issue has been opened automaticaly because we think you are using satori/uuid in your code. Unfortunately, satori/uuid has a critical defect where it doesn't generate random UUIDV4s satori/go.uuid#73 and should be replaced as the maintainer has been unresponsive for 5 months with the bug still open. Alternative packages you should consider: https://github.com/google/uuid https://github.com/pborman/uuid
In web/middleware/template.go
, we have the following function:
func TemplateWithConfig(config TemplateConfig) echo.MiddlewareFunc {
if config.Skipper == nil {
config.Skipper = DefaultTemplateConfig.Skipper
}
return func(next echo.HandlerFunc) echo.HandlerFunc {
return func(c echo.Context) (err error) {
if config.Skipper(c) { // this branch does nothing
return next(c)
}
return next(c)
}
}
}
Specifically:
{
if config.Skipper(c){
return next(c)
}
return next(c)
}
seems wrong. Why do we test for config.Skipper if it doesn't matter? Does it have side effects? Couldn't we just replace the whole branch withreturn next(c)
?
We have a GOTO in the following function in web/error_handler.go
goto ERROR
is identical to
logErr(err)
return
here. Is this a relic of a former system, or for performance reasons?
func ErrorHandler(err error, c echo.Context) {
if c.Response().Committed {
return
}
status, apiError := toApiError(err)
if c.Request().Method == "HEAD" {
if err := c.NoContent(status); err != nil {
goto ERROR
}
return
}
if err := renderApiErrors(c, apiError); err != nil {
//are we supposed to log this error twice?
logErr(err)
goto ERROR
}
if status < 500 {
return
}
ERROR:
logErr(err)
}
In cfg/cfg.go, we have the function BeenSet.
BeenSet generally shows whether or not the value of a type is the NOT zero value of a type (with the exception of bool
).
However, the default case here shows whether the value of a type IS the zero value of interface{}.
This seems wrong!
func BeenSet(v interface{}) bool {
switch v.(type) {
case int, int8, int16, int32, int64, uint, uint8, uint16, uint32, uint64, float32, float64:
return v.(int) != 0
case string, []rune, []byte:
return v.(string) != ""
case []int, []int8, []int16, []int64, []uint, []uint16, []uint64, []float32, []float64:
return v.([]interface{}) != nil
case bool:
return true // no way to tell
default:
var other interface{}
return v.(interface{}) == other
//should this be !=??
}
}
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.