mirror of
https://github.com/moby/moby.git
synced 2026-01-11 18:51:37 +00:00
daemon/libnetwork/options: GenerateFromModel: remove redundant check
This check was added in 14c5cd377d to prevent
passing `nil` as type (`GenerateFromModel[nil](....)`), however, `nil` is not
a type, so trying to do so won't compile. Even if it would, it would be
theoretical at best, so let's just remove it.
fix linting:
daemon/libnetwork/options/options.go:57:13: SA4023(related information): the lhs of the comparison is the 1st return value of this function call (staticcheck)
modType := reflect.TypeFor[T]()
^
daemon/libnetwork/options/options.go:58:5: SA4023: this comparison is never true (staticcheck)
if modType == nil {
^
Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
This commit is contained in:
@@ -3,7 +3,6 @@
|
||||
package options
|
||||
|
||||
import (
|
||||
"errors"
|
||||
"fmt"
|
||||
"reflect"
|
||||
)
|
||||
@@ -55,9 +54,6 @@ func GenerateFromModel[T any](options Generic) (T, error) {
|
||||
var zero T
|
||||
|
||||
modType := reflect.TypeFor[T]()
|
||||
if modType == nil {
|
||||
return zero, errors.New("invalid model: model is nil")
|
||||
}
|
||||
|
||||
isPtr := modType.Kind() == reflect.Ptr
|
||||
|
||||
|
||||
Reference in New Issue
Block a user