[go-nuts] Re: Mail library supporting Google OAuth for Gmail?

2019-12-27 Thread Shane H
On Saturday, December 28, 2019 at 5:23:27 AM UTC+11, Ignacio Grande wrote: > > Hi! > > I have an application I made a few years ago for a friend which sends > emails using a Gmail account with STMP, using the library > gopkg.in/gomail.v1. Since then I moved on and I'm not familiar with > lates

[go-nuts] Re: Help em if e else em Go

2019-12-27 Thread peterGo
Mazarafa7, That is far too many lines of complicated code: https://pastebin.com/Rr6yvDAt Perform some simple arithmetic: https://play.golang.org/p/d8PD7ELm83_0 Peter On Frid

Re: [go-nuts] Re: net.conn TCP connection

2019-12-27 Thread Robert Engels
The standard read will early return as soon as some of read is satisfied and a subsequent block would occur (or timeout) - so you have to decide when you want to stop reading... >> On Dec 27, 2019, at 9:48 PM, Robert Engels wrote: >  > You need a termination point. In the case of ReadString it

Re: [go-nuts] Re: net.conn TCP connection

2019-12-27 Thread Robert Engels
You need a termination point. In the case of ReadString it is the line terminator. For an arbitrary read it is either a length or EOF - or you can read until the underlying socket has no more data but this is generally useless unless you are doing higher level buffering and protocol parsing. Thi

[go-nuts] Re: net.conn TCP connection

2019-12-27 Thread Ron Wahler
I did look at ReadAll, but it won't return until it sees EOF. I am trying to find something that would return when the standard read would return. I get the memory part and would manage that. Any other ideas ? thanks, Ron On Friday, December 27, 2019 at 5:11:42 PM UTC-7, Ron Wahler wrote: > >

Re: [go-nuts] net.conn TCP connection

2019-12-27 Thread Matthew Zimmerman
https://golang.org/pkg/io/ioutil/#ReadAll That might be what you want but if you don't know how big it's going to be, you're also easily able to run out of memory. On Fri, Dec 27, 2019, 7:11 PM wrote: > I am looking for a net.conn standard read that would return a data buffer > the exact size o

[go-nuts] net.conn TCP connection

2019-12-27 Thread ron . wahler
I am looking for a net.conn standard read that would return a data buffer the exact size of the read. I am trying to read an unknown amount of byte data from the connection. With the read i am using I am required to pre-allocate a buffer and pass that buffer to the read. I am looking for a read

[go-nuts] Help em if e else em Go

2019-12-27 Thread Mazarafa7
Olá, tudo bem ? Poderiam me ajudar na minha lógica, ver o que está errado no meu código. Aliás, estou resolvendo alguns exercícios do *URI Online Judge* em Go, se puderem dar um help, o código fonte está nesta pasta na nuvem. https://pastebin.com/Rr6yvDAt atenciosamente, -- You received thi

[go-nuts] Mail library supporting Google OAuth for Gmail?

2019-12-27 Thread Ignacio Grande
Hi! I have an application I made a few years ago for a friend which sends emails using a Gmail account with STMP, using the library gopkg.in/gomail.v1. Since then I moved on and I'm not familiar with latest changes in Gmail or the library. It seems Google is dropping access for LSA (less secur

Re: [go-nuts] Simple worker pool in golnag

2019-12-27 Thread Bruno Albuquerque
This might be useful too you, in any case: https://git.bug-br.org.br/bga/workerpool On Thu, Dec 26, 2019 at 8:12 PM Amarjeet Anand wrote: > Hi > > I have to produce some task to kafka parallely. So I want to implement a > simple worker group pattern in go. > > Does the below code decent enough

AW: [go-nuts] MarshalJSON() output encrypted json

2019-12-27 Thread Lutz Horn
The string "my custom encryption stuff" is not valid JSON. Why does your type implement MarshalJSON if it does not produce JSON? Lutz Von: Gert Gesendet: ‎27.‎12.‎2019 07:55 An: golang-nuts Betr

Re: [go-nuts] MarshalJSON() output encrypted json

2019-12-27 Thread Dan Kortschak
It depends what you want to get. json.Marshal picks up encoding.TextEncoder and Unmarshal, TextDecoder. It will wrap the marshaled text into a quoted json string and then pull it out again when you deserialise. From the json.Marshal docs ``` If no MarshalJSON method is present but the value implem

Re: [go-nuts] MarshalJSON() output encrypted json

2019-12-27 Thread Gert Cuykens
Ok thanks, I will try that but don't think it will be elegant for turning on and off plain json in a code base, because I have to change every json.Marshal and json.Umarshal On Fri, Dec 27, 2019 at 10:21 AM Dan Kortschak wrote: > > MarshalText? > > On Fri, 2019-12-27 at 09:51 +0100, Gert Cuykens

Re: [go-nuts] MarshalJSON() output encrypted json

2019-12-27 Thread Dan Kortschak
MarshalText? On Fri, 2019-12-27 at 09:51 +0100, Gert Cuykens wrote: > Thanks, Which should I use instead then? The reason I use it is so I > can easily switch between regular json payloads for debugging and > encrypted/signed urlencode payloads > > On Fri, Dec 27, 2019 at 9:39 AM Axel Wagner > w

Re: [go-nuts] MarshalJSON() output encrypted json

2019-12-27 Thread Gert Cuykens
Thanks, Which should I use instead then? The reason I use it is so I can easily switch between regular json payloads for debugging and encrypted/signed urlencode payloads On Fri, Dec 27, 2019 at 9:39 AM Axel Wagner wrote: > > `MarshalJSON` needs to output a valid JSON value, according to the inte

Re: [go-nuts] MarshalJSON() output encrypted json

2019-12-27 Thread 'Axel Wagner' via golang-nuts
`MarshalJSON` needs to output a valid JSON value, according to the interface . If you don't need the result to be valid JSON, then don't use encoding/json. If you want to use JSON to use it as part of a larger value, you could output a JSON string