It's a little unclear to me what exactly you're trying to check; giving an example might make it easier to advise.
But in any case, Go doesn't have anything quite like static_assert in C/C++. Depending on what you're trying to do, you could put a call to panic in an init() function, which would at least catch the error on program start. Quoting hay (2018-10-27 18:07:08) > Hi, > I've a project and it needs static asserts at compile time to check if > string values are not left empty by the programmer. Is this possible in > golang? > Thanks in advance > > -- > You received this message because you are subscribed to the Google > Groups "golang-nuts" group. > To unsubscribe from this group and stop receiving emails from it, send > an email to [1][email protected]. > For more options, visit [2]https://groups.google.com/d/optout. > > Verweise > > 1. mailto:[email protected] > 2. https://groups.google.com/d/optout -- You received this message because you are subscribed to the Google Groups "golang-nuts" group. To unsubscribe from this group and stop receiving emails from it, send an email to [email protected]. For more options, visit https://groups.google.com/d/optout.
