[go-nuts] Go runs multiple threads for a serial process

2019-06-26 Thread Subramanian Sridharan
Hi guys

Today while analyzing CPU usage of one of our processes written in go, I 
noticed that there were multiple threads associated with the process which 
is actually serial. (Doesn't make use of goroutines)
I wanted to know if it was the expected behaviour or some issue in our 
service.

So I tested the same with this snippet:
func main() {
for {
}
}


And to my surprise, even this ever running process had multiple threads 
associated with it:

➜  go build everRunningProgram.go
➜  ./everRunningProgram &
[1] 13745
➜  top -b -n 1 -H -p 13745   
top - 15:07:38 up  4:03,  1 user,  load average: 0.63, 0.80, 0.72
Threads:   5 total,   1 running,   4 sleeping,   0 stopped,   0 zombie
%Cpu(s):  4.9 us,  1.1 sy,  0.3 ni, 93.2 id,  0.0 wa,  0.0 hi,  0.5 si,  
0.0 st
KiB Mem : 16301396 total,  4780820 free,  5033472 used,  6487104 buff/cache
KiB Swap:0 total,0 free,0 used. 10270784 avail Mem 

  PID USER  PR  NIVIRTRESSHR S %CPU %MEM TIME+ COMMAND
13745 mani-86+  25   5  101856764584 R 99.9  0.0   0:10.38 
everRunningProg
13746 mani-86+  25   5  101856764584 S  0.0  0.0   0:00.00 
everRunningProg
13747 mani-86+  25   5  101856764584 S  0.0  0.0   0:00.00 
everRunningProg
13748 mani-86+  25   5  101856764584 S  0.0  0.0   0:00.00 
everRunningProg
13749 mani-86+  25   5  101856764584 S  0.0  0.0   0:00.00 
everRunningProg

I tried the same with other programming languages and they didn't seem to 
exhibit this behaviour.

*Rust:*
fn main() {
loop {}
}

➜  rustc everRunningProgram.rs
➜  ./everRunningProgram &
[2] 14265
➜  top -b -n 1 -H -p 14265
top - 15:11:36 up  4:07,  1 user,  load average: 1.59, 1.29, 0.95
Threads:   1 total,   1 running,   0 sleeping,   0 stopped,   0 zombie
%Cpu(s):  4.9 us,  1.1 sy,  0.5 ni, 93.0 id,  0.0 wa,  0.0 hi,  0.5 si,  
0.0 st
KiB Mem : 16301396 total,  4584980 free,  5132508 used,  6583908 buff/cache
KiB Swap:0 total,0 free,0 used. 10111372 avail Mem 

  PID USER  PR  NIVIRTRESSHR S %CPU %MEM TIME+ COMMAND
14265 mani-86+  25   5   13156980868 R 99.9  0.0   0:10.22 
everRunningProg

*C:*
int main() {
while(1);
}

➜  cc everRunningProgram.c 
➜  ./a.out & 
[3] 14413
➜  top -b -n 1 -H -p 14413
top - 15:14:34 up  4:10,  1 user,  load average: 2.43, 1.81, 1.22
Threads:   1 total,   1 running,   0 sleeping,   0 stopped,   0 zombie
%Cpu(s):  4.8 us,  1.1 sy,  0.8 ni, 92.7 id,  0.0 wa,  0.0 hi,  0.5 si,  
0.0 st
KiB Mem : 16301396 total,  4603696 free,  5098020 used,  6599680 buff/cache
KiB Swap:0 total,0 free,0 used. 10134048 avail Mem 

  PID USER  PR  NIVIRTRESSHR S %CPU %MEM TIME+ COMMAND
14413 mani-86+  25   54380712648 R 99.9  0.0   0:06.07 a.out

*Python:*
while True:
pass

➜  scripts python3 everRunningProgram.py &
[4] 14587
➜  scripts top -b -n 1 -H -p 14587
top - 15:16:35 up  4:12,  1 user,  load average: 4.08, 2.62, 1.59
Threads:   1 total,   1 running,   0 sleeping,   0 stopped,   0 zombie
%Cpu(s):  4.8 us,  1.1 sy,  1.1 ni, 92.5 id,  0.0 wa,  0.0 hi,  0.5 si,  
0.0 st
KiB Mem : 16301396 total,  4551664 free,  5146576 used,  6603156 buff/cache
KiB Swap:0 total,0 free,0 used. 10082516 avail Mem 

  PID USER  PR  NIVIRTRESSHR S %CPU %MEM TIME+ COMMAND
14587 mani-86+  25   5   33056   8736   5472 R 99.9  0.1   0:06.63 python3


Is there any explanation for this behaviour on Go?
What's really happening behind the scenes?

-- 
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.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/golang-nuts/a15cf939-02cb-4c51-af20-f0109ffe63df%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Re: [go-nuts] [cgo ] Export go function to C - illegal character

2019-06-26 Thread Amnon Baron Cohen
https://docs.microsoft.com/en-us/cpp/build/reference/decorated-names?view=vs-2019

-- 
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.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/golang-nuts/37617315-b60c-4a54-80ed-8c392d238e4f%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Re: [go-nuts] Go runs multiple threads for a serial process

2019-06-26 Thread Robert Engels
The Go runtime has several threads, for GC, scheduler, etc. 

> On Jun 26, 2019, at 4:48 AM, Subramanian Sridharan  
> wrote:
> 
> Hi guys
> 
> Today while analyzing CPU usage of one of our processes written in go, I 
> noticed that there were multiple threads associated with the process which is 
> actually serial. (Doesn't make use of goroutines)
> I wanted to know if it was the expected behaviour or some issue in our 
> service.
> 
> So I tested the same with this snippet:
> func main() {
> for {
> }
> }
> 
> 
> And to my surprise, even this ever running process had multiple threads 
> associated with it:
> 
> ➜  go build everRunningProgram.go
> ➜  ./everRunningProgram &
> [1] 13745
> ➜  top -b -n 1 -H -p 13745   
> top - 15:07:38 up  4:03,  1 user,  load average: 0.63, 0.80, 0.72
> Threads:   5 total,   1 running,   4 sleeping,   0 stopped,   0 zombie
> %Cpu(s):  4.9 us,  1.1 sy,  0.3 ni, 93.2 id,  0.0 wa,  0.0 hi,  0.5 si,  0.0 
> st
> KiB Mem : 16301396 total,  4780820 free,  5033472 used,  6487104 buff/cache
> KiB Swap:0 total,0 free,0 used. 10270784 avail Mem 
> 
>   PID USER  PR  NIVIRTRESSHR S %CPU %MEM TIME+ COMMAND
> 13745 mani-86+  25   5  101856764584 R 99.9  0.0   0:10.38 
> everRunningProg
> 13746 mani-86+  25   5  101856764584 S  0.0  0.0   0:00.00 
> everRunningProg
> 13747 mani-86+  25   5  101856764584 S  0.0  0.0   0:00.00 
> everRunningProg
> 13748 mani-86+  25   5  101856764584 S  0.0  0.0   0:00.00 
> everRunningProg
> 13749 mani-86+  25   5  101856764584 S  0.0  0.0   0:00.00 
> everRunningProg
> 
> I tried the same with other programming languages and they didn't seem to 
> exhibit this behaviour.
> 
> Rust:
> fn main() {
>   loop {}
> }
> 
> ➜  rustc everRunningProgram.rs
> ➜  ./everRunningProgram &
> [2] 14265
> ➜  top -b -n 1 -H -p 14265
> top - 15:11:36 up  4:07,  1 user,  load average: 1.59, 1.29, 0.95
> Threads:   1 total,   1 running,   0 sleeping,   0 stopped,   0 zombie
> %Cpu(s):  4.9 us,  1.1 sy,  0.5 ni, 93.0 id,  0.0 wa,  0.0 hi,  0.5 si,  0.0 
> st
> KiB Mem : 16301396 total,  4584980 free,  5132508 used,  6583908 buff/cache
> KiB Swap:0 total,0 free,0 used. 10111372 avail Mem 
> 
>   PID USER  PR  NIVIRTRESSHR S %CPU %MEM TIME+ COMMAND
> 14265 mani-86+  25   5   13156980868 R 99.9  0.0   0:10.22 
> everRunningProg
> 
> C:
> int main() {
>   while(1);
> }
> 
> ➜  cc everRunningProgram.c 
> ➜  ./a.out & 
> [3] 14413
> ➜  top -b -n 1 -H -p 14413
> top - 15:14:34 up  4:10,  1 user,  load average: 2.43, 1.81, 1.22
> Threads:   1 total,   1 running,   0 sleeping,   0 stopped,   0 zombie
> %Cpu(s):  4.8 us,  1.1 sy,  0.8 ni, 92.7 id,  0.0 wa,  0.0 hi,  0.5 si,  0.0 
> st
> KiB Mem : 16301396 total,  4603696 free,  5098020 used,  6599680 buff/cache
> KiB Swap:0 total,0 free,0 used. 10134048 avail Mem 
> 
>   PID USER  PR  NIVIRTRESSHR S %CPU %MEM TIME+ COMMAND
> 14413 mani-86+  25   54380712648 R 99.9  0.0   0:06.07 a.out
> 
> Python:
> while True:
> pass
> 
> ➜  scripts python3 everRunningProgram.py &
> [4] 14587
> ➜  scripts top -b -n 1 -H -p 14587   
> top - 15:16:35 up  4:12,  1 user,  load average: 4.08, 2.62, 1.59
> Threads:   1 total,   1 running,   0 sleeping,   0 stopped,   0 zombie
> %Cpu(s):  4.8 us,  1.1 sy,  1.1 ni, 92.5 id,  0.0 wa,  0.0 hi,  0.5 si,  0.0 
> st
> KiB Mem : 16301396 total,  4551664 free,  5146576 used,  6603156 buff/cache
> KiB Swap:0 total,0 free,0 used. 10082516 avail Mem 
> 
>   PID USER  PR  NIVIRTRESSHR S %CPU %MEM TIME+ COMMAND
> 14587 mani-86+  25   5   33056   8736   5472 R 99.9  0.1   0:06.63 python3
> 
> 
> Is there any explanation for this behaviour on Go?
> What's really happening behind the scenes?
> 
> -- 
> 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.
> To view this discussion on the web visit 
> https://groups.google.com/d/msgid/golang-nuts/a15cf939-02cb-4c51-af20-f0109ffe63df%40googlegroups.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.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/golang-nuts/8CEACBA6-925B-459D-8F2C-32ACAFE85DB6%40ix.netcom.com.
For more options, visit https://groups.google.com/d/optout.


[go-nuts] How go-mysql-driver get data? "get all data at a time" or "only get a batch when we call rows.Next"?

2019-06-26 Thread 杜沁园
When we operate with mysql with Go, as follow:


rows, err := db.Query()

for rows.Next() {
.
}


When the driver get data? 

Get all data at once when we call `Query`???

Or only get a batch of Data when we call `Next`, and get next batch of data 
when we run out of it

-- 
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.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/golang-nuts/f55712f4-a29e-42b8-84cf-0b39b1d0b32f%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Re: [go-nuts] How go-mysql-driver get data? "get all data at a time" or "only get a batch when we call rows.Next"?

2019-06-26 Thread Henrik Johansson
I am pretty sure it's the latter case with lazy loading when needed during
the Next() call.

On Wed, Jun 26, 2019 at 2:59 PM 杜沁园  wrote:

> When we operate with mysql with Go, as follow:
>
>
> rows, err := db.Query()
>
> for rows.Next() {
> .
> }
>
>
> When the driver get data?
>
> Get all data at once when we call `Query`???
>
> Or only get a batch of Data when we call `Next`, and get next batch of
> data when we run out of it
>
> --
> 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.
> To view this discussion on the web visit
> https://groups.google.com/d/msgid/golang-nuts/f55712f4-a29e-42b8-84cf-0b39b1d0b32f%40googlegroups.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.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/golang-nuts/CAKOF697ZCj80uV39izsjeJpx1oRg%2BGv_YXJO4avaktdjxPFK0w%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.


Re: [go-nuts] [cgo ] Export go function to C - illegal character

2019-06-26 Thread nicolas_boiteux via golang-nuts
i have some news.

With this kind of declaration
extern void __fastcall RVExtension(char *output, int outputSize, const char 
*function){
goRVExtension(output, outputSize, function);
}; 

// export goRVExtension
func goRVExtension(output *C.char, outputsize C.size_t, input *C.char) {
temp := fmt.Sprintf("Hello %s!", C.GoString(input))
// Return a result to Arma
result := C.CString(temp)
defer C.free(unsafe.Pointer(result))
var size = C.strlen(result) + 1
if size > outputsize {
size = outputsize
}
C.memmove(unsafe.Pointer(output), unsafe.Pointer(result), size)
}


i have this error message during the build

go : # command-line-arguments
Au caractère Ligne:1 : 1
+ go build -o armago.dll -buildmode=c-shared armago.go 2> result.txt
+ ~~
+ CategoryInfo  : NotSpecified: (# 
command-line-arguments:String) [], RemoteException
+ FullyQualifiedErrorId : NativeCommandError
 
C:\Users\code34\AppData\Local\Temp\go-build126339458\b001\_x002.o: In 
function `*@RVExtension@12':*
C:/Users/code34/go/src/github.com/code34/armago_x64/armago.go:8: multiple 
definition of `@RVExtension@12'
C:\Users\code34\AppData\Local\Temp\go-build126339458\b001\_x001.o:/tmp/go-build/armago.go:8:
 
first defined here
C:\Users\code34\AppData\Local\Temp\go-build126339458\b001\_x001.o: In 
function `@RVExtension@12':
/tmp/go-build/armago.go:9: undefined reference to `goRVExtension'
C:\Users\code34\AppData\Local\Temp\go-build126339458\b001\_x002.o: In 
function `@RVExtension@12':
C:/Users/code34/go/src/github.com/code34/armago_x64/armago.go:9: undefined 
reference to `goRVExtension'
collect2.exe: error: ld returned 1 exit status

# command-line-arguments
In file included from _cgo_export.c:4:0:
armago.go: In function 'RVExtension':
armago.go:9:2: warning: implicit declaration of function 'goRVExtension' [-
Wimplicit-function-declaration]
# command-line-arguments
.\armago.go: In function 'RVExtension':
.\armago.go:9:2: warning: implicit declaration of function 'goRVExtension' 
[-Wimplicit-function-declaration]
  goRVExtension(output, outputSize, function);
  ^

as you can see in error message this time the entry point is correctly 
identified as* @RVExtension@12* (but without underscore) , but i don't 
succeed to resolv the bug :(


-- 
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.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/golang-nuts/3986bafb-9f05-4b8d-a7e1-29caa771a926%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


[go-nuts] Why is the size of the official website release version so different from the size I built from the source code?

2019-06-26 Thread xuanjiazhen
Taking the arm64 as an example. 
The bin/go size I built from source code is about 14M, but the official 
website one has 20M.
How is the Go release build ?I didn‘t find any information about this. 

-- 
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.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/golang-nuts/270d868f-9f2a-43e4-806d-b98d76c853ff%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Re: [go-nuts] [cgo ] Export go function to C - illegal character

2019-06-26 Thread Marvin Renich
* nicolas_boiteux via golang-nuts  [190626 12:15]:
> i have some news.
> 
> With this kind of declaration
> extern void __fastcall RVExtension(char *output, int outputSize, const char 
> *function){
> goRVExtension(output, outputSize, function);
> }; 

> as you can see in error message this time the entry point is correctly 
> identified as* @RVExtension@12* (but without underscore) , but i don't 
> succeed to resolv the bug :(

My original message (and the link I included) identified leading
underscore and trailing @ and number as being __stdcall, not __fastcall.
Try using __stdcall instead of __fastcall.

Note that the @RVExtension@12 above has a leading @ instead of _.

...Marvin

-- 
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.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/golang-nuts/20190626165007.4vssb3ttwj2s3dgn%40basil.wdw.
For more options, visit https://groups.google.com/d/optout.


Re: [go-nuts] [cgo ] Export go function to C - illegal character

2019-06-26 Thread nicolas_boiteux via golang-nuts
/*
#include 
#include 
#include 
extern void __stdcall RVExtension(char *output, int outputSize, const char 
*function);
*/

//export RVExtensionVersion
func RVExtensionVersion(output *C.char, outputsize C.size_t) {
result := C.CString("Version 1.0")
defer C.free(unsafe.Pointer(result))
var size = C.strlen(result) + 1
if size > outputsize {
size = outputsize
}
C.memmove(unsafe.Pointer(output), unsafe.Pointer(result), size)
}


with this code ? it compiled but the entry point is not visible via dumpbin


Le mercredi 26 juin 2019 18:50:56 UTC+2, Marvin Renich a écrit :
>
> * nicolas_boiteux via golang-nuts > 
> [190626 12:15]: 
> > i have some news. 
> > 
> > With this kind of declaration 
> > extern void __fastcall RVExtension(char *output, int outputSize, const 
> char 
> > *function){ 
> > goRVExtension(output, outputSize, function); 
> > }; 
>
> > as you can see in error message this time the entry point is correctly 
> > identified as* @RVExtension@12* (but without underscore) , but i don't 
> > succeed to resolv the bug :( 
>
> My original message (and the link I included) identified leading 
> underscore and trailing @ and number as being __stdcall, not __fastcall. 
> Try using __stdcall instead of __fastcall. 
>
> Note that the @RVExtension@12 above has a leading @ instead of _. 
>
> ...Marvin 
>
>

-- 
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.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/golang-nuts/b4135121-4a95-4b7a-80a0-e6cde4518d3d%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Re: [go-nuts] [ANN] Simple DNS Server implemented in Go

2019-06-26 Thread Daniel Lorch
Hi Matt

I was not aware of this, thank you! I added a note in my repository.

Daniel

On Wednesday, June 26, 2019 at 2:54:39 AM UTC+2, Matt Harden wrote:
>
> I realize this is a learning exercise for you, but in case you're 
> interested, the DNS message types are implemented for you in 
> https://godoc.org/golang.org/x/net/dns/dnsmessage.
>
> On Tue, Jun 25, 2019 at 1:36 PM Eric S. Raymond  > wrote:
>
>> Daniel Lorch >:
>> > I have implemented a simple authoritative DNS Server in Go. You can 
>> find it 
>> > here: https://github.com/dlorch/dnsserver/
>> > 
>> > It's a study project to teach myself Go and DNS.
>>
>> Haven't looked at it yet, but I must say I think you just nailed one
>> of the ideal use cases for Go.  Provable buffer overrun protection is
>> especially desirable in this kind of service, and the language
>> libraries undoubtedly make for a small, clean, exceptionally auditable
>> implementation. Good on you.
>> -- 
>> http://www.catb.org/~esr/";>Eric S. Raymond
>>
>>
>> -- 
>> 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 golan...@googlegroups.com .
>> To view this discussion on the web visit 
>> https://groups.google.com/d/msgid/golang-nuts/20190625203542.GB118392%40thyrsus.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.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/golang-nuts/8314db10-1261-4b79-8925-896d4aa938a7%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Re: Re: [go-nuts] How go-mysql-driver get data? "get all data at a time" or "only get a batch when we call rows.Next"?

2019-06-26 Thread sa517067
Get all data in the first Next() call? or only get a batch?

At2019-06-26 21:19:07,Henrik Johanssondahankzter@gmail.comwrote:

I am pretty sure it's the latter case with lazy loading when needed during the 
Next() call.



On Wed, Jun 26, 2019 at 2:59 PM 杜沁园  wrote:

When we operate with mysql with Go, as follow:




rows, err := db.Query()


for rows.Next() {
.
}




When the driver get data? 


Get all data at once when we call `Query`???


Or only get a batch of Data when we call `Next`, and get next batch of data 
when we run out of it

--
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.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/golang-nuts/f55712f4-a29e-42b8-84cf-0b39b1d0b32f%40googlegroups.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.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/golang-nuts/CAKOF697ZCj80uV39izsjeJpx1oRg%2BGv_YXJO4avaktdjxPFK0w%40mail.gmail.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.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/golang-nuts/2b180f8f.1bacb.16b94f540b6.Coremail.sa517067%40mail.ustc.edu.cn.
For more options, visit https://groups.google.com/d/optout.


Re: Re: [go-nuts] How go-mysql-driver get data? "get all data at a time" or "only get a batch when we call rows.Next"?

2019-06-26 Thread Marcin Romaszewicz
No, it doesn't get all the data in the Next() call, it streams it
incrementally from the DB. I've used it to stream gigabytes before, and
they certainly didn't get buffered in RAM.

On Wed, Jun 26, 2019 at 11:04 AM  wrote:

> Get all data in the first Next() call? or only get a batch?
>
> At2019-06-26 21:19:07,Henrik Johanssondahankzter@gmail.comwrote:
>
> I am pretty sure it's the latter case with lazy loading when needed during
> the Next() call.
>
> On Wed, Jun 26, 2019 at 2:59 PM 杜沁园  wrote:
>
>> When we operate with mysql with Go, as follow:
>>
>>
>> rows, err := db.Query()
>>
>> for rows.Next() {
>> .
>> }
>>
>>
>> When the driver get data?
>>
>> Get all data at once when we call `Query`???
>>
>> Or only get a batch of Data when we call `Next`, and get next batch of
>> data when we run out of it
>>
>> --
>> 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.
>> To view this discussion on the web visit
>> https://groups.google.com/d/msgid/golang-nuts/f55712f4-a29e-42b8-84cf-0b39b1d0b32f%40googlegroups.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.
> To view this discussion on the web visit
> https://groups.google.com/d/msgid/golang-nuts/CAKOF697ZCj80uV39izsjeJpx1oRg%2BGv_YXJO4avaktdjxPFK0w%40mail.gmail.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.
> To view this discussion on the web visit
> https://groups.google.com/d/msgid/golang-nuts/2b180f8f.1bacb.16b94f540b6.Coremail.sa517067%40mail.ustc.edu.cn
> 
> .
> 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.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/golang-nuts/CA%2Bv29LuR0u1bjUKy2%3D%2BcbRcmYWh%3DFzZAdw1oNTy52d760wAPhQ%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.


Re: [go-nuts] [cgo ] Export go function to C - illegal character

2019-06-26 Thread Marvin Renich
* nicolas_boiteux via golang-nuts  [190626 13:19]:
> /*
> #include 
> #include 
> #include 
> extern void __stdcall RVExtension(char *output, int outputSize, const char 
> *function);
> */
> 
> //export RVExtensionVersion
> func RVExtensionVersion(output *C.char, outputsize C.size_t) {
> result := C.CString("Version 1.0")
> defer C.free(unsafe.Pointer(result))
> var size = C.strlen(result) + 1
> if size > outputsize {
> size = outputsize
> }
> C.memmove(unsafe.Pointer(output), unsafe.Pointer(result), size)
> }
> 
> 
> with this code ? it compiled but the entry point is not visible via dumpbin

Does the declaration of RVExtension in the .c file match the cgo
declaration above (i.e. with extern and __stdcall)?

...Marvin

-- 
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.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/golang-nuts/20190626181033.4atnukcbsv6vwvdy%40basil.wdw.
For more options, visit https://groups.google.com/d/optout.


[go-nuts] Go 1.13 Beta 1 is released

2019-06-26 Thread Andrew Bonventre
Hello gophers,

We have just released go1.13beta1, a beta version of Go 1.13.
It is cut from the master branch at the revision tagged go1.13beta1.

Please try your production load tests and unit tests with the new version.
Your help testing these pre-release versions is invaluable.

Report any problems using the issue tracker:
https://golang.org/issue/new

If you have Go installed already, the easiest way to try go1.13beta1
is by using the go command:
$ go get golang.org/dl/go1.13beta1
$ go1.13beta1 download

You can download binary and source distributions from the usual place:
https://golang.org/dl/#go1.13beta1

To find out what has changed in Go 1.13, read the draft release notes:
https://tip.golang.org/doc/go1.13

Cheers,
The Go Team

-- 
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.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/golang-nuts/CAFPZzeSxHRNbDUfcUm3yS1OYM_ujUL3EGg8xZTP2RJTd6Ly_Sg%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.


Re: [go-nuts] Why is the size of the official website release version so different from the size I built from the source code?

2019-06-26 Thread Ian Lance Taylor
On Wed, Jun 26, 2019 at 9:21 AM  wrote:
>
> Taking the arm64 as an example.
> The bin/go size I built from source code is about 14M, but the official 
> website one has 20M.
> How is the Go release build ?I didn‘t find any information about this.

I don't know why they would be different sizes.  Are you sure you are
comparing identical versions?

Release are built using golang.org/x/build/cmd/release.

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.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/golang-nuts/CAOyqgcX3G1sBMkD%3DrsQ%2Bt1L%2BD3rQb9brforYDFVArCHdT%2B9a_A%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.


Re: [go-nuts] [cgo ] Export go function to C - illegal character

2019-06-26 Thread nicolas_boiteux via golang-nuts
Marvin, i just publish the last version of my files on git:

can you please check them, and say me if the declaration/definition are ok 
? I m not familiar with this cross langage compilation context/

https://github.com/code34/armago_x64/tree/32bits

Le mercredi 26 juin 2019 20:10:55 UTC+2, Marvin Renich a écrit :
>
> * nicolas_boiteux via golang-nuts > 
> [190626 13:19]: 
> > /* 
> > #include  
> > #include  
> > #include  
> > extern void __stdcall RVExtension(char *output, int outputSize, const 
> char 
> > *function); 
> > */ 
> > 
> > //export RVExtensionVersion 
> > func RVExtensionVersion(output *C.char, outputsize C.size_t) { 
> > result := C.CString("Version 1.0") 
> > defer C.free(unsafe.Pointer(result)) 
> > var size = C.strlen(result) + 1 
> > if size > outputsize { 
> > size = outputsize 
> > } 
> > C.memmove(unsafe.Pointer(output), unsafe.Pointer(result), size) 
> > } 
> > 
> > 
> > with this code ? it compiled but the entry point is not visible via 
> dumpbin 
>
> Does the declaration of RVExtension in the .c file match the cgo 
> declaration above (i.e. with extern and __stdcall)? 
>
> ...Marvin 
>
>

-- 
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.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/golang-nuts/c7c2d31e-785e-4337-a8a2-bd28338594f0%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Re: [go-nuts] The Seven Finest Go Books (to popularize and 'socialize' Go).

2019-06-26 Thread Akram Ahmad
Michael, I'm delighted to read your gracious and thoughtful response. These 
ideas make me want to revisit and perhaps revise into a brand new write-up 
(all over again) something I had written 

 
a while ago!

On Friday, June 21, 2019 at 10:12:21 AM UTC-5, Michael Jones wrote:
>
> Agree about Lisp (and in same way, Forth and J etc.). About the book I 
> recommended, it is a missionary book; one of the Bell Labs diaspora on the 
> topic of why people like UNIX so much, what's not so obvious about 
> programming (that it is really about people more than machines), and a 
> point of view by Rob on things like simplicity, testing, and other "above 
> the language level" topics. I don't want to give it all away, but if the 
> people who were in anyway associated with this book had formed a "gang" and 
> written a language to implement the ideas...
>
> On Fri, Jun 21, 2019 at 7:01 AM Akram Ahmad  > wrote:
>
>> While I've heard great things about Pike and Kernighan’s *The Practice 
>> of Programming*, that is one book I have not got around to picking up; 
>> clearly, you think highly of it, so I'm going to check it out, thanks for 
>> the pointer! Does it address some of the same areas as, say, *The 
>> Pragmatic Programmer: From Journeyman to Master* by Andy Hunt and Dave 
>> Thomas and/or *The Art Of UNIX Programming: The Cathedral and the Bazaar* 
>> by Eric Raymond? 
>>
>> Speaking of the amazing programmer that Eric Raymond is, he has made an 
>> observation of which I'm reminded by your thoughtful comment. Thus, and as 
>> I had mentioned many moons ago in my Clojure write-up 
>> , 
>> he has pointedly noted that "*Lisp is worth learning for the profound 
>> enlightenment experience you will have when you finally get it; that 
>> experience will make you a better programmer for the rest of your days, 
>> even if you never actually use Lisp itself a lot.*"
>>
>>  ~Akram
>>
>> On Thursday, June 20, 2019 at 6:12:51 PM UTC-5, Michael Jones wrote:
>>>
>>> There is a marvelous book that is about Go in a magical way...it 
>>> explains and teaches Go’s personality and attitude...from before Go was 
>>> born. Read Rob Pike and Brian Kernighan’s “The Practice of Programming.” 
>>> After reading it carefully you will understand Go in a deeper way than 
>>> would otherwise be possible. If you have a detective-like personally, study 
>>> the author’s credits for who advised them. You’ll think it was the “most 
>>> frequent poster ranking” for this mailing list... even though this all 
>>> happened beforehand. 
>>>
>>> You’ll also become a better programmer. Truly. 
>>>
>>> On Thu, Jun 20, 2019 at 9:55 AM Aman Alam  wrote:
>>>
 Hi Rog,

 Are there any plans to make this book available for Kindle, or in PDF, 
 please?

 Regards,
 Aman

 On Friday, February 22, 2019 at 4:29:29 AM UTC-5, rog wrote:
>
> You might want to take a look at Manning's "Get Programming With Go" 
> too; it's aimed mostly at more inexperienced programmers.
>
> https://www.amazon.com/Get-Programming-Go-Nathan-Youngman/dp/1617293091
>
> (disclosure: I'm one of the authors :])
>
>
> On Thu, 21 Feb 2019 at 23:02, Akram Ahmad  wrote:
>
>>
>>- The amazing language that golang surely is, and how 
>>refreshingly (and elegantly) simple a language golang is—take this 
>> from 
>>someone coming from extensive experience in Java and Scala, two 
>> language 
>>which well-deservedly have a lot going for them—I think we need to do 
>>*more* to popularize (and 'socialize') the promise of golang to 
>>the larger community of programmers. 
>>- To that end, I put together and recently posted a (fairly) 
>>detailed blog post: *Best Go Programming Books (2019) 
>>
>> *
>>.
>>- Earlier posts (at least on golang) include the following two: *The 
>>Go Programming Language 
>>
>> *
>>  
>>and *Further Adventures In Go Land 
>>
>> *
>>.
>>
>> Go golang!
>>
>> Warm Regards to fellow gophers, hibernating or otherwise :)
>>
>>  ~Akram 
>>
>> -- 
>> 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 golan...@googlegroups.com.
>> For more options, visit https://groups.google.com/d/optout.
>>
> -- 
 You received this message because you are 

[go-nuts] go build src code of `go doc`

2019-06-26 Thread Gert
Hmm trying to work on the src code of `go doc` but every time I try to 
compile a ./doc binary it uses other src code, it doesn't look in the 
current directory am in, I have to force it `go build main.go` what going 
on here? 

gert@gert ~/Desktop/go/src/cmd/doc:master> go build

gert@gert ~/Desktop/go/src/cmd/doc:master> ls
dirs.go doc doc_test.go main.go pkg.go  
testdata

I can see a doc binary getting created but its not build form the main.go 
in current directory, I deliberately put a syntax error in main?

gert@gert ~/Desktop/go/src/cmd/doc:master> go build main.go 
# command-line-arguments
./main.go:78:2: syntax error: unexpected --, expecting }

gert@gert ~/Desktop/go/src/cmd/doc:master> go env
GOARCH="amd64"
GOBIN="/Users/gert/bin"
GOCACHE="/Users/gert/Library/Caches/go-build"
GOEXE=""
GOFLAGS=""
GOHOSTARCH="amd64"
GOHOSTOS="darwin"
GOOS="darwin"
GOPATH="/Users/gert/go"
GOPROXY=""
GORACE=""
GOROOT="/usr/local/go"
GOTMPDIR=""
GOTOOLDIR="/usr/local/go/pkg/tool/darwin_amd64"
GCCGO="gccgo"
CC="clang"
CXX="clang++"
CGO_ENABLED="1"
GOMOD="/Users/gert/Desktop/go/src/cmd/go.mod"
CGO_CFLAGS="-g -O2"
CGO_CPPFLAGS=""
CGO_CXXFLAGS="-g -O2"
CGO_FFLAGS="-g -O2"
CGO_LDFLAGS="-g -O2"
PKG_CONFIG="pkg-config"
GOGCCFLAGS="-fPIC -m64 -pthread -fno-caret-diagnostics -Qunused-arguments 
-fmessage-length=0 
-fdebug-prefix-map=/var/folders/dv/8tlwvjr91zjdyq4rk14lkkfmgn/T/go-build645754300=/tmp/go-build
 
-gno-record-gcc-switches -fno-common"



-- 
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.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/golang-nuts/4c3e47ca-f73d-4593-ba36-d0974ad36239%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Re: [go-nuts] go build src code of `go doc`

2019-06-26 Thread Ian Lance Taylor
On Wed, Jun 26, 2019 at 1:39 PM Gert  wrote:
>
> Hmm trying to work on the src code of `go doc` but every time I try to 
> compile a ./doc binary it uses other src code, it doesn't look in the current 
> directory am in, I have to force it `go build main.go` what going on here?
>
> gert@gert ~/Desktop/go/src/cmd/doc:master> go build
>
> gert@gert ~/Desktop/go/src/cmd/doc:master> ls
> dirs.go doc doc_test.go main.go pkg.go
>   testdata
>
> I can see a doc binary getting created but its not build form the main.go in 
> current directory, I deliberately put a syntax error in main?
>
> gert@gert ~/Desktop/go/src/cmd/doc:master> go build main.go
> # command-line-arguments
> ./main.go:78:2: syntax error: unexpected --, expecting }
>
> gert@gert ~/Desktop/go/src/cmd/doc:master> go env
> GOARCH="amd64"
> GOBIN="/Users/gert/bin"
> GOCACHE="/Users/gert/Library/Caches/go-build"
> GOEXE=""
> GOFLAGS=""
> GOHOSTARCH="amd64"
> GOHOSTOS="darwin"
> GOOS="darwin"
> GOPATH="/Users/gert/go"
> GOPROXY=""
> GORACE=""
> GOROOT="/usr/local/go"
> GOTMPDIR=""
> GOTOOLDIR="/usr/local/go/pkg/tool/darwin_amd64"
> GCCGO="gccgo"
> CC="clang"
> CXX="clang++"
> CGO_ENABLED="1"
> GOMOD="/Users/gert/Desktop/go/src/cmd/go.mod"
> CGO_CFLAGS="-g -O2"
> CGO_CPPFLAGS=""
> CGO_CXXFLAGS="-g -O2"
> CGO_FFLAGS="-g -O2"
> CGO_LDFLAGS="-g -O2"
> PKG_CONFIG="pkg-config"
> GOGCCFLAGS="-fPIC -m64 -pthread -fno-caret-diagnostics -Qunused-arguments 
> -fmessage-length=0 
> -fdebug-prefix-map=/var/folders/dv/8tlwvjr91zjdyq4rk14lkkfmgn/T/go-build645754300=/tmp/go-build
>  -gno-record-gcc-switches -fno-common"


This may be related to https://golang.org/issue/32724.  Is your
cmd/doc directory underneath the directory displayed by `go env
GOROOT`?

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.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/golang-nuts/CAOyqgcU6zGmfS3n9_vdH2fFF%3DYp4zWgZzmF_zwjCQx-MiKdnLA%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.


Re: [go-nuts] go build src code of `go doc`

2019-06-26 Thread Gert
On Thursday, June 27, 2019 at 12:11:58 AM UTC+2, Ian Lance Taylor wrote:
>
> On Wed, Jun 26, 2019 at 1:39 PM Gert > 
> wrote: 
> > 
> > Hmm trying to work on the src code of `go doc` but every time I try to 
> compile a ./doc binary it uses other src code, it doesn't look in the 
> current directory am in, I have to force it `go build main.go` what going 
> on here? 
> > 
> > gert@gert ~/Desktop/go/src/cmd/doc:master> go build 
> > 
> > gert@gert ~/Desktop/go/src/cmd/doc:master> ls 
> > dirs.go doc doc_test.go main.go pkg.go   
>testdata 
> > 
> > I can see a doc binary getting created but its not build form the 
> main.go in current directory, I deliberately put a syntax error in main? 
> > 
> > gert@gert ~/Desktop/go/src/cmd/doc:master> go build main.go 
> > # command-line-arguments 
> > ./main.go:78:2: syntax error: unexpected --, expecting } 
> > 
> > gert@gert ~/Desktop/go/src/cmd/doc:master> go env 
> > GOARCH="amd64" 
> > GOBIN="/Users/gert/bin" 
> > GOCACHE="/Users/gert/Library/Caches/go-build" 
> > GOEXE="" 
> > GOFLAGS="" 
> > GOHOSTARCH="amd64" 
> > GOHOSTOS="darwin" 
> > GOOS="darwin" 
> > GOPATH="/Users/gert/go" 
> > GOPROXY="" 
> > GORACE="" 
> > GOROOT="/usr/local/go" 
> > GOTMPDIR="" 
> > GOTOOLDIR="/usr/local/go/pkg/tool/darwin_amd64" 
> > GCCGO="gccgo" 
> > CC="clang" 
> > CXX="clang++" 
> > CGO_ENABLED="1" 
> > GOMOD="/Users/gert/Desktop/go/src/cmd/go.mod" 
> > CGO_CFLAGS="-g -O2" 
> > CGO_CPPFLAGS="" 
> > CGO_CXXFLAGS="-g -O2" 
> > CGO_FFLAGS="-g -O2" 
> > CGO_LDFLAGS="-g -O2" 
> > PKG_CONFIG="pkg-config" 
> > GOGCCFLAGS="-fPIC -m64 -pthread -fno-caret-diagnostics 
> -Qunused-arguments -fmessage-length=0 
> -fdebug-prefix-map=/var/folders/dv/8tlwvjr91zjdyq4rk14lkkfmgn/T/go-build645754300=/tmp/go-build
>  
> -gno-record-gcc-switches -fno-common" 
>
>
> This may be related to https://golang.org/issue/32724.  Is your 
> cmd/doc directory underneath the directory displayed by `go env 
> GOROOT`? 
>
> Ian 
>

Nope `~/Desktop/go/src/cmd/doc` (git clone of go itself) is not in GOROOT 
nor in GOPATH using a seperate bootstrap go version devel +f938b9b33b Wed 
Jun 26 20:26:48 2019 + darwin/amd64 in /usr/local/go

So I assume if I match GOROOT with the repo as in git clone everything in 
/usr/local/go and bootstrap using a /usr/local/go1 then i can work on go 
doc. Going to try that now

-- 
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.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/golang-nuts/c12f9d61-5c8d-4880-80a4-aa9b749a560d%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Re: [go-nuts] go build src code of `go doc`

2019-06-26 Thread Gert
On Thursday, June 27, 2019 at 1:44:20 AM UTC+2, Gert wrote:
>
> On Thursday, June 27, 2019 at 12:11:58 AM UTC+2, Ian Lance Taylor wrote:
>>
>> On Wed, Jun 26, 2019 at 1:39 PM Gert  wrote: 
>> > 
>> > Hmm trying to work on the src code of `go doc` but every time I try to 
>> compile a ./doc binary it uses other src code, it doesn't look in the 
>> current directory am in, I have to force it `go build main.go` what going 
>> on here? 
>> > 
>> > gert@gert ~/Desktop/go/src/cmd/doc:master> go build 
>> > 
>> > gert@gert ~/Desktop/go/src/cmd/doc:master> ls 
>> > dirs.go doc doc_test.go main.go pkg.go 
>>  testdata 
>> > 
>> > I can see a doc binary getting created but its not build form the 
>> main.go in current directory, I deliberately put a syntax error in main? 
>> > 
>> > gert@gert ~/Desktop/go/src/cmd/doc:master> go build main.go 
>> > # command-line-arguments 
>> > ./main.go:78:2: syntax error: unexpected --, expecting } 
>> > 
>> > gert@gert ~/Desktop/go/src/cmd/doc:master> go env 
>> > GOARCH="amd64" 
>> > GOBIN="/Users/gert/bin" 
>> > GOCACHE="/Users/gert/Library/Caches/go-build" 
>> > GOEXE="" 
>> > GOFLAGS="" 
>> > GOHOSTARCH="amd64" 
>> > GOHOSTOS="darwin" 
>> > GOOS="darwin" 
>> > GOPATH="/Users/gert/go" 
>> > GOPROXY="" 
>> > GORACE="" 
>> > GOROOT="/usr/local/go" 
>> > GOTMPDIR="" 
>> > GOTOOLDIR="/usr/local/go/pkg/tool/darwin_amd64" 
>> > GCCGO="gccgo" 
>> > CC="clang" 
>> > CXX="clang++" 
>> > CGO_ENABLED="1" 
>> > GOMOD="/Users/gert/Desktop/go/src/cmd/go.mod" 
>> > CGO_CFLAGS="-g -O2" 
>> > CGO_CPPFLAGS="" 
>> > CGO_CXXFLAGS="-g -O2" 
>> > CGO_FFLAGS="-g -O2" 
>> > CGO_LDFLAGS="-g -O2" 
>> > PKG_CONFIG="pkg-config" 
>> > GOGCCFLAGS="-fPIC -m64 -pthread -fno-caret-diagnostics 
>> -Qunused-arguments -fmessage-length=0 
>> -fdebug-prefix-map=/var/folders/dv/8tlwvjr91zjdyq4rk14lkkfmgn/T/go-build645754300=/tmp/go-build
>>  
>> -gno-record-gcc-switches -fno-common" 
>>
>>
>> This may be related to https://golang.org/issue/32724.  Is your 
>> cmd/doc directory underneath the directory displayed by `go env 
>> GOROOT`? 
>>
>> Ian 
>>
>
> Nope `~/Desktop/go/src/cmd/doc` (git clone of go itself) is not in GOROOT 
> nor in GOPATH using a seperate bootstrap go version devel +f938b9b33b Wed 
> Jun 26 20:26:48 2019 + darwin/amd64 in /usr/local/go
>
> So I assume if I match GOROOT with the repo as in git clone everything in 
> /usr/local/go and bootstrap using a /usr/local/go1 then i can work on go 
> doc. Going to try that now
>

Yep working when I develop in GOROOT directly, but not sure if this 
intended by design that you can only develop on go src itself that way.

-- 
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.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/golang-nuts/e4baf719-a801-4a68-8141-637200da0405%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Re: [go-nuts] go build src code of `go doc`

2019-06-26 Thread Ian Lance Taylor
On Wed, Jun 26, 2019 at 4:54 PM Gert  wrote:
>
> On Thursday, June 27, 2019 at 1:44:20 AM UTC+2, Gert wrote:
>>
>> On Thursday, June 27, 2019 at 12:11:58 AM UTC+2, Ian Lance Taylor wrote:
>>>
>>> On Wed, Jun 26, 2019 at 1:39 PM Gert  wrote:
>>> >
>>> > Hmm trying to work on the src code of `go doc` but every time I try to 
>>> > compile a ./doc binary it uses other src code, it doesn't look in the 
>>> > current directory am in, I have to force it `go build main.go` what going 
>>> > on here?
>>> >
>>> > gert@gert ~/Desktop/go/src/cmd/doc:master> go build
>>> >
>>> > gert@gert ~/Desktop/go/src/cmd/doc:master> ls
>>> > dirs.go doc doc_test.go main.go pkg.go
>>> >   testdata
>>> >
>>> > I can see a doc binary getting created but its not build form the main.go 
>>> > in current directory, I deliberately put a syntax error in main?
>>> >
>>> > gert@gert ~/Desktop/go/src/cmd/doc:master> go build main.go
>>> > # command-line-arguments
>>> > ./main.go:78:2: syntax error: unexpected --, expecting }
>>> >
>>> > gert@gert ~/Desktop/go/src/cmd/doc:master> go env
>>> > GOARCH="amd64"
>>> > GOBIN="/Users/gert/bin"
>>> > GOCACHE="/Users/gert/Library/Caches/go-build"
>>> > GOEXE=""
>>> > GOFLAGS=""
>>> > GOHOSTARCH="amd64"
>>> > GOHOSTOS="darwin"
>>> > GOOS="darwin"
>>> > GOPATH="/Users/gert/go"
>>> > GOPROXY=""
>>> > GORACE=""
>>> > GOROOT="/usr/local/go"
>>> > GOTMPDIR=""
>>> > GOTOOLDIR="/usr/local/go/pkg/tool/darwin_amd64"
>>> > GCCGO="gccgo"
>>> > CC="clang"
>>> > CXX="clang++"
>>> > CGO_ENABLED="1"
>>> > GOMOD="/Users/gert/Desktop/go/src/cmd/go.mod"
>>> > CGO_CFLAGS="-g -O2"
>>> > CGO_CPPFLAGS=""
>>> > CGO_CXXFLAGS="-g -O2"
>>> > CGO_FFLAGS="-g -O2"
>>> > CGO_LDFLAGS="-g -O2"
>>> > PKG_CONFIG="pkg-config"
>>> > GOGCCFLAGS="-fPIC -m64 -pthread -fno-caret-diagnostics -Qunused-arguments 
>>> > -fmessage-length=0 
>>> > -fdebug-prefix-map=/var/folders/dv/8tlwvjr91zjdyq4rk14lkkfmgn/T/go-build645754300=/tmp/go-build
>>> >  -gno-record-gcc-switches -fno-common"
>>>
>>>
>>> This may be related to https://golang.org/issue/32724.  Is your
>>> cmd/doc directory underneath the directory displayed by `go env
>>> GOROOT`?
>>>
>>> Ian
>>
>>
>> Nope `~/Desktop/go/src/cmd/doc` (git clone of go itself) is not in GOROOT 
>> nor in GOPATH using a seperate bootstrap go version devel +f938b9b33b Wed 
>> Jun 26 20:26:48 2019 + darwin/amd64 in /usr/local/go
>>
>> So I assume if I match GOROOT with the repo as in git clone everything in 
>> /usr/local/go and bootstrap using a /usr/local/go1 then i can work on go 
>> doc. Going to try that now
>
>
> Yep working when I develop in GOROOT directly, but not sure if this intended 
> by design that you can only develop on go src itself that way.

It is not intended.  It is a bug.

It would be helpful if you could describe this on
https://golang.org/issue/32724.  Thanks.

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.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/golang-nuts/CAOyqgcWOv5%3DDFS12OGD-tbS6O20_evroe6q3XLP1tMD%3D1TvkxQ%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.


[go-nuts] rand seed using 'time.Now().Unix()' consequence mass common rand numbers, but using unixNano as the seed will not ,how to choose the rand's seed between 'time.Now().Unix()' and 'time.Now().U

2019-06-26 Thread Chou Yan
I use:
r:=rand.New(rand.NewSource(time.Now().Unix()))
r..Intn(96)
I got:

and val: 82
rand val: 82
rand val: 82
rand val: 82
rand val: 82
rand val: 82
rand val: 82
rand val: 82
rand val: 82
rand val: 82
rand val: 82
rand val: 82
rand val: 82
rand val: 82
rand val: 82
rand val: 82
rand val: 82
rand val: 82
rand val: 82
rand val: 82
rand val: 82
rand val: 82
rand val: 82
rand val: 82
rand val: 82
rand val: 82
rand val: 82
rand val: 82
rand val: 82
rand val: 82
rand val: 82
rand val: 82
rand val: 82
rand val: 39
rand val: 82
rand val: 82
rand val: 82
rand val: 82
rand val: 82
rand val: 82
rand val: 82
rand val: 82
rand val: 82
rand val: 82
...
mass common sequential number .
But if I change that:
r:=rand.New(rand.NewSource(time.Now().UnixNano()))
It will not happen.
Why does this happened? and how do I choose it between time.Now().Unix() or 
UnixNano()?

-- 
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.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/golang-nuts/ce0671c5-f2df-42d9-a7af-bdef939e6d6d%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Re: [go-nuts] rand seed using 'time.Now().Unix()' consequence mass common rand numbers, but using unixNano as the seed will not ,how to choose the rand's seed between 'time.Now().Unix()' and 'time.Now

2019-06-26 Thread Kurtis Rader
On Wed, Jun 26, 2019 at 7:17 PM Chou Yan  wrote:

> I use:
> r:=rand.New(rand.NewSource(time.Now().Unix()))
> r..Intn(96)
>

That isn't valid Go. Which `rand` package? The one in package `crypto` or
`math`? What the heck is `r..Intn(96)`?  Please post a minimal, complete,
example that compiles and runs at https://play.golang.org.

-- 
Kurtis Rader
Caretaker of the exceptional canines Junior and Hank

-- 
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.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/golang-nuts/CABx2%3DD_MqXZ%2BGmzpgWw_V2qysCWjMryu8M7oyCM%2BMLyeY5jZJQ%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.


Re: [go-nuts] rand seed using 'time.Now().Unix()' consequence mass common rand numbers, but using unixNano as the seed will not ,how to choose the rand's seed between 'time.Now().Unix()' and 'time.Now

2019-06-26 Thread Burak Serdar
On Wed, Jun 26, 2019 at 8:17 PM Chou Yan  wrote:
>
> I use:
> r:=rand.New(rand.NewSource(time.Now().Unix()))
> r..Intn(96)

How are you generating multiple random numbers? If your loop that
generates these numbers include the r:=rand.New(...), then you're
essentially seeding the random number generator with the same number,
because the program ends before time.Now().Unix() returns a different
value every second.

Move the r:=rand.New(...) outsite the for loop.

> I got:
>
> and val: 82
> rand val: 82
> rand val: 82
> rand val: 82
> rand val: 82
> rand val: 82
> rand val: 82
> rand val: 82
> rand val: 82
> rand val: 82
> rand val: 82
> rand val: 82
> rand val: 82
> rand val: 82
> rand val: 82
> rand val: 82
> rand val: 82
> rand val: 82
> rand val: 82
> rand val: 82
> rand val: 82
> rand val: 82
> rand val: 82
> rand val: 82
> rand val: 82
> rand val: 82
> rand val: 82
> rand val: 82
> rand val: 82
> rand val: 82
> rand val: 82
> rand val: 82
> rand val: 82
> rand val: 39
> rand val: 82
> rand val: 82
> rand val: 82
> rand val: 82
> rand val: 82
> rand val: 82
> rand val: 82
> rand val: 82
> rand val: 82
> rand val: 82
> ...
> mass common sequential number .
> But if I change that:
> r:=rand.New(rand.NewSource(time.Now().UnixNano()))
> It will not happen.
> Why does this happened? and how do I choose it between time.Now().Unix() or 
> UnixNano()?
>
> --
> 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.
> To view this discussion on the web visit 
> https://groups.google.com/d/msgid/golang-nuts/ce0671c5-f2df-42d9-a7af-bdef939e6d6d%40googlegroups.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.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/golang-nuts/CAMV2Rqpq6%2BSAzErGho6o7A-pZ7toYrfZnhYh21A7Y7NV6BEV9Q%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.


Re: [go-nuts] rand seed using 'time.Now().Unix()' consequence mass common rand numbers, but using unixNano as the seed will not ,how to choose the rand's seed between 'time.Now().Unix()' and 'time.Now

2019-06-26 Thread Chou Yan
like this:
r:=rand.New(rand.NewSource(time.Now().Unix())) 
for {
r.Intn(96) 
}
I know the same seed will generate the same sequence. But I don't know why 
it generate mass same number when I use seed of 'time.Now().Unix()', But 
when I use seed of 'time.Now().UnixNano()', It will not.
I suspect what this is related to the seqence rand algorithm,But I have no 
relevant evidence

在 2019年6月27日星期四 UTC+8上午10:32:38,Burak Serdar写道:
>
> On Wed, Jun 26, 2019 at 8:17 PM Chou Yan  > wrote: 
> > 
> > I use: 
> > r:=rand.New(rand.NewSource(time.Now().Unix())) 
> > r..Intn(96) 
>
> How are you generating multiple random numbers? If your loop that 
> generates these numbers include the r:=rand.New(...), then you're 
> essentially seeding the random number generator with the same number, 
> because the program ends before time.Now().Unix() returns a different 
> value every second. 
>
> Move the r:=rand.New(...) outsite the for loop. 
>
> > I got: 
> > 
> > and val: 82 
> > rand val: 82 
> > rand val: 82 
> > rand val: 82 
> > rand val: 82 
> > rand val: 82 
> > rand val: 82 
> > rand val: 82 
> > rand val: 82 
> > rand val: 82 
> > rand val: 82 
> > rand val: 82 
> > rand val: 82 
> > rand val: 82 
> > rand val: 82 
> > rand val: 82 
> > rand val: 82 
> > rand val: 82 
> > rand val: 82 
> > rand val: 82 
> > rand val: 82 
> > rand val: 82 
> > rand val: 82 
> > rand val: 82 
> > rand val: 82 
> > rand val: 82 
> > rand val: 82 
> > rand val: 82 
> > rand val: 82 
> > rand val: 82 
> > rand val: 82 
> > rand val: 82 
> > rand val: 82 
> > rand val: 39 
> > rand val: 82 
> > rand val: 82 
> > rand val: 82 
> > rand val: 82 
> > rand val: 82 
> > rand val: 82 
> > rand val: 82 
> > rand val: 82 
> > rand val: 82 
> > rand val: 82 
> > ... 
> > mass common sequential number . 
> > But if I change that: 
> > r:=rand.New(rand.NewSource(time.Now().UnixNano())) 
> > It will not happen. 
> > Why does this happened? and how do I choose it between time.Now().Unix() 
> or UnixNano()? 
> > 
> > -- 
> > 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 golan...@googlegroups.com . 
> > To view this discussion on the web visit 
> https://groups.google.com/d/msgid/golang-nuts/ce0671c5-f2df-42d9-a7af-bdef939e6d6d%40googlegroups.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.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/golang-nuts/99351298-7843-4556-b422-8635eb96c936%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Re: [go-nuts] rand seed using 'time.Now().Unix()' consequence mass common rand numbers, but using unixNano as the seed will not ,how to choose the rand's seed between 'time.Now().Unix()' and 'time.Now

2019-06-26 Thread Burak Serdar
On Wed, Jun 26, 2019 at 8:48 PM Chou Yan  wrote:
>
> like this:
> r:=rand.New(rand.NewSource(time.Now().Unix()))
> for {
> r.Intn(96)
> }
> I know the same seed will generate the same sequence. But I don't know why it 
> generate mass same number when I use seed of 'time.Now().Unix()', But when I 
> use seed of 'time.Now().UnixNano()', It will not.
> I suspect what this is related to the seqence rand algorithm,But I have no 
> relevant evidence

This doesn't make sense. Can you reproduce it in the go playground?

>
> 在 2019年6月27日星期四 UTC+8上午10:32:38,Burak Serdar写道:
>>
>> On Wed, Jun 26, 2019 at 8:17 PM Chou Yan  wrote:
>> >
>> > I use:
>> > r:=rand.New(rand.NewSource(time.Now().Unix()))
>> > r..Intn(96)
>>
>> How are you generating multiple random numbers? If your loop that
>> generates these numbers include the r:=rand.New(...), then you're
>> essentially seeding the random number generator with the same number,
>> because the program ends before time.Now().Unix() returns a different
>> value every second.
>>
>> Move the r:=rand.New(...) outsite the for loop.
>>
>> > I got:
>> >
>> > and val: 82
>> > rand val: 82
>> > rand val: 82
>> > rand val: 82
>> > rand val: 82
>> > rand val: 82
>> > rand val: 82
>> > rand val: 82
>> > rand val: 82
>> > rand val: 82
>> > rand val: 82
>> > rand val: 82
>> > rand val: 82
>> > rand val: 82
>> > rand val: 82
>> > rand val: 82
>> > rand val: 82
>> > rand val: 82
>> > rand val: 82
>> > rand val: 82
>> > rand val: 82
>> > rand val: 82
>> > rand val: 82
>> > rand val: 82
>> > rand val: 82
>> > rand val: 82
>> > rand val: 82
>> > rand val: 82
>> > rand val: 82
>> > rand val: 82
>> > rand val: 82
>> > rand val: 82
>> > rand val: 82
>> > rand val: 39
>> > rand val: 82
>> > rand val: 82
>> > rand val: 82
>> > rand val: 82
>> > rand val: 82
>> > rand val: 82
>> > rand val: 82
>> > rand val: 82
>> > rand val: 82
>> > rand val: 82
>> > ...
>> > mass common sequential number .
>> > But if I change that:
>> > r:=rand.New(rand.NewSource(time.Now().UnixNano()))
>> > It will not happen.
>> > Why does this happened? and how do I choose it between time.Now().Unix() 
>> > or UnixNano()?
>> >
>> > --
>> > 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 golan...@googlegroups.com.
>> > To view this discussion on the web visit 
>> > https://groups.google.com/d/msgid/golang-nuts/ce0671c5-f2df-42d9-a7af-bdef939e6d6d%40googlegroups.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.
> To view this discussion on the web visit 
> https://groups.google.com/d/msgid/golang-nuts/99351298-7843-4556-b422-8635eb96c936%40googlegroups.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.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/golang-nuts/CAMV2Rqo-twhsXPRdn%3DOV5badmM0h-CZjhXhNnmaQeaXxeKz31g%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.


Re: [go-nuts] rand seed using 'time.Now().Unix()' consequence mass common rand numbers, but using unixNano as the seed will not ,how to choose the rand's seed between 'time.Now().Unix()' and 'time.Now

2019-06-26 Thread Kurtis Rader
Works for me: https://play.golang.org/p/zD5F7gp41re

Like Burak I suspect you are initializing the RNG in a tight loop. Since
`time.Now().Unix()` has a resolution of one second you end up generating
the same initial value every time through the loop until the current time
advances to the next second.

On Wed, Jun 26, 2019 at 7:48 PM Chou Yan  wrote:

> like this:
> r:=rand.New(rand.NewSource(time.Now().Unix()))
> for {
> r.Intn(96)
> }
> I know the same seed will generate the same sequence. But I don't know why
> it generate mass same number when I use seed of 'time.Now().Unix()', But
> when I use seed of 'time.Now().UnixNano()', It will not.
> I suspect what this is related to the seqence rand algorithm,But I have no
> relevant evidence
>
> 在 2019年6月27日星期四 UTC+8上午10:32:38,Burak Serdar写道:
>>
>> On Wed, Jun 26, 2019 at 8:17 PM Chou Yan  wrote:
>> >
>> > I use:
>> > r:=rand.New(rand.NewSource(time.Now().Unix()))
>> > r..Intn(96)
>>
>> How are you generating multiple random numbers? If your loop that
>> generates these numbers include the r:=rand.New(...), then you're
>> essentially seeding the random number generator with the same number,
>> because the program ends before time.Now().Unix() returns a different
>> value every second.
>>
>> Move the r:=rand.New(...) outsite the for loop.
>>
>> > I got:
>> >
>> > and val: 82
>> > rand val: 82
>> > rand val: 82
>> > rand val: 82
>> > rand val: 82
>> > rand val: 82
>> > rand val: 82
>> > rand val: 82
>> > rand val: 82
>> > rand val: 82
>> > rand val: 82
>> > rand val: 82
>> > rand val: 82
>> > rand val: 82
>> > rand val: 82
>> > rand val: 82
>> > rand val: 82
>> > rand val: 82
>> > rand val: 82
>> > rand val: 82
>> > rand val: 82
>> > rand val: 82
>> > rand val: 82
>> > rand val: 82
>> > rand val: 82
>> > rand val: 82
>> > rand val: 82
>> > rand val: 82
>> > rand val: 82
>> > rand val: 82
>> > rand val: 82
>> > rand val: 82
>> > rand val: 82
>> > rand val: 39
>> > rand val: 82
>> > rand val: 82
>> > rand val: 82
>> > rand val: 82
>> > rand val: 82
>> > rand val: 82
>> > rand val: 82
>> > rand val: 82
>> > rand val: 82
>> > rand val: 82
>> > ...
>> > mass common sequential number .
>> > But if I change that:
>> > r:=rand.New(rand.NewSource(time.Now().UnixNano()))
>> > It will not happen.
>> > Why does this happened? and how do I choose it between
>> time.Now().Unix() or UnixNano()?
>> >
>> > --
>> > 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 golan...@googlegroups.com.
>> > To view this discussion on the web visit
>> https://groups.google.com/d/msgid/golang-nuts/ce0671c5-f2df-42d9-a7af-bdef939e6d6d%40googlegroups.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.
> To view this discussion on the web visit
> https://groups.google.com/d/msgid/golang-nuts/99351298-7843-4556-b422-8635eb96c936%40googlegroups.com
> 
> .
> For more options, visit https://groups.google.com/d/optout.
>


-- 
Kurtis Rader
Caretaker of the exceptional canines Junior and Hank

-- 
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.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/golang-nuts/CABx2%3DD-CyCmmZ9FdD6B-cKGgFbjcUafgkBR8rvLeS_xs8WmwvQ%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.


Re: [go-nuts] rand seed using 'time.Now().Unix()' consequence mass common rand numbers, but using unixNano as the seed will not ,how to choose the rand's seed between 'time.Now().Unix()' and 'time.Now

2019-06-26 Thread Chou Yan
The situation I am currently experiencing is that it only occur on my 
online app. I try it at local but I can not got the result. 
haha... I make a mistake.
the code is :

func WeightRandom(services []*registry.Service) Next{
w := weighted.NewRandW()
for _, service := range services {
for _,n := range service.Nodes {
w.Add(n,n.Weight)
}
}
return func() (*registry.Node, error) {
n := w.Next()
no, ok := n.(*registry.Node)
if !ok {
return nil,errors.New("get next err")
}
return no, nil
}
}

The 'rand.New(...SEED)' is outside the loop of for But I neglect that this 
func 'WeightRandom' will be mass goroutine call. so each time.Now().Unix() 
,the same seed ,the same sequence. So I got mass common rand number.But 
when I change it as time.Now().UnixNano(), the seed will not be the same 
because of the unixnano. so I got correctly. thank you very much

在 2019年6月27日星期四 UTC+8上午10:52:56,Burak Serdar写道:
>
> On Wed, Jun 26, 2019 at 8:48 PM Chou Yan  > wrote: 
> > 
> > like this: 
> > r:=rand.New(rand.NewSource(time.Now().Unix())) 
> > for { 
> > r.Intn(96) 
> > } 
> > I know the same seed will generate the same sequence. But I don't know 
> why it generate mass same number when I use seed of 'time.Now().Unix()', 
> But when I use seed of 'time.Now().UnixNano()', It will not. 
> > I suspect what this is related to the seqence rand algorithm,But I have 
> no relevant evidence 
>
> This doesn't make sense. Can you reproduce it in the go playground? 
>
> > 
> > 在 2019年6月27日星期四 UTC+8上午10:32:38,Burak Serdar写道: 
> >> 
> >> On Wed, Jun 26, 2019 at 8:17 PM Chou Yan  wrote: 
> >> > 
> >> > I use: 
> >> > r:=rand.New(rand.NewSource(time.Now().Unix())) 
> >> > r..Intn(96) 
> >> 
> >> How are you generating multiple random numbers? If your loop that 
> >> generates these numbers include the r:=rand.New(...), then you're 
> >> essentially seeding the random number generator with the same number, 
> >> because the program ends before time.Now().Unix() returns a different 
> >> value every second. 
> >> 
> >> Move the r:=rand.New(...) outsite the for loop. 
> >> 
> >> > I got: 
> >> > 
> >> > and val: 82 
> >> > rand val: 82 
> >> > rand val: 82 
> >> > rand val: 82 
> >> > rand val: 82 
> >> > rand val: 82 
> >> > rand val: 82 
> >> > rand val: 82 
> >> > rand val: 82 
> >> > rand val: 82 
> >> > rand val: 82 
> >> > rand val: 82 
> >> > rand val: 82 
> >> > rand val: 82 
> >> > rand val: 82 
> >> > rand val: 82 
> >> > rand val: 82 
> >> > rand val: 82 
> >> > rand val: 82 
> >> > rand val: 82 
> >> > rand val: 82 
> >> > rand val: 82 
> >> > rand val: 82 
> >> > rand val: 82 
> >> > rand val: 82 
> >> > rand val: 82 
> >> > rand val: 82 
> >> > rand val: 82 
> >> > rand val: 82 
> >> > rand val: 82 
> >> > rand val: 82 
> >> > rand val: 82 
> >> > rand val: 82 
> >> > rand val: 39 
> >> > rand val: 82 
> >> > rand val: 82 
> >> > rand val: 82 
> >> > rand val: 82 
> >> > rand val: 82 
> >> > rand val: 82 
> >> > rand val: 82 
> >> > rand val: 82 
> >> > rand val: 82 
> >> > rand val: 82 
> >> > ... 
> >> > mass common sequential number . 
> >> > But if I change that: 
> >> > r:=rand.New(rand.NewSource(time.Now().UnixNano())) 
> >> > It will not happen. 
> >> > Why does this happened? and how do I choose it between 
> time.Now().Unix() or UnixNano()? 
> >> > 
> >> > -- 
> >> > 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 golan...@googlegroups.com. 
> >> > To view this discussion on the web visit 
> https://groups.google.com/d/msgid/golang-nuts/ce0671c5-f2df-42d9-a7af-bdef939e6d6d%40googlegroups.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 golan...@googlegroups.com . 
> > To view this discussion on the web visit 
> https://groups.google.com/d/msgid/golang-nuts/99351298-7843-4556-b422-8635eb96c936%40googlegroups.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.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/golang-nuts/1760eb39-21e7-479b-bea7-8276e03e3873%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Re: [go-nuts] rand seed using 'time.Now().Unix()' consequence mass common rand numbers, but using unixNano as the seed will not ,how to choose the rand's seed between 'time.Now().Unix()' and 'time.Now

2019-06-26 Thread Chou Yan
I fix it by :

var w = weighted.NewRandW()

func WeightRandom(services []*registry.Service) Next{
for _, service := range services {
for _,n := range service.Nodes {
w.Add(n,n.Weight)
}
}
return func() (*registry.Node, error) {
n := w.Next()
no, ok := n.(*registry.Node)
if !ok {
return nil,errors.New("get next err")
}
return no, nil
}
}

thx

在 2019年6月27日星期四 UTC+8上午11:16:01,Chou Yan写道:
>
> The situation I am currently experiencing is that it only occur on my 
> online app. I try it at local but I can not got the result. 
> haha... I make a mistake.
> the code is :
>
> func WeightRandom(services []*registry.Service) Next{
> w := weighted.NewRandW()
> for _, service := range services {
> for _,n := range service.Nodes {
> w.Add(n,n.Weight)
> }
> }
> return func() (*registry.Node, error) {
> n := w.Next()
> no, ok := n.(*registry.Node)
> if !ok {
> return nil,errors.New("get next err")
> }
> return no, nil
> }
> }
>
> The 'rand.New(...SEED)' is outside the loop of for But I neglect that this 
> func 'WeightRandom' will be mass goroutine call. so each time.Now().Unix() 
> ,the same seed ,the same sequence. So I got mass common rand number.But 
> when I change it as time.Now().UnixNano(), the seed will not be the same 
> because of the unixnano. so I got correctly. thank you very much
>
> 在 2019年6月27日星期四 UTC+8上午10:52:56,Burak Serdar写道:
>>
>> On Wed, Jun 26, 2019 at 8:48 PM Chou Yan  wrote: 
>> > 
>> > like this: 
>> > r:=rand.New(rand.NewSource(time.Now().Unix())) 
>> > for { 
>> > r.Intn(96) 
>> > } 
>> > I know the same seed will generate the same sequence. But I don't know 
>> why it generate mass same number when I use seed of 'time.Now().Unix()', 
>> But when I use seed of 'time.Now().UnixNano()', It will not. 
>> > I suspect what this is related to the seqence rand algorithm,But I have 
>> no relevant evidence 
>>
>> This doesn't make sense. Can you reproduce it in the go playground? 
>>
>> > 
>> > 在 2019年6月27日星期四 UTC+8上午10:32:38,Burak Serdar写道: 
>> >> 
>> >> On Wed, Jun 26, 2019 at 8:17 PM Chou Yan  wrote: 
>> >> > 
>> >> > I use: 
>> >> > r:=rand.New(rand.NewSource(time.Now().Unix())) 
>> >> > r..Intn(96) 
>> >> 
>> >> How are you generating multiple random numbers? If your loop that 
>> >> generates these numbers include the r:=rand.New(...), then you're 
>> >> essentially seeding the random number generator with the same number, 
>> >> because the program ends before time.Now().Unix() returns a different 
>> >> value every second. 
>> >> 
>> >> Move the r:=rand.New(...) outsite the for loop. 
>> >> 
>> >> > I got: 
>> >> > 
>> >> > and val: 82 
>> >> > rand val: 82 
>> >> > rand val: 82 
>> >> > rand val: 82 
>> >> > rand val: 82 
>> >> > rand val: 82 
>> >> > rand val: 82 
>> >> > rand val: 82 
>> >> > rand val: 82 
>> >> > rand val: 82 
>> >> > rand val: 82 
>> >> > rand val: 82 
>> >> > rand val: 82 
>> >> > rand val: 82 
>> >> > rand val: 82 
>> >> > rand val: 82 
>> >> > rand val: 82 
>> >> > rand val: 82 
>> >> > rand val: 82 
>> >> > rand val: 82 
>> >> > rand val: 82 
>> >> > rand val: 82 
>> >> > rand val: 82 
>> >> > rand val: 82 
>> >> > rand val: 82 
>> >> > rand val: 82 
>> >> > rand val: 82 
>> >> > rand val: 82 
>> >> > rand val: 82 
>> >> > rand val: 82 
>> >> > rand val: 82 
>> >> > rand val: 82 
>> >> > rand val: 82 
>> >> > rand val: 39 
>> >> > rand val: 82 
>> >> > rand val: 82 
>> >> > rand val: 82 
>> >> > rand val: 82 
>> >> > rand val: 82 
>> >> > rand val: 82 
>> >> > rand val: 82 
>> >> > rand val: 82 
>> >> > rand val: 82 
>> >> > rand val: 82 
>> >> > ... 
>> >> > mass common sequential number . 
>> >> > But if I change that: 
>> >> > r:=rand.New(rand.NewSource(time.Now().UnixNano())) 
>> >> > It will not happen. 
>> >> > Why does this happened? and how do I choose it between 
>> time.Now().Unix() or UnixNano()? 
>> >> > 
>> >> > -- 
>> >> > 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 golan...@googlegroups.com. 
>> >> > To view this discussion on the web visit 
>> https://groups.google.com/d/msgid/golang-nuts/ce0671c5-f2df-42d9-a7af-bdef939e6d6d%40googlegroups.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 golan...@googlegroups.com. 
>> > To view this discussion on the web visit 
>> https://groups.google.com/d/msgid/golang-nuts/99351298-7843-4556-b422-8635eb96c936%40googlegroups.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

Re: [go-nuts] rand seed using 'time.Now().Unix()' consequence mass common rand numbers, but using unixNano as the seed will not ,how to choose the rand's seed between 'time.Now().Unix()' and 'time.Now

2019-06-26 Thread Kurtis Rader
On Wed, Jun 26, 2019 at 8:18 PM Chou Yan  wrote:

> I fix it by :
>
> var w = weighted.NewRandW()
>

Insufficient context to understand what that does. Let alone how it "fixes"
the problem since you haven't shown us your `NewRandW()` function. In
general you should never initialize a RNG more than once unless you are
doing so to create a reproducible sequence of values. In which case you
should be initializing it with a constant value rather than a pseudo-random
value like `time.Now().Unix()`.

-- 
Kurtis Rader
Caretaker of the exceptional canines Junior and Hank

-- 
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.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/golang-nuts/CABx2%3DD9oc7vzsQXr9GYiefB15Xu%3D-kJ%3DLQESqRWBLq_rNUQeOg%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.


Re: [go-nuts] rand seed using 'time.Now().Unix()' consequence mass common rand numbers, but using unixNano as the seed will not ,how to choose the rand's seed between 'time.Now().Unix()' and 'time.Now

2019-06-26 Thread Chou Yan
thx. you are right. I make a mistake. I negleck that my func will be called 
by mass goroutine, it will get the same seed and the same sequence

在 2019年6月27日星期四 UTC+8上午11:07:28,Kurtis Rader写道:
>
> Works for me: https://play.golang.org/p/zD5F7gp41re
>
> Like Burak I suspect you are initializing the RNG in a tight loop. Since 
> `time.Now().Unix()` has a resolution of one second you end up generating 
> the same initial value every time through the loop until the current time 
> advances to the next second.
>
> On Wed, Jun 26, 2019 at 7:48 PM Chou Yan  > wrote:
>
>> like this:
>> r:=rand.New(rand.NewSource(time.Now().Unix())) 
>> for {
>> r.Intn(96) 
>> }
>> I know the same seed will generate the same sequence. But I don't know 
>> why it generate mass same number when I use seed of 'time.Now().Unix()', 
>> But when I use seed of 'time.Now().UnixNano()', It will not.
>> I suspect what this is related to the seqence rand algorithm,But I have 
>> no relevant evidence
>>
>> 在 2019年6月27日星期四 UTC+8上午10:32:38,Burak Serdar写道:
>>>
>>> On Wed, Jun 26, 2019 at 8:17 PM Chou Yan  wrote: 
>>> > 
>>> > I use: 
>>> > r:=rand.New(rand.NewSource(time.Now().Unix())) 
>>> > r..Intn(96) 
>>>
>>> How are you generating multiple random numbers? If your loop that 
>>> generates these numbers include the r:=rand.New(...), then you're 
>>> essentially seeding the random number generator with the same number, 
>>> because the program ends before time.Now().Unix() returns a different 
>>> value every second. 
>>>
>>> Move the r:=rand.New(...) outsite the for loop. 
>>>
>>> > I got: 
>>> > 
>>> > and val: 82 
>>> > rand val: 82 
>>> > rand val: 82 
>>> > rand val: 82 
>>> > rand val: 82 
>>> > rand val: 82 
>>> > rand val: 82 
>>> > rand val: 82 
>>> > rand val: 82 
>>> > rand val: 82 
>>> > rand val: 82 
>>> > rand val: 82 
>>> > rand val: 82 
>>> > rand val: 82 
>>> > rand val: 82 
>>> > rand val: 82 
>>> > rand val: 82 
>>> > rand val: 82 
>>> > rand val: 82 
>>> > rand val: 82 
>>> > rand val: 82 
>>> > rand val: 82 
>>> > rand val: 82 
>>> > rand val: 82 
>>> > rand val: 82 
>>> > rand val: 82 
>>> > rand val: 82 
>>> > rand val: 82 
>>> > rand val: 82 
>>> > rand val: 82 
>>> > rand val: 82 
>>> > rand val: 82 
>>> > rand val: 82 
>>> > rand val: 39 
>>> > rand val: 82 
>>> > rand val: 82 
>>> > rand val: 82 
>>> > rand val: 82 
>>> > rand val: 82 
>>> > rand val: 82 
>>> > rand val: 82 
>>> > rand val: 82 
>>> > rand val: 82 
>>> > rand val: 82 
>>> > ... 
>>> > mass common sequential number . 
>>> > But if I change that: 
>>> > r:=rand.New(rand.NewSource(time.Now().UnixNano())) 
>>> > It will not happen. 
>>> > Why does this happened? and how do I choose it between 
>>> time.Now().Unix() or UnixNano()? 
>>> > 
>>> > -- 
>>> > 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 golan...@googlegroups.com. 
>>> > To view this discussion on the web visit 
>>> https://groups.google.com/d/msgid/golang-nuts/ce0671c5-f2df-42d9-a7af-bdef939e6d6d%40googlegroups.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 golan...@googlegroups.com .
>> To view this discussion on the web visit 
>> https://groups.google.com/d/msgid/golang-nuts/99351298-7843-4556-b422-8635eb96c936%40googlegroups.com
>>  
>> 
>> .
>> For more options, visit https://groups.google.com/d/optout.
>>
>
>
> -- 
> Kurtis Rader
> Caretaker of the exceptional canines Junior and Hank
>

-- 
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.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/golang-nuts/1e5a8486-ef43-4258-8ffc-d21dc542638f%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Re: [go-nuts] rand seed using 'time.Now().Unix()' consequence mass common rand numbers, but using unixNano as the seed will not ,how to choose the rand's seed between 'time.Now().Unix()' and 'time.Now

2019-06-26 Thread Chou Yan
It's the context:

// NewRandW creates a new RandW with a random object.
func NewRandW() *RandW {
return &RandW{r: rand.New(rand.NewSource(time.Now().Unix()))}
}

n := w.Next()

// Next returns next selected item.
func (rw *RandW) Next() (item interface{}) {
...
randomWeight := rw.r.Intn(rw.sumOfWeights)
//fmt.Printf("rand val: %d\n",randomWeight)
...
}

I am sorry about that I did't give the context of my code.

在 2019年6月27日星期四 UTC+8上午11:22:49,Kurtis Rader写道:
>
> On Wed, Jun 26, 2019 at 8:18 PM Chou Yan  > wrote:
>
>> I fix it by :
>>
>> var w = weighted.NewRandW()
>>
>
> Insufficient context to understand what that does. Let alone how it 
> "fixes" the problem since you haven't shown us your `NewRandW()` function. 
> In general you should never initialize a RNG more than once unless you are 
> doing so to create a reproducible sequence of values. In which case you 
> should be initializing it with a constant value rather than a pseudo-random 
> value like `time.Now().Unix()`.
>
> -- 
> Kurtis Rader
> Caretaker of the exceptional canines Junior and Hank
>

-- 
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.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/golang-nuts/638a5f5b-552f-4f56-9f7f-3253fb8c2e29%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Re: [go-nuts] rand seed using 'time.Now().Unix()' consequence mass common rand numbers, but using unixNano as the seed will not ,how to choose the rand's seed between 'time.Now().Unix()' and 'time.Now

2019-06-26 Thread Kurtis Rader
On Wed, Jun 26, 2019 at 8:30 PM Chou Yan  wrote:

> // NewRandW creates a new RandW with a random object.
> func NewRandW() *RandW {
> return &RandW{r: rand.New(rand.NewSource(time.Now().Unix()))}
> }
>

That is broken even if you use `UnixNano()`. Repeat after me: In general
you should never initialize a RNG more than once. I say "in general"
because there are use cases where reproducible results require doing so.
But those use cases do not seem to be applicable to your situation. Without
knowing more about why you are creating multiple RNGs the general advice is
create a single RNG and use it every place you need a random number. You
should probably be using `rand.Seed()` and `rand.Source()` rather than
`rand.NewSource()` given your fundamental misunderstanding about how RNGs
work.

-- 
Kurtis Rader
Caretaker of the exceptional canines Junior and Hank

-- 
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.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/golang-nuts/CABx2%3DD9J%2BvKtapgYvkRx%3DviPez%2BLG40JjPzXEdgJQAwcLaxMrA%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.


[go-nuts] Migrating to modules

2019-06-26 Thread lee
All of my projects at the moment are living under GOPATH/src/me/projectName.

Is it possible to migrate to using GoModules and pin (for now) the packages 
at the versions stored in my GOPATH/src.  I am thinking that way the 
migration to GOMODULES will produce a build no different to the build using 
GOPATH/src for all the packages.

>From that point on I then know I am at a good place and can look to upgrade 
packages for that migrated project.

Is this possible and if so how?  I am using Go1.12 now but happy if this is 
in 1.13

Thanks!


-- 
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.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/golang-nuts/16d5b7f0-f8e9-4dee-8724-1defdee3ea27%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


[go-nuts] Re: Migrating to modules

2019-06-26 Thread Kasun Vithanage
Yes you can easily migrate. Go will automatically generate mod files based 
on your projects.

Just go into the project and run 
GO111MODULE=on go mod init 
and everything will be ok.

If you are storing your projects in a VCS like Github just make sure you 
put repo name as the PROJECT NAME

Ex: 
GO111MODULE=on go mod init github.com/username/projectname

For more 

Regards.
Kasun


On Thursday, June 27, 2019 at 11:17:20 AM UTC+5:30, Lee Armstrong wrote:
>
> All of my projects at the moment are living under 
> GOPATH/src/me/projectName.
>
> Is it possible to migrate to using GoModules and pin (for now) the 
> packages at the versions stored in my GOPATH/src.  I am thinking that way 
> the migration to GOMODULES will produce a build no different to the build 
> using GOPATH/src for all the packages.
>
> From that point on I then know I am at a good place and can look to 
> upgrade packages for that migrated project.
>
> Is this possible and if so how?  I am using Go1.12 now but happy if this 
> is in 1.13
>
> Thanks!
>
>
>

-- 
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.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/golang-nuts/f9cc55d0-1908-4849-ab9e-f86091ff5576%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


[go-nuts] sigprofNonGo() and sigprofNonGoPC() in go runtime

2019-06-26 Thread psu via golang-nuts
Hi folks,

I am wondering when and how sigprofNonGo() and sigprofNonGoPC() are invoked 
during pprof CPU profiling (pprof.StartCPUProfile(...)). I had thought they 
would be invoked when user C code (invoked via cgo) is being profiled? But 
in my experiments, it never happened.

Best

-- 
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.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/golang-nuts/a3848942-8dea-4fcb-b00d-10d3e0971fa5%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Re: [go-nuts] sigprofNonGo() and sigprofNonGoPC() in go runtime

2019-06-26 Thread Ian Lance Taylor
On Wed, Jun 26, 2019 at 11:13 PM psu via golang-nuts
 wrote:
>
> I am wondering when and how sigprofNonGo() and sigprofNonGoPC() are invoked 
> during pprof CPU profiling (pprof.StartCPUProfile(...)). I had thought they 
> would be invoked when user C code (invoked via cgo) is being profiled? But in 
> my experiments, it never happened.

The two functions are only used if a SIGPROF arrives for a thread that
was started by C that is running C code.  So you will only see them if
your C code starts new threads.  For a thread that was started by Go
the profiler will normally record just the Go stack trace.  If you
want to collect a C traceback in addition to the Go traceback you can
call runtime.SetCgoTraceback (only supported on amd64 running Darwin
or FreeBSD or GNU/Linux); the easiest way to do that is to import
github.com/ianlancetaylor/cgosymbolizer (completely unsupported but it
usually works).

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.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/golang-nuts/CAOyqgcW3DqMOsQNov9KnMPjAK4U0_wMkhcZpbJSVr8xpg3sk%2Bg%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.