If the strings values are constants, you can use this trick to assert they 
are not blank at compile time.
https://go101.org/article/tips.html#assert-at-compile-time

For example, for a constant string with name *Version*, you can assure it 
is not blank by using

var _ = map[bool]int{false: 0, Version != "": 1}

On Saturday, October 27, 2018 at 6:07:08 PM UTC-4, hay wrote:
>
> 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 golang-nuts+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to