mirror of
https://github.com/k3s-io/kubernetes.git
synced 2025-07-27 13:37:30 +00:00
Add type conversion judgment
This commit is contained in:
parent
c3dd67dc21
commit
d170b0ca80
@ -455,10 +455,13 @@ func (ds *dockerService) getDockerVersionFromCache() (*dockertypes.Version, erro
|
|||||||
// We only store on key in the cache.
|
// We only store on key in the cache.
|
||||||
const dummyKey = "version"
|
const dummyKey = "version"
|
||||||
value, err := ds.versionCache.Get(dummyKey)
|
value, err := ds.versionCache.Get(dummyKey)
|
||||||
dv := value.(*dockertypes.Version)
|
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return nil, err
|
return nil, err
|
||||||
}
|
}
|
||||||
|
dv, ok := value.(*dockertypes.Version)
|
||||||
|
if !ok {
|
||||||
|
return nil, fmt.Errorf("Converted to *dockertype.Version error")
|
||||||
|
}
|
||||||
return dv, nil
|
return dv, nil
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user