-1
type state struct{
    name string    
    zipcode string  
}

I want to convert this to any.Any type, plzz help!

Anksus
  • 7
  • 1

1 Answers1

0

If I understood correctly, you're trying to convert to the any which is an alias to interface{}.

You can do

y := interface{}(x)

z := any(x)

But I'm curious why you need this, maybe you're having a XY Problem

Umut Gerçek
  • 630
  • 6
  • 9
  • Thanks for that. Actually I didn't read the documentation of types protobuf and asked here directly. My bad. any, err := anypb.New(message). It does the job. – Anksus Aug 18 '22 at 09:11