Re: [go-nuts] Do I need to use runtime.KeepAlive in this case?

2019-03-21 Thread Cholerae Hu
Thanks for your response! How does it keep alive for at least the duration of the cgo call? After the pointer is copied and passed to the cgo call, it will become unreachable. After it is swept by GC, pointers point to that part of memory will no longer exist on the Go-managed heap. Do you mea

Re: [go-nuts] Accessing *[]uint64 from assembly - strange memory corruption under heavy load - any ideas?

2019-03-21 Thread Tom
The allocation is in go, and assembly never modifies the size of the backing array. Assembly only ever modifies len, which is the len of the slice and not the backing array. On Thursday, 21 March 2019 22:18:29 UTC-7, Tamás Gulácsi wrote: > > 2019. március 22., péntek 6:06:06 UTC+1 időpontban Tom

Re: [go-nuts] Accessing *[]uint64 from assembly - strange memory corruption under heavy load - any ideas?

2019-03-21 Thread Tamás Gulácsi
2019. március 22., péntek 6:06:06 UTC+1 időpontban Tom a következőt írta: > > Still errors I'm afraid :/ > > On Thursday, 21 March 2019 21:54:59 UTC-7, Ian Lance Taylor wrote: >> >> On Thu, Mar 21, 2019 at 9:39 PM Tom wrote: >> > >> > I've been stuck on this for a few days so thought I would ask

Re: [go-nuts] Accessing *[]uint64 from assembly - strange memory corruption under heavy load - any ideas?

2019-03-21 Thread Tom
Still errors I'm afraid :/ On Thursday, 21 March 2019 21:54:59 UTC-7, Ian Lance Taylor wrote: > > On Thu, Mar 21, 2019 at 9:39 PM Tom > > wrote: > > > > I've been stuck on this for a few days so thought I would ask the brains > trust. > > > > TL;DR: When I have native amd64 instructions muta

Re: [go-nuts] Accessing *[]uint64 from assembly - strange memory corruption under heavy load - any ideas?

2019-03-21 Thread Ian Lance Taylor
On Thu, Mar 21, 2019 at 9:39 PM Tom wrote: > > I've been stuck on this for a few days so thought I would ask the brains > trust. > > TL;DR: When I have native amd64 instructions mutating (updating the len + > values of a []uint64) a slice, I experience spurious & random memory > corruption when

[go-nuts] Accessing *[]uint64 from assembly - strange memory corruption under heavy load - any ideas?

2019-03-21 Thread Tom
I've been stuck on this for a few days so thought I would ask the brains trust. *TL;DR: *When I have native amd64 instructions mutating (updating the len + values of a []uint64) a slice, I experience spurious & random memory corruption when under heavy load (# runnable goroutines > MAXPROCS, do

Re: [go-nuts] boringcrypto+fipsonly: way more strict than fips 140-2?

2019-03-21 Thread Eric Grosse
On Wednesday, March 20, 2019 at 12:07:49 PM UTC-7, ohir wrote: > > Adam Langley is a well recognized expert in the field. I trust in his > decisions. +1 > Validated is exact version of boringcrypto: 24e.d6f5 > It will not lose its validation even if it has a bug. > If it will fix thi

Re: [go-nuts] Have Any One Experience With Print CSS Modules Using in Golang

2019-03-21 Thread Mohamed Yousif
I’m not quite sure but I think you can do this easier using JS. On Thu, 21 Mar 2019 at 5:24 PM, wrote: > I try to make a pdf from my HTML and CSS. In CSS file there have > some Paged Media Models. > https://github.com/SebastiaanKlippert/go-wkhtmltopdf/ I use this library > to generate my pdf but

[go-nuts] a way to query the module sum of a dependency with the go tool?

2019-03-21 Thread Dan Kortschak
Is there a command that does something like `go list -m ` but also outputs the sum for the module and module's go.mod? Other than `grep go.sum`. thanks Dan -- You received this message because you are subscribed to the Google Groups "golang-nuts" group. To unsubscribe from this group and stop

[go-nuts] Re: Launching a windows app from command line with paths in arguments problem

2019-03-21 Thread XXX ZZZ
I just found out that removing "" from arguments seems to be somewhat working, so if we do: {" --user-data-dir=C:\ProfileTest 1", " --load-extension="C:\test", Golang automatically adds the " when running the command, in fact the command line -as per chrome chrome:version- is correct. The e

Re: [go-nuts] Do I need to use runtime.KeepAlive in this case?

2019-03-21 Thread Ian Lance Taylor
On Wed, Mar 20, 2019 at 10:56 PM Cholerae Hu wrote: > > package main > > // void a(long *p) {} > import "C" > > import ( > "unsafe" > ) > > //go:noinline > func b() { > x := int64(0) > C.a((*C.long)(unsafe.Pointer(&x))) > // do something without x > } > > func main() { > b() > } > > x should be co

[go-nuts] Re: Launching a windows app from command line with paths in arguments problem

2019-03-21 Thread Krzysztof Kowalczyk
As a total work-around you can always write start_chrome.bat:: your command to launch chrome. and then from go execute as: "cmd.exe", "/k", "start_chrome.bat" (double-check the "/k", I'm writing from memory). Also, to me the red flag is using -foo="quoted argument".parts. On windows, cmd-line a

Re: [go-nuts] Re: Deferring a close that can fail

2019-03-21 Thread roger peppe
On Thu, 21 Mar 2019 at 16:14, wrote: > Two things to note about this. > > First, if the "everything else" deferred to might include a return > statement, then this could result in the same "silent failure" behavior. > Yup, don't do that :) > Secondly - use this pattern with great caution. It i

[go-nuts] Re: Launching a windows app from command line with paths in arguments problem

2019-03-21 Thread XXX ZZZ
Just tried it out, unfortunately, it keeps having the same error, even if I apply this format to the rest of the arguments El jueves, 21 de marzo de 2019, 13:46:29 (UTC-3), Jake Montgomery escribió: > > It is likely that the spaces before the command line arguments is > confusing the Chrome par

[go-nuts] Re: Launching a windows app from command line with paths in arguments problem

2019-03-21 Thread jake6502
It is likely that the spaces before the command line arguments is confusing the Chrome parser. Try removing them for every item in Args, and it may work. On a style note, I would use: AppCommand:= `C:\Users\User\AppData\Local\Google\Chrome\Application\chrome.exe` instead of: AppCommand:= "C

Re: [go-nuts] Re: Deferring a close that can fail

2019-03-21 Thread jake6502
Two things to note about this. First, if the "everything else" deferred to might include a return statement, then this could result in the same "silent failure" behavior. Secondly - use this pattern with great caution. It is critical to confirm that a double close on ifDB is explicitly allowed

[go-nuts] Launching a windows app from command line with paths in arguments problem

2019-03-21 Thread XXX ZZZ
Hello, I'm trying to launch Chrome from Go under windows, some of the arguments I'm passing have custom paths in it and it seems that go is sanitizing these arguments and not recognizing the paths. Basically it seems to be appending the application path into the arguments with a path. Code is

Re: [go-nuts] Signal SIGSEGV: segmentation violation code=0x1

2019-03-21 Thread Ian Lance Taylor
The first step is certainly to consistently check the error returns of all your system calls. Right now you are ignoring the error returns of your SHMAT calls. Ian On Thu, Mar 21, 2019 at 8:24 AM <615912...@qq.com> wrote: > > Here is my code. > package main > > /* > #include > #include > #incl

[go-nuts] Have Any One Experience With Print CSS Modules Using in Golang

2019-03-21 Thread nafisfaysalos
I try to make a pdf from my HTML and CSS. In CSS file there have some Paged Media Models. https://github.com/SebastiaanKlippert/go-wkhtmltopdf/ I use this library to generate my pdf but the problem is the Print CSS didn't work well. I am searching for some idea and feel free to suggest me if you

Re: [go-nuts] Signal SIGSEGV: segmentation violation code=0x1

2019-03-21 Thread 615912558
Here is my code. package main /* #include #include #include static void memcpy_c(char *dest, int offs1, char *src, int offs2, int cnt) { if (src == 0 || dest == 0) { printf("a null ptr.\n"); return; } int a = 0; long i = 0; memcpy(dest + offs1, src+offs2, cnt); while (1){ if (i >= cnt) { break;

Re: [go-nuts] email body not showing up

2019-03-21 Thread Martin Tournoij
On Thu, 21 Mar 2019 11:56:21 +0530 pradam wrote: > I have implement below code, but body not showing up, so whats wrong > with the code? > > [..] > > _, err = fmt.Fprintf(wc, "This is the email body") > if err != nil { > log.Fatal(err) > } > > [..] You are not sending any header fields; an e

[go-nuts] How to lower listen backlog for tcp socket

2019-03-21 Thread Wangbo
I try to use net.ListenConfig, but fail can someone give example ? -- 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 m

Re: [go-nuts] email body not showing up

2019-03-21 Thread Marvin Renich
* pradam [190321 02:27]: > I have implement below code, but body not showing up, so whats wrong > with the code? IWFM. I only changed the server, sender email and recipient email, and the mail was delivered (without a Subject) with the correct body. You didn't get any errors? You say the body

Re: [go-nuts] Re: I am starting Golang and I am looking for a example to Login, Logout, Signup..

2019-03-21 Thread henriknafo
Thanks On Thursday, March 21, 2019 at 2:12:17 AM UTC-4, Josh Kamau wrote: > > In golang you have to mix and match various libraries. > - For CSRF, I use http://www.gorillatoolkit.org/pkg/csrf > - For password encryption, I use > https://godoc.org/golang.org/x/crypto/bcrypt > > I like using gola

[go-nuts] Re: Deferring a close that can fail

2019-03-21 Thread Manlio Perillo
On Thursday, March 21, 2019 at 10:41:05 AM UTC+1, Amnon Baron Cohen wrote: > > The idiomatic Go way is to write > >defer ifDB.Close() > > Simple is better than clever. > > + Readability does matter. > > Do you think logging the possible error from Close is clever? If you want readability you c

Re: [go-nuts] Re: Deferring a close that can fail

2019-03-21 Thread roger peppe
This issue is why I like having idempotent close. Do: defer ifDB.Close() but also, after everything else is complete, do: if err := ifDB.Close(); err != nil { handle error case } That way if you return early on error your connection is still closed, but you can still write th

[go-nuts] Re: Deferring a close that can fail

2019-03-21 Thread Amnon Baron Cohen
The idiomatic Go way is to write defer ifDB.Close() Simple is better than clever. + Readability does matter. And in situations where you really need to check that the connection was successfully closed, and you have a workable scheme for recovering from this situation, then write a named