Found unnecessary multiple type assertion SCC-S1034
Anti-pattern
Major
5 months ago3 years old
assigning the result of this type assertion to a variable (switch outputWriter := outputWriter.(type)) could eliminate type assertions in switch cases
171		return false, "", err
172	}
173
174	switch outputWriter.(type) {175	case io.WriteCloser:
176		outputWriter.(io.WriteCloser).Close()
177	}
assigning the result of this type assertion to a variable (switch obj := obj.(type)) could eliminate type assertions in switch cases
234// not support int64 on 32-bit platform
235func (m Max) IsSatisfied(obj interface{}) bool {
236	var v int
237	switch obj.(type) {238	case int64:
239		if wordsize == 32 {
240			return false
assigning the result of this type assertion to a variable (switch obj := obj.(type)) could eliminate type assertions in switch cases
188// not support int64 on 32-bit platform
189func (m Min) IsSatisfied(obj interface{}) bool {
190	var v int
191	switch obj.(type) {192	case int64:
193		if wordsize == 32 {
194			return false
assigning the result of this type assertion to a variable (switch f := f.(type)) could eliminate type assertions in switch cases
789
790func formatPattern(f interface{}, v ...interface{}) string {
791	var msg string
792	switch f.(type) {793	case string:
794		msg = f.(string)
795		if len(v) == 0 {