cast icon indicating copy to clipboard operation
cast copied to clipboard

safe and easy casting from one type to another in Go

Results 110 cast issues
Sort by recently updated
recently updated
newest added

i use cast in many places of my project,i grasp some flamegraph in runtime by go pprof, i found the cast will cost a lot memory sapce in the flamegraph,...

https://play.golang.com/p/3oTZVLEkdas ```go package main import ( "fmt" "github.com/spf13/cast" ) func main() { x := cast.ToInt("08") fmt.Printf("08 => %d\n", x) x = cast.ToInt("8") fmt.Printf("8 => %d\n", x) } ``` I'd expect...

The return result is []byte

I have the need of casting an `interface{}` to a `slice` of `float64` numbers, but the corresponding helper is missing. Since there are already functions like `ToIntSlice()`, is it ok...

## Summary - IBM License Checker found a violation in `frankban/quicktest` referencing LGPL license. ## Details - I don't see any reference to `quicktest` in the cast code. - Can...

The `json.Number` should be treated more like a number than string. https://go.dev/play/p/H9JUZn3WlTR

Technically, the following is valid: ```go var i int64 = -1 j := uint64(i) ``` The value will overflow, but the conversion happens. We should replace the `errNegativeNotAllowed` error with...

Previously, float numbers in string format could not be converted to int. This change allows just that.

- Direct checks and then indirect checks - Grouping convertible types in switches