echo-swagger icon indicating copy to clipboard operation
echo-swagger copied to clipboard

go version 1.18 Generics, swag init failed

Open springionic opened this issue 1 year ago • 0 comments

When I use go 1.18 new feature: generics, I get error: expected '(', found '[' (and 1 more errors). Obviously, swag parse not support go 1.18 new feature generics. So when to support generics 😶

func IsElemInList[T any](elem T, list []T) bool {
	for i := 0; i < len(list); i++ {
		if reflect.DeepEqual(elem, list[i]) {
			return true
		}
	}
	return false
}

springionic avatar Jul 12 '22 08:07 springionic