Just check whether a specific time is the same with the specified location 
and with the Local location:
  
    if time.Date(2006,time.Month(1), 1, 0,0,0,0, 
time.Local).Equal(time.Date(2006,time.Month(1),1,0,0,0,0, 
offset.Location()) { return error }

2018. október 19., péntek 8:08:05 UTC+2 időpontban Matt Mueller a 
következőt írta:
>
> Hey folks,
>
> I'm trying to ensure that the user must pass a specific location (anything 
> but time.Local) into a function.
>
> I'd like to add a check like this:
>
> // ensure we didn't pass in an offset the default time.Local
> if offset.Location() == time.Local {
>  return nil, errors.New("offset use a specific timezone")
> }
>
>
> But I'm just not sure if the user happens to specify the timezone that 
> matches time.Local that this may evaluate as true. From preliminary tests, 
> it seems like it should be fine, but I'd like to double-check.
>
> Thanks!
>
> Matt
>

-- 
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