Re: [go-nuts] Nondeterministic Behavior of for Loop Ranging Over a map

2020-05-25 Thread Kaveh Shahbazian
Thank you Paul, On Tuesday, May 26, 2020 at 7:37:34 AM UTC+2, Paul Jolly wrote: > > > Why the output of this code is nondeterministic? > > See https://golang.org/ref/spec#For_statements, specifically the "For > statements with range clause" subheading, specifically this bullet: > > > 3. The

Re: [go-nuts] Nondeterministic Behavior of for Loop Ranging Over a map

2020-05-25 Thread Paul Jolly
> Why the output of this code is nondeterministic? See https://golang.org/ref/spec#For_statements, specifically the "For statements with range clause" subheading, specifically this bullet: > 3. The iteration order over maps is not specified and is not guaranteed to be > the same from one

[go-nuts] Nondeterministic Behavior of for Loop Ranging Over a map

2020-05-25 Thread Kaveh Shahbazian
Why the output of this code is nondeterministic? Go Playground package main import ( "fmt" ) func main() { series := make(map[int]int) series[0] = 0 i := 1 for k, v := range series { fmt.Println(k, v) if i < 10 {

[go-nuts] Failed to build gollvm in a docker container

2020-05-25 Thread Yuan Ting
I tried to build gollvm in a docker container (the image is based on ubuntu 20.04, and the host OS is MacOS catalina). I configured llvm by SHELL=/bin/sh cmake -DCMAKE_BUILD_TYPE=Release -DLLVM_TARGETS_TO_BUILD=X86 -DLLVM_ENABLE_ASSERTIONS=On -DLLVM_ENABLE_RTTI=On -DLLVM_USE_LINKER=gold -G

Re: [go-nuts] Re: Best practices for file scoping

2020-05-25 Thread Davis Ford
Use Ginkgo -- great test runner and the Gomega test matcher is awesome too. Works out of the box also with straight up go test. That was my solution back in 2015, and is still my solution todaystill writing golang. On Mon, May 25, 2020 at 1:52 PM wrote: > Me too. Running into the same

Re: [go-nuts] url.QueryEscape unexpectedly slow

2020-05-25 Thread robert engels
This is an infinite loop: for b := byte(0); b <= 255; b++ { _ = url.QueryEscape(string([]byte{a,b})) } b will always be <= 255 because it is a byte. -- You received this message because you are subscribed to the Google Groups "golang-nuts" group. To unsubscribe from this

Re: [go-nuts] url.QueryEscape unexpectedly slow

2020-05-25 Thread Ian Davis
Don't use a byte for your loops, use an int. When your loop reaches 255 it is incremented to 0 which is still <= 255 so your loop never terminates. On Mon, 25 May 2020, at 10:54 PM, Liam wrote: > I would expect this to complete pretty quickly, but after 40 minutes (on > 1.13, linux/amd64), it

[go-nuts] url.QueryEscape unexpectedly slow

2020-05-25 Thread Liam
I would expect this to complete pretty quickly, but after 40 minutes (on 1.13, linux/amd64), it hasn't printed a thing. I'm following up a report of panic in QueryEscape: https://github.com/golang/go/issues/38643 package main import ( "net/url" "fmt" ) func main() { for a :=

Re: [go-nuts] Re: Tracking down RSS growth in cgo library

2020-05-25 Thread Ian Lance Taylor
On Sun, May 24, 2020 at 12:50 PM Justin Israel wrote: > > About the frequency of finalizers, can you confirm my question about whether > the finalizers run during the GC run each time, regardless of when that GC > run decides to happen? Or can a GC start to run but decide not to process the >

Re: [go-nuts] Build fails when using gollvm toolchain instead of go

2020-05-25 Thread Ian Lance Taylor
On Mon, May 25, 2020 at 8:54 AM wrote: > > I've been trying to make this project https://github.com/intel-go/nff-go > using a freshly built gollvm to get the code compiled into LLVM IR. The > project builds fine when using the regular go toolchain, but when trying to > build with gollvm, I get

Re: [go-nuts] Re: Is it acceptable to make the optional parameter as varargs

2020-05-25 Thread Robert Engels
You can use builder to build options or the server. It is a much cleaner and self documenting method. > On May 25, 2020, at 12:51 PM, sergey@netdata.cloud wrote: > >  > Hello Amarjeet, > > You can actually don't check if len(options) is greater than one – if your > package provides only

[go-nuts] I made History + Diff command to test automation tool by golang. Are you interesting this tool?

2020-05-25 Thread katoh . yasuta
Hi. i'm engeneer in japan. I write any programs as a hobby each days. But, I don't have a mate around for golang. and haven't use programing in my company. Everyone, please this tool can be evaluated? https://github.com/yasutakatou/hiffer This tool wrap cmd.exe (when Windows),or unix shell,

[go-nuts] Re: Best practices for file scoping

2020-05-25 Thread dnj0496
Me too. Running into the same exact situation. On Saturday, May 9, 2015 at 9:44:06 PM UTC-7, Davis Ford wrote: > > I know this is an ancient thread, but I thought I'd see if anyone has any > clever tricks for getting around this with unit tests. > > I have a package that has a handful of files.

[go-nuts] Re: Is it acceptable to make the optional parameter as varargs

2020-05-25 Thread sergey
Hello Amarjeet, You can actually don't check if len(options) is greater than one – if your package provides only single implementation of Option, than there is no way to pass something different than that backoffOption. But it also brings an ability to extend your constructor later. There is a

[go-nuts] Re: Is there a way to create a global variable inside go routine stack? so that i can access any time, without passing around between methods/functions. Crazy thought !!!..

2020-05-25 Thread Jake Montgomery
On Sunday, May 24, 2020 at 3:46:54 PM UTC-4, adithya...@gmail.com wrote: > > if i am not wrong, Even the main itself is a go routine, which have global > variables? > Perhaps you should describe a bit more what you mean? People seem to be making assumptions that you meant something different

Re: [go-nuts] Re: Is there a way to create a global variable inside go routine stack? so that i can access any time, without passing around between methods/functions. Crazy thought !!!..

2020-05-25 Thread Michael Jones
Variables are names associated with values, values that can *vary*, that is, can be changed. (Unlike constants, which are *constant* values.) In the beginning, all variables were global, and this was not good. Then came local variables, ones *local* to a function, which came and went as

[go-nuts] Build fails when using gollvm toolchain instead of go

2020-05-25 Thread sitilge
Hi, I've been trying to make this project https://github.com/intel-go/nff-go using a freshly built gollvm to get the code compiled into LLVM IR. The project builds fine when using the regular go toolchain, but when trying to build with gollvm, I get errors such as below: ../../asm/asm.s:

[go-nuts] Re: time.Ticker's behavior

2020-05-25 Thread Jake Montgomery
I'll take a crack at it. The behavior you see is one tick about 100ms after start, a second one marked as 200ms after start, then one 1200ms, one at 2200, and another at 3200ms after start. The key is in the documentation for NewTicke r: "It adjusts the

[go-nuts] Re: time.Ticker's behavior

2020-05-25 Thread Brian Candler
You asked for ticks at 100ms intervals, but your receiver has a time.Sleep(1*time.Second). See https://golang.org/pkg/time/#NewTicker "It adjusts the intervals or drops ticks to make up for slow receivers." -- You received this message because you are subscribed to the Google Groups

Re: [go-nuts] Maddy - composable all-in-one mail server

2020-05-25 Thread Kevin Chadwick
Looks quite good, but when did security become interchangeable with encryption support. "Single process model allows more efficient implementation." Why does security so often take a back seat to security. Also I doubt the qmail or OpenSMTPD priv sep models would slow it down. It might, if tcp

Re: [go-nuts] Is it acceptable to make the optional parameter as varargs

2020-05-25 Thread Amarjeet Anand
Thanks Robert for the nice idea. Using builder pattern to set options didn't come to my mind. Looks really clean. On Mon, 25 May, 2020, 10:55 AM robert engels, wrote: > I think the Builder pattern is easier than this, and it retains the > property of both ‘config struct’ and ‘multiple args’

[go-nuts] Re: Is there a way to create a global variable inside go routine stack? so that i can access any time, without passing around between methods/functions. Crazy thought !!!..

2020-05-25 Thread adithyasashasai
Yeah this works, but you can say this as workaround, what i really want is, does native go support? if not why? On Monday, May 25, 2020 at 7:57:17 AM UTC+5:30, tokers wrote: > > You may try to inspect this go package: https://github.com/jtolio/gls > -- You received this message because you are