summaryrefslogtreecommitdiff
path: root/vendor/github.com/gin-gonic/gin/binding/protobuf.go
diff options
context:
space:
mode:
authorLibravatar tobi <31960611+tsmethurst@users.noreply.github.com>2021-11-27 15:26:58 +0100
committerLibravatar GitHub <noreply@github.com>2021-11-27 15:26:58 +0100
commit182b4eea73881c611a0f519576aa6ad2aa6799c2 (patch)
tree230fac469690fcee8797b13585e739be148d4789 /vendor/github.com/gin-gonic/gin/binding/protobuf.go
parentRequire confirmed email when checking oauth token (#332) (diff)
downloadgotosocial-182b4eea73881c611a0f519576aa6ad2aa6799c2.tar.xz
Update dependencies (#333)
Diffstat (limited to 'vendor/github.com/gin-gonic/gin/binding/protobuf.go')
-rw-r--r--vendor/github.com/gin-gonic/gin/binding/protobuf.go9
1 files changed, 2 insertions, 7 deletions
diff --git a/vendor/github.com/gin-gonic/gin/binding/protobuf.go b/vendor/github.com/gin-gonic/gin/binding/protobuf.go
index a4e471535..f9ece928d 100644
--- a/vendor/github.com/gin-gonic/gin/binding/protobuf.go
+++ b/vendor/github.com/gin-gonic/gin/binding/protobuf.go
@@ -5,11 +5,10 @@
package binding
import (
- "errors"
"io/ioutil"
"net/http"
- "google.golang.org/protobuf/proto"
+ "github.com/golang/protobuf/proto"
)
type protobufBinding struct{}
@@ -27,11 +26,7 @@ func (b protobufBinding) Bind(req *http.Request, obj interface{}) error {
}
func (protobufBinding) BindBody(body []byte, obj interface{}) error {
- msg, ok := obj.(proto.Message)
- if !ok {
- return errors.New("obj is not ProtoMessage")
- }
- if err := proto.Unmarshal(body, msg); err != nil {
+ if err := proto.Unmarshal(body, obj.(proto.Message)); err != nil {
return err
}
// Here it's same to return validate(obj), but util now we can't add