[go-nuts] NullTime in sql package ?

2017-12-10 Thread Tamás Gulácsi
Time.IsZero is enough for me.

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


Re: [go-nuts] Breaking change: reflect.StructOf: field 0 has no name

2017-12-10 Thread Ian Lance Taylor
On Sun, Dec 10, 2017 at 8:46 AM,   wrote:
>
> I had some code that I didn't touch for a while and now it seems it's
> broken. It panics with `reflect.StructOf: field 0 has no name` at runtime.
> Wasn't Go supposed to have some sort of compatibility promise?
>
> After a while I've found this[1]  issue which seems to be the reason why my
> program panics now and my question is why is a struct field without a name
> invalid ? Anonymous fields are supposed to have no field names, right?
>
>  https://github.com/golang/go/issues/20600

Yes, unfortunately we had to change the way that it worked.  To make
an anonymous field, set the name to the type name and set Anonymous to
true.

Ian

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


[go-nuts] Breaking change: reflect.StructOf: field 0 has no name

2017-12-10 Thread mihai
I had some code that I didn't touch for a while and now it seems it's 
broken. It panics with `reflect.StructOf: field 0 has no name` at runtime. 
Wasn't Go supposed to have some sort of compatibility promise? 

After a while I've found this[1]  issue which seems to be the reason why my 
program panics now and my question is why is a struct field without a name 
invalid ? Anonymous fields are supposed to have no field names, right? 

 https://github.com/golang/go/issues/20600 

Mihai. 

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


Re: [go-nuts] Any way to run functions in independent threads/processes in go?

2017-12-10 Thread Justin Israel
On Sun, Dec 10, 2017, 8:38 PM shockme  wrote:

> Hi,
>
> I'd like to know if there is any way to run go functions in independent
> threads/process, just like multiprocessing.Pool.apply.
>

If this refers to Python's multiprocessing.Pool.apply, I can say that this
exists because of the limitations of threads in Python being synchronised
by the GIL. With cpu heavy workloads, you would not be able to fully
utilise multiple cored via threads. So the multiprocessing module was
created to use the same api as threading, and allow CPU bound work to run
across multiple forks of the original process and communicate data over
pipes.

Doesn't seem like you would need this in Go since you can already fully
utilise all your cores in goroutines of the same process.

Justin

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

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


[go-nuts] Re: Webservices with Windows Authentication

2017-12-10 Thread snmed

Hi Paul

Thank you for your answer. Maybe i wasn't clear, but we do not have 
problems with direct user authentication, as we use ADFS and OAuth (Token 
format JWT) to authenticate users. Our problem is
the authentication between webservices and web applications that running 
under group managed service accounts (gMSA) and we strongly want to use 
that feature, because so we do not have to manage
passwords for those accounts. 

I found a kerberos library https://github.com/jcmturner/gokrb5 that looks 
very promising, but I do not know how to get a keytab for a group managed 
service account.

Cheers,
Sandro 

Am Sonntag, 10. Dezember 2017 01:51:11 UTC+1 schrieb oldCoderException:
>
> I can't comment on authenticating a go client against windoze services, 
> but we use both LDAP and Active Directory (AD) extensively and authenticate 
> our users, as well as add and modify them to those services using Go all 
> the time.  We use this excellent package:  
> https://godoc.org/gopkg.in/ldap.v2  and use straight LDAP calls both to 
> authenticate against and update AD.  All of our Go based web applications 
> allow our users to authenticate against any of multiple LDAP and AD servers 
> in a "federated fashion", trying the servers with the credentials 
> supplied.  Hope this helps.
>
> cheers,
> Paul
>
> On Saturday, 9 December 2017 14:59:41 UTC-8, snmed wrote:
>>
>> Hi all
>>
>> We are primarly working in a windows environment and developing web 
>> services as well as web applications. At the moment we're using C# as our 
>> main language, but we consider to
>> switch to go for the web services. There is one major uncertainty which 
>> hinders us to proceed with our idea, we using Group Managed Service 
>> Accounts to authenticate applications and 
>> services. Therefore we need to handle windows authentication on server 
>> and client side. 
>>
>> Has anyone a similar use case and has already solved it? Is there a well 
>> documented package which can be used to protect a http.Handler and verify a 
>> user with windows authentication?
>> And is there a package that can be used to authenticate a go client 
>> against a service which is protected with windows authentication.
>>
>> Any help or advise is warmly welcome.
>>
>> Cheers
>>
>

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


[go-nuts] Re: Webservices with Windows Authentication

2017-12-10 Thread snmed
Hi Mike

Thank you for the links, they are looking interesting. I will have a deeper 
look into it and try to build a working example.

Cheers
Sandro

Am Sonntag, 10. Dezember 2017 04:22:43 UTC+1 schrieb ancientlore:
>
> I haven't done it, but these two might be a starting point.
>
> https://github.com/Azure/go-ntlmssp
> https://github.com/ThomsonReutersEikon/go-ntlm 
> 
>
> Mike
>
> On Saturday, December 9, 2017 at 5:59:41 PM UTC-5, snmed wrote:
>>
>> Hi all
>>
>> We are primarly working in a windows environment and developing web 
>> services as well as web applications. At the moment we're using C# as our 
>> main language, but we consider to
>> switch to go for the web services. There is one major uncertainty which 
>> hinders us to proceed with our idea, we using Group Managed Service 
>> Accounts to authenticate applications and 
>> services. Therefore we need to handle windows authentication on server 
>> and client side. 
>>
>> Has anyone a similar use case and has already solved it? Is there a well 
>> documented package which can be used to protect a http.Handler and verify a 
>> user with windows authentication?
>> And is there a package that can be used to authenticate a go client 
>> against a service which is protected with windows authentication.
>>
>> Any help or advise is warmly welcome.
>>
>> Cheers
>>
>

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


Re: [go-nuts] Calling Julia from Go

2017-12-10 Thread Jason E. Aten
Julia ships as a set of libraries and a thin repl prompt executable that 
loads them.

Here is a simple example of calling Julia from Go.

https://github.com/glycerine/golang-embed-julia

On Tuesday, August 22, 2017 at 3:21:25 AM UTC-5, mrec...@gmail.com wrote:
>
> Unfortunately, Julia cannot be compiled to a library. At least not that I 
> am aware of.
>

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


Re: [go-nuts] NullTime in sql package ?

2017-12-10 Thread Rodolfo
I prefer to work with milliseconds, this is suitable in any language,
os and applications.

2017-12-10 17:26 GMT-04:00 Liviu G :
> Does anyone know why we don't have a NullTime like NullString in
> database/sql package ?
> We shouldn't need to copy/paste this code in various projects
> or depend on the driver specific NullTime (for postgres for example), right
> ?
>
> type NullTime struct {
>
> time.Time
>
> Valid bool
>
> }
>
>
> func (this *NullTime) Scan(value interface{}) error {
>
> this.Time, this.Valid = value.(time.Time)
>
> return nil
>
> }
>
>
> func (this NullTime) Value() (driver.Value, error) {
>
> if !this.Valid {
>
> return nil, nil
>
> }
>
> return this.Time, nil
>
> }
>
>
> --
> 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.

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


[go-nuts] Any way to run functions in indepent thread/processes?

2017-12-10 Thread Tamás Gulácsi
goroutines started with the "go" keyword are run on different OS threads. As go 
doesn't have GIL as CPython does, no need for multiprocessing. Though I use it 
for plugins, with hashicorp/go-plugin.

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


Re: [go-nuts] Any way to run functions in independent threads/processes in go?

2017-12-10 Thread Jesse McNelis
On Sun, Dec 10, 2017 at 6:38 PM, shockme  wrote:
> Hi,
>
> I'd like to know if there is any way to run go functions in independent
> threads/process, just like multiprocessing.Pool.apply.
>

Go has goroutines to allow for running code on different threads.
Running a Go function in a different process isn't possible, but it's
also not as useful as running a goroutine.

What is your use case that you need processes?

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


[go-nuts] NullTime in sql package ?

2017-12-10 Thread Liviu G
Does anyone know why we don't have a NullTime like NullString in 
database/sql package ?
We shouldn't need to copy/paste this code in various projects 
or depend on the driver specific NullTime (for postgres for example), right 
? 

type NullTime struct {

time.Time

Valid bool

}


func (this *NullTime) Scan(value interface{}) error {

this.Time, this.Valid = value.(time.Time)

return nil

}


func (this NullTime) Value() (driver.Value, error) {

if !this.Valid {

return nil, nil

}

return this.Time, nil

}


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


[go-nuts] Re: Why are can't struct field types not be used as types

2017-12-10 Thread Kevin Malachowski
Why not name the inner type? https://play.golang.org/p/8hyMLUVbCp

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


[go-nuts] Best way to add retries to existing library using net/http.Client?

2017-12-10 Thread Alex Buchanan
I'm considering adding http client retries to an existing library, owned by 
someone else, in order to add resiliency to errors such as http 503. I'd 
like to keep the changes as minimal as possible, with maximum effect, as 
usual. I'm eyeing http.Client.Transport. Possibly I could use that to wrap 
the DefaultTransport, intercept responses, check the code against some 
rules, and retry on failure.

Am I on the right track here?

Thanks,
Alex 

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