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
Provenance
- Commit
7a374f9- Tree
9cbb214- Author
Barnabus <jbampton@users.noreply.github.com>- Committer
thinkerou <thinkerou@gmail.com>- Parent
4f488ac
7 files changed+8 added−8 removed
modified:binding/binding.go+1 added-1 removed
35 unmodified lines36 }37 38 // 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.42 type 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 linesmodified:binding/protobuf.go+1 added-1 removed
27 unmodified lines28 func (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 lines18 }19 defer conn.Close()20 client := pb.NewGreeterClient(conn)21 22- // 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 linesmodified:context.go+1 added-1 removed
523 unmodified lines524 return c.MustBindWith(obj, binding.Query)525 }526 527 // 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.530 func (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 linesmodified:logger.go+1 added-1 removed
51 unmodified lines52 func Logger() HandlerFunc {53 return LoggerWithWriter(DefaultWriter)54 }55 56-// 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...58 func LoggerWithWriter(out io.Writer, notlogged ...string) HandlerFunc {59 isTerm := true60 92 unmodified linesmodified:routergroup.go+2 added-2 removed
51 unmodified lines52 group.Handlers = append(group.Handlers, middleware...)53 return group.returnObj()54 }55 56-// 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.58 func (group *RouterGroup) Group(relativePath string, handlers ...HandlerFunc) *RouterGroup {59 return &RouterGroup{60 Handlers: group.combineHandlers(handlers),61 basePath: group.calculateAbsolutePath(relativePath),156 unmodified linesmodified:tree_test.go+1 added-1 removed
10 unmodified lines11 "strings"12 "testing"13 )14 15-// 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 addresses16 var fakeHandlerValue string17 18 func fakeHandler(val string) HandlersChain {19 return HandlersChain{func(c *Context) {678 unmodified lines