Skip to content

Commit 4b3a1bb

Browse files
committed
make each return explicitly
Signed-off-by: zteBill <[email protected]>
1 parent a5dce0c commit 4b3a1bb

1 file changed

Lines changed: 7 additions & 6 deletions

File tree

api/server/httputils/httputils.go

Lines changed: 7 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -78,13 +78,14 @@ func ParseForm(r *http.Request) error {
7878

7979
// VersionFromContext returns an API version from the context using APIVersionKey.
8080
// It panics if the context value does not have version.Version type.
81-
func VersionFromContext(ctx context.Context) (ver string) {
81+
func VersionFromContext(ctx context.Context) string {
8282
if ctx == nil {
83-
return
83+
return ""
8484
}
85-
val := ctx.Value(APIVersionKey)
86-
if val == nil {
87-
return
85+
86+
if val := ctx.Value(APIVersionKey); val != nil {
87+
return val.(string)
8888
}
89-
return val.(string)
89+
90+
return ""
9091
}

0 commit comments

Comments
 (0)