Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Cannot cast alias variable to int32 #215

Open
rolniuq opened this issue Apr 2, 2024 · 0 comments
Open

Cannot cast alias variable to int32 #215

rolniuq opened this issue Apr 2, 2024 · 0 comments

Comments

@rolniuq
Copy link

rolniuq commented Apr 2, 2024

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

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant