cast
cast copied to clipboard
Cannot cast alias variable to int32
Hello everyone. I'm facing the issue is I cannot convert the alias type to int32. This is an example
package main
import (
"testing"
"github.com/spf13/cast"
"github.com/stretchr/testify/require"
)
type a string
func Test_Case(t *testing.T) {
var anum a = "1"
c := cast.ToInt32(anum)
require.Equal(t, int32(1), c)
}
Thank you for your help