Search Options

Results per page
Sort
Preferred Languages
Advance

Results 1 - 2 of 2 for isFormatter (0.43 sec)

  1. src/cmd/vendor/golang.org/x/tools/go/analysis/passes/printf/printf.go

    	}
    
    	var fact isWrapper
    	if pass.ImportObjectFact(fn, &fact) {
    		return fn, fact.Kind
    	}
    
    	return fn, KindNone
    }
    
    // isFormatter reports whether t could satisfy fmt.Formatter.
    // The only interface method to look for is "Format(State, rune)".
    func isFormatter(typ types.Type) bool {
    	// If the type is an interface, the value it holds might satisfy fmt.Formatter.
    	if _, ok := typ.Underlying().(*types.Interface); ok {
    Registered: Wed Jun 12 16:32:35 UTC 2024
    - Last Modified: Tue Apr 02 02:20:05 UTC 2024
    - 32.5K bytes
    - Viewed (0)
  2. src/cmd/vendor/golang.org/x/tools/go/analysis/passes/printf/types.go

    	// %w accepts only errors.
    	if m.t == argError {
    		return types.ConvertibleTo(typ, errorType)
    	}
    
    	// If the type implements fmt.Formatter, we have nothing to check.
    	if isFormatter(typ) {
    		return true
    	}
    
    	// If we can use a string, might arg (dynamically) implement the Stringer or Error interface?
    	if m.t&argString != 0 && isConvertibleToString(typ) {
    		return true
    	}
    
    Registered: Wed Jun 12 16:32:35 UTC 2024
    - Last Modified: Tue Apr 02 02:20:05 UTC 2024
    - 8.6K bytes
    - Viewed (0)
Back to top