Problem in understanding the syntax

In Go-Kit tutorial. I encounter an syntax which not familiar to me.

type uppercaseRequest struct {
    S string `json:"s"`
}

and Endpoints example :-

func makeUppercaseEndpoint(svc StringService) endpoint.Endpoint {
    return func(_ context.Context, request interface{}) (interface{}, error) {
	    req := request.(uppercaseRequest)
	    v, err := svc.Uppercase(req.S)
	    if err != nil {
		    return uppercaseResponse{v, err.Error()}, nil
	    }
	    return uppercaseResponse{v, ""}, nil
     }
}

I am having difficulty in understanding the below line

   req := request.(uppercaseRequest)

Help me !!!

That is a type assertion:

https://tour.golang.org/methods/15

This topic was automatically closed 90 days after the last reply. New replies are no longer allowed.