[go-nuts] Re: Send a mail with a service account using Gmail API

2020-07-27 Thread Vincent Jouglard
..which is working like a charm. Thanks a lot again, Le vendredi 24 juillet 2020 à 22:54:33 UTC+2, Vincent Jouglard a écrit : > Hi John, > > Thanks for your message. > The main difference with my implementation is that I use a service account > which is authorized to send messages on

[go-nuts] Send a mail with a service account using Gmail API

2020-07-24 Thread Vincent Jouglard
Hi John, Thanks for your message. The main difference with my implementation is that I use a service account which is authorized to send messages on my behalf...and I think that this is where lies the problem. As i understand OAuth and the implementation from your exemple, a token is generated

[go-nuts] Send a mail with a service account using Gmail API

2020-07-24 Thread Vincent Jouglard
ption. WithCredentialsFile("credentials.json"), option.WithScopes( "https://mail.google.com/";, "https://www.googleapis.com/auth/gmail.modify";, "https://www.googleapis.com/auth/gmail.compose";, "https://www.googleapis.com/auth/gmail.send";)) if err

Re: [go-nuts] External/internal linker and cgo packages

2020-04-29 Thread Vincent Blanchon
2020 07:52:03 UTC+4, Ian Lance Taylor a écrit : > > On Tue, Apr 28, 2020 at 10:49 PM Vincent Blanchon > > wrote: > > > > I'm building a simple program that has a dependency to > github.com/DataDog/zstd, a wrapper of a C code. > > So by default, Go will u

[go-nuts] External/internal linker and cgo packages

2020-04-28 Thread Vincent Blanchon
Hello, I'm building a simple program that has a dependency to github.com/DataDog/zstd, a wrapper of a C code. So by default, Go will use the external linker. When debugging with, I can see host link: "clang" "-m64" "-Wl,-headerpad,1144" "-Wl,-no_pie" "-Wl,-pagezero_size,400" "-o" "/var/fo

[go-nuts] "Timers rely on the network poller", why is that?

2020-04-17 Thread Vincent Blanchon
Hi everyone, >From what I understand, timers are ran by: - the P holding them - other P if timer-stealing happen (thanks to the async preemption that should not happen often) - sysmon thread that, periodically, check if some timers have to run But, in the comments of the code, I have seen this s

Re: [go-nuts] issue with past-the-end pointer

2020-03-18 Thread Vincent Blanchon
Thank you Ian! Le mercredi 18 mars 2020 23:20:15 UTC+4, Ian Lance Taylor a écrit : > > On Wed, Mar 18, 2020 at 9:33 AM Vincent Blanchon > > wrote: > > > > In this proposal > https://github.com/golang/proposal/blob/master/design/24543-non-cooperative-preemption.md,

[go-nuts] issue with past-the-end pointer

2020-03-18 Thread Vincent Blanchon
Hi all, In this proposal https://github.com/golang/proposal/blob/master/design/24543-non-cooperative-preemption.md, it is mentioned past-the-end pointer and the fact it should be avoided. My assumption is that it could lead to a bad memory tracking/cleaning since the write barriers keep trac

Re: [go-nuts] Re: stringer command and generated String() function

2020-02-18 Thread Vincent Blanchon
Yes, definitely, good point. Both are them are good depending on the case actually. Le mardi 18 février 2020 16:55:02 UTC+4, Jan Mercl a écrit : > > On Tue, Feb 18, 2020 at 1:47 PM Vincent Blanchon > > wrote: > > > However, in real code, I guess we will have that many con

Re: [go-nuts] Re: stringer command and generated String() function

2020-02-18 Thread Vincent Blanchon
With 100 constants: Stringer-4 4.96ns ± 0% StringerWithSwitch-4 4.99ns ± 1% StringerWithMap-4 30.40ns ± 0% The gap between the switch and the current implement is much smaller. I guess it is due to the number of JMP instructions the code has to go through. It confirms that

Re: [go-nuts] Re: stringer command and generated String() function

2020-02-18 Thread Vincent Blanchon
n "Ibuprofen" case 3: return "Paracetamol" default: return "Pill(" + strconv.FormatInt(int64(i), 10) + ")" } } Le mardi 18 février 2020 14:06:14 UTC+4, Jan Mercl a écrit : > > On Tue, Feb 18, 2020 at 10:37 AM Vincent Blanchon > &

[go-nuts] Re: stringer command and generated String() function

2020-02-18 Thread Vincent Blanchon
has not been rerun since. > The const/slice implementation allows for that (useful!) check. > > > Le mardi 18 février 2020 07:42:41 UTC+1, Vincent Blanchon a écrit : >> >> Hello, >> >> I was wondering why the stringer command has been implemented that way: >> &g

[go-nuts] stringer command and generated String() function

2020-02-17 Thread Vincent Blanchon
Hello, I was wondering why the stringer command has been implemented that way: const _Pill_name = "PlaceboAspirinIbuprofen" var _Pill_index = [...]uint8{0, 7, 14, 23} func (i Pill) String() string { if i < 0 || i >= Pill(len(_Pill_index)-1) { return "Pill(" + strconv.FormatInt(int64(i)

Re: [go-nuts] loop & CX register

2020-01-01 Thread Vincent Blanchon
I got it, Thank you Ian! Le jeudi 2 janvier 2020 07:36:39 UTC+4, Ian Lance Taylor a écrit : > > On Wed, Jan 1, 2020 at 7:25 PM Vincent Blanchon > > wrote: > > > > Here is a loop in Go: https://play.golang.org/p/G4wdLi26LZ4 > > With looking at the assembly, I

[go-nuts] loop & CX register

2020-01-01 Thread Vincent Blanchon
Hi, Here is a loop in Go: https://play.golang.org/p/G4wdLi26LZ4 With looking at the assembly, I can see that the loop counter uses *AX* register while the total (t) use *the CX* register: 0x004c 00076 (main.go:7) INCQ AX 0x004f 00079 (main.go:8) ADDQ DX, CX I have a basic knowledge of assembly,

[go-nuts] Re: GOMAXPROCS > num of CPU

2019-12-05 Thread Vincent Blanchon
active thread accounting" is accurate in the OS, I dont see > any reason to set it higher. I think it is easy to test >HWthreads effects > with a concurrent cpu-intensive job. > > On Wednesday, December 4, 2019 at 8:24:13 PM UTC+3, Vincent Blanchon wrote: >> >> Hell

[go-nuts] GOMAXPROCS > num of CPU

2019-12-04 Thread Vincent Blanchon
Hello, I've read on GitHub (https://github.com/golang/go/issues/20303#issuecomment-329418911) "there are good reasons" to set GOMAXPROCS to > num CPU. Just out of curiosity, I want to know if someone has an example of it or any good reason to set it up more than the number of CPUs? Thanks --

[go-nuts] Are M always detached from P when syscall?

2019-11-15 Thread Vincent Blanchon
Hello, I was wondering about the behavior of syscalls. It looks like Go always wraps syscall - whatever blocking or not - with calling entersyscallblock() and exitsyscall() later. The first one automatically detaches M from the P when exit tries to acquire the same P or move the G to the glob

Re: [go-nuts] mcache per P or per M?

2019-11-04 Thread Vincent Blanchon
Thank you, Ian! With the CL it is much more clear now Le mardi 5 novembre 2019 02:27:00 UTC+4, Ian Lance Taylor a écrit : > > On Sat, Nov 2, 2019 at 4:58 AM Vincent Blanchon > > wrote: > > > > Reading the code, I can see the structs m and p hold a mcache ins

[go-nuts] mcache per P or per M?

2019-11-02 Thread Vincent Blanchon
Hello, Reading the code, I can see the structs m and p hold a mcache instance. I'm curious to understand why both of them need an instance of mcache? Also, I see that those instances are the same ones (runtime/proc.go init the p.mcache with m.cache and vice versa), is it correct? Should we cons

[go-nuts] Re: causal profiling in Go

2019-09-30 Thread Vincent Blanchon
That's interesting, thanks for sharing. Also interested to know if someone got results with a similar approach. > -- 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

[go-nuts] garbage collector forced to run every two minutes

2019-09-18 Thread Vincent Blanchon
Hi, I was wondering what problem *gcTriggerTime* is supposed to solve? Why does the language need to force the GC every two minutes if it did not run? Thanks in advance -- You received this message because you are subscribed to the Google Groups "golang-nuts" group. To unsubscribe from this

[go-nuts] CPU profiling with pprof

2019-09-06 Thread Vincent Blanchon
Hi, The documentation of the profiling (https://blog.golang.org/profiling-go-programs) explains that: "Go program stops about 100 times per second". However, in the code, I could see that the collector has a sleep of 100ms https://github.com/golang/go/blob/master/src/runtime/pprof/pprof.go#L779

Re: [go-nuts] Go compiler - syntax tree vs AST?

2019-09-03 Thread Vincent Blanchon
usage of two different syntax tree was a bit confusing. Hope this helps Yes, a lot. Thanks again! Le mardi 3 septembre 2019 17:54:38 UTC+4, Ian Lance Taylor a écrit : > > On Tue, Sep 3, 2019 at 6:23 AM Vincent Blanchon > wrote: > > > > The compiler documentation men

[go-nuts] Go compiler - syntax tree vs AST?

2019-09-03 Thread Vincent Blanchon
Hi all, The compiler documentation mentions a syntax tree in the parsing phase when the AST transformation phase mentions a conversion from the syntax tree to the compiler's AST representation. If I do not misunderstand, the command "*go tool compile -W" *will display the AST. I was wondering

[go-nuts] Why does net/http ProxyFromEnvironment refuse to proxy localhost requests?

2018-08-02 Thread Kekoa Vincent
When using net/http ProxyFromEnvironment to specify proxy using HTTP_PROXY environment variable, there is a special case to prevent use of a proxy when connecting to a localhost or 127.0.0.1 service. Using a debugging proxy with local services is a common practice, and it was surprising to fin

Re: [go-nuts] Re: Weird behavior of a nil check after variable redeclaration

2017-12-22 Thread Vincent Rischmann
Thanks, that explains it. On Fri, Dec 22, 2017, at 6:28 PM, Volker Dobler wrote: > See https://golang.org/doc/faq#nil_error > > V. > > On Friday, 22 December 2017 17:37:40 UTC+1, Vincent Rischmann wrote:>> Hello, >> >> while refactoring some code I encoun

[go-nuts] Weird behavior of a nil check after variable redeclaration

2017-12-22 Thread Vincent Rischmann
Hello, while refactoring some code I encountered something strange regarding redeclarations. Here is an example: https://play.golang.org/p/b7Bp2w2fWwk Somehow after redeclaring err when calling doIt, err is apparently not nil, yet the functions never return anything other than nil. If I use a

[go-nuts] Re: One way - Unexported json field

2017-09-07 Thread Vincent Jouglard
Hi ascarter, This sounds like a great way to do it (even if I don't totally understand how it works, you gave me homework :D ), but, as I understand it, this would'nt work on slices ; i.e. []Player . Or I am mistaken ? Moreover, the regular rule is that the CustomField is not sent and the except

[go-nuts] Re: One way - Unexported json field

2017-09-06 Thread Vincent Jouglard
(player Player) Frontend() Player { > player.CustomField = "" > return player > } > > On Wednesday, 6 September 2017 00:36:56 UTC+3, Vincent Jouglard wrote: >> >> Hi guys, >> >> I would like to have fields in a custom type that : >> - are not

[go-nuts] One way - Unexported json field

2017-09-05 Thread Vincent Jouglard
Hi guys, I would like to have fields in a custom type that : - are not exported when I mashall them (to send to front) - are imported when I decode them (from the from) This is the type : type Player struct { Id bson.ObjectId `json:"id,omitempty" bson:"_id,omitempty"` CustomField stri

[go-nuts] go install does nothing - gives no error messages

2017-03-06 Thread vincent
go installation is fine, works properly for lost of packages But for this one application go install seems to do nothing and gives no warnings/messages or any output at all The packages can be built with build command and produce proper executables. Is the install command running some tests

[go-nuts] redeclaration in runtime/utf8.go after installing Go 1.8 on Windows

2017-02-18 Thread Vincent Rischmann
Hi, I'm on Windows, I had Go 1.7.4 installed from the MSI installer. Today I decided to upgrade to Go 1.8, so I downloaded the new MSI, ran it and that was it. However, first package I tried to install I got the following errors: G:\Gopath\src\github.com\google> go get -u -v github.com/vris

Re: [go-nuts] Re: Explosion in memory usage when compiling a big file

2017-01-09 Thread Vincent Rischmann
Thanks for the responses. I took a look at the generated code and go-bindata does in fact use the form "var _data = []byte(`my giant string`)". But there's something strange happening: I can't reproduce the problem on my Macbook Pro. It compiles just fine here. On Mon, Jan 9, 2017, at 12:5

[go-nuts] Explosion in memory usage when compiling a big file

2017-01-08 Thread Vincent Rischmann
Hi, so I was trying to embed JS and HTML assets in a Go file using go-bindata and ended up with a Go file of 4Mib, and I noticed compiling it consumes all my system's memory. I'm on Windows and using the resource monitor I can see compile.exe memory usage grow to more than 15Gib in a couple of

Re: [go-nuts] Re: Json-ifying map[bson.ObjectId] is not as expected

2016-12-26 Thread Vincent Jouglard
ed to change the > underlying type of bson.ObjectID to [12]byte instead. This would still work > as a map key and would cause json.Marshaller to use the MarshalText method, > giving you the results you were looking for automatically. > > On Thu, Dec 22, 2016 at 8:20 AM Vincent Jou

[go-nuts] Re: Json-ifying map[bson.ObjectId] is not as expected

2016-12-22 Thread Vincent Jouglard
Hi Jon, Thanks for the explanation ; i already used strings as indexes to make this work; but I was wondering if I was doing something wrong :) Still, I wonder if this behavior is wanted and if so, why that ? Regards, -- You received this message because you are subscribed to the Google Group

[go-nuts] Json-ifying map[bson.ObjectId] is not as expected

2016-12-21 Thread Vincent Jouglard
Hi, I am sending a map of elements indexed by a bson.ObjecId(), coming from the bdd. type Stats struct { A bson.ObjectId `json:"a,omitempty" bson:"a,omitempty"` B map[bson.ObjectId]CustomType `json:"b,omitempty" bson:"b,omitempty"` } // t is of type Stats if err = c.Write

Re: [go-nuts] Re: Deleting the /r/golang subreddit

2016-11-25 Thread Vincent Rischmann
> It's a wretched hive of scum and villainy. The Go subreddit was the only > thing similar to human and it is downright painful most of the time. Way to go insulting everyone on Reddit. I'm neither scum or a "villain". I also spend a lot of time on /r/golang and it's nowhere near painful, I have

[go-nuts] Suggestions to hide plaintext password in net/smtp

2016-10-26 Thread vincent . mc . li
anks! Note I don't need military grade security, but secure enough to defer the most attempt to steal the email password Thanks Vincent -- 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: Closures vs structs with embedded functions (I call 'em pseudo-closures)

2016-08-14 Thread Vincent Vetsch
With the struct, the data can be modified outside of the inc() method, ie ps.i++ or ps.i--, ... it is much more flexible than a closure. But if the data is critical, the closure is much more secure, only one function can change the data. I hope this helps. On Friday, August 12, 2016 at 5:14:0