1
0
mirror of https://github.com/moby/moby.git synced 2025-08-08 13:22:22 +03:00

make each return explicitly

Signed-off-by: zteBill <bi.zhenkun@zte.com.cn>
This commit is contained in:
zteBill
2016-11-15 01:15:24 +08:00
parent a5dce0cb1a
commit 4b3a1bbda5

View File

@@ -78,13 +78,14 @@ func ParseForm(r *http.Request) error {
// VersionFromContext returns an API version from the context using APIVersionKey. // VersionFromContext returns an API version from the context using APIVersionKey.
// It panics if the context value does not have version.Version type. // It panics if the context value does not have version.Version type.
func VersionFromContext(ctx context.Context) (ver string) { func VersionFromContext(ctx context.Context) string {
if ctx == nil { if ctx == nil {
return return ""
}
val := ctx.Value(APIVersionKey)
if val == nil {
return
} }
if val := ctx.Value(APIVersionKey); val != nil {
return val.(string) return val.(string)
} }
return ""
}