Skip to content
Myr

Fix typos (#1626)

Before adoption: this commit came in with the history the project adopted, so no landing records it.

authored by Barnabus · committed by thinkerou · parent 4f488ac · Browse files · 7 files+8 added−8 removed
This commit

State

Before adoption: this commit came in with the history the project adopted, so no landing records it.

Diff stats

7 files+8 added−8 removed

  • other:+8 added−8 removed

7 files+8 added−8 removed

modified:binding/binding.go+1 added-1 removed
35 unmodified lines
36}3738// StructValidator is the minimal interface which needs to be implemented in39// order for it to be used as the validator engine for ensuring the correctness40// of the reqest. Gin provides a default implementation for this using40// of the request. Gin provides a default implementation for this using41// https://github.com/go-playground/validator/tree/v8.18.2.42type StructValidator interface {43 // ValidateStruct can receive any kind of type and it should never panic, even if the configuration is not right.44 // If the received type is not a struct, any validation should be skipped and nil must be returned.
55 unmodified lines
modified:binding/protobuf.go+1 added-1 removed
27 unmodified lines
28func (protobufBinding) BindBody(body []byte, obj interface{}) error {29 if err := proto.Unmarshal(body, obj.(proto.Message)); err != nil {30 return err31 }32 // Here it's same to return validate(obj), but util now we cann't add32 // Here it's same to return validate(obj), but util now we can't add33 // `binding:""` to the struct which automatically generate by gen-proto34 return nil35 // return validate(obj)36}
modified:examples/grpc/gin/main.go+1 added-1 removed
17 unmodified lines
18 }19 defer conn.Close()20 client := pb.NewGreeterClient(conn)2122 // Set up a http setver.22 // Set up a http server.23 r := gin.Default()24 r.GET("/rest/n/:name", func(c *gin.Context) {25 name := c.Param("name")26
20 unmodified lines
modified:context.go+1 added-1 removed
523 unmodified lines
524 return c.MustBindWith(obj, binding.Query)525}526527// MustBindWith binds the passed struct pointer using the specified binding engine.528// It will abort the request with HTTP 400 if any error ocurrs.528// It will abort the request with HTTP 400 if any error occurs.529// See the binding package.530func (c *Context) MustBindWith(obj interface{}, b binding.Binding) (err error) {531 if err = c.ShouldBindWith(obj, b); err != nil {532 c.AbortWithError(http.StatusBadRequest, err).SetType(ErrorTypeBind)
425 unmodified lines
modified:logger.go+1 added-1 removed
51 unmodified lines
52func Logger() HandlerFunc {53 return LoggerWithWriter(DefaultWriter)54}5556// LoggerWithWriter instance a Logger middleware with the specified writter buffer.56// LoggerWithWriter instance a Logger middleware with the specified writer buffer.57// Example: os.Stdout, a file opened in write mode, a socket...58func LoggerWithWriter(out io.Writer, notlogged ...string) HandlerFunc {59 isTerm := true60
92 unmodified lines
modified:routergroup.go+2 added-2 removed
51 unmodified lines
52 group.Handlers = append(group.Handlers, middleware...)53 return group.returnObj()54}5556// Group creates a new router group. You should add all the routes that have common middlwares or the same path prefix.57// For example, all the routes that use a common middlware for authorization could be grouped.56// Group creates a new router group. You should add all the routes that have common middlewares or the same path prefix.57// For example, all the routes that use a common middleware for authorization could be grouped.58func (group *RouterGroup) Group(relativePath string, handlers ...HandlerFunc) *RouterGroup {59 return &RouterGroup{60 Handlers: group.combineHandlers(handlers),61 basePath: group.calculateAbsolutePath(relativePath),
156 unmodified lines
modified:tree_test.go+1 added-1 removed
10 unmodified lines
11 "strings"12 "testing"13)1415// Used as a workaround since we can't compare functions or their addressses15// Used as a workaround since we can't compare functions or their addresses16var fakeHandlerValue string1718func fakeHandler(val string) HandlersChain {19 return HandlersChain{func(c *Context) {
678 unmodified lines