[go-nuts] Release 1.11.1 arrival estimate

2018-09-27 Thread Francis
Does anyone have a feeling for when the 1.11.1 release will be ready I can see from https://github.com/golang/go/milestone/80 that it's about half done with no release date. But does anyone have a clearer feeling for when it might be ready by? We are reluctant to deploy with the DNS regressio

Re: [go-nuts] Huge map[string]*Object and GC where *Object is from sync.Pool

2018-09-27 Thread Francis
It's unclear to me how this could be useful. It is true that uintptr is not looked at by the garbage collector. This will definitely reduce your GC costs. But there is no way (that I know of) to convert your uintptr back into a *Object that is safe. Because uintptr is ignored by the GC it won't

Re: [go-nuts] Huge map[string]*Object and GC where *Object is from sync.Pool

2018-09-27 Thread Francis
very surprising implementation of sync.Pool. On Thursday, 27 September 2018 19:28:07 UTC+2, Peter Mogensen wrote: > > > > On 09/27/2018 07:19 PM, Francis wrote: > > It is true that uintptr is not looked at by the garbage collector. This > > will definitely reduce your GC costs. B

Re: [go-nuts] Huge map[string]*Object and GC where *Object is from sync.Pool

2018-09-27 Thread Francis
you would be pointing into memory the runtime thought had been freed. On Thursday, 27 September 2018 19:52:41 UTC+2, Peter Mogensen wrote: > > > > On 09/27/2018 07:44 PM, Francis wrote: > > I believe the pool does not track the objects that it returns from a > > call to `

Re: [go-nuts] Release 1.11.1 arrival estimate

2018-09-27 Thread Francis
Thanks Ian, I will start agitating. :) On Friday, 28 September 2018 00:17:38 UTC+2, Ian Lance Taylor wrote: > > On Thu, Sep 27, 2018 at 4:07 AM, Francis > wrote: > > Does anyone have a feeling for when the 1.11.1 release will be ready > > > > I can see from h

[go-nuts] pprof labels usage details

2019-01-03 Thread Francis
I would like to use pprof labels, but it seems like I would need to pass a `context.Context` into all new goroutines and re-call pprof.Do at each of these stages. Am I mistaken here. specifically if we had unc handleFoo(ctx context.Context) { pprof.Do(ctx, pprof.Labels("foo"), func(ctx con

[go-nuts] Re: pprof labels usage details

2019-01-03 Thread Francis
context.Context) { go interestingFunc() }) } Works better. On Thursday, 3 January 2019 15:22:06 UTC+1, Francis wrote: > > > I would like to use pprof labels, but it seems like I would need to pass a > `context.Context` into all new goroutines and re-call pprof.Do at each of > these

[go-nuts] Re: pprof labels usage details

2019-01-03 Thread Francis
2019 16:09:09 UTC+1, Francis wrote: > > Please note the original example won't run properly. `pprof.Labels()` > takes an even number of strings, since it's setting key/value pairs. > > func handleFoo(ctx context.Context) { > labels := pprof.Labels("foo", &

[go-nuts] Clarification on unsafe conversion between string <-> []byte

2019-09-18 Thread Francis
I am looking at the correct way to convert from a byte slice to a string and back with no allocations. All very unsafe. I think these two cases are fairly symmetrical. So to simplify the discussion below I will only talk about converting from a string to []byte. func StringToBytes(s string) (b

Re: [go-nuts] Clarification on unsafe conversion between string <-> []byte

2019-09-20 Thread Francis
ly see how to avoid using the StringHeader in this case. F On Wednesday, 18 September 2019 22:46:44 UTC+2, Ian Lance Taylor wrote: > > On Wed, Sep 18, 2019 at 2:42 AM Francis > wrote: > > > > I am looking at the correct way to convert from a byte slice to a string > and

Re: [go-nuts] Clarification on unsafe conversion between string <-> []byte

2019-09-23 Thread francis
; func bytesToString(b []byte) string { > return *(*string)(unsafe.Pointer(&b)) > } > > https://play.golang.org/p/azJPbl946zj > > On Fri, 2019-09-20 at 13:30 -0700, Francis wrote: > > Thanks Ian, that's a very interesting solution. > > > > Is there a so

Re: [go-nuts] Clarification on unsafe conversion between string <-> []byte

2019-09-23 Thread francis
; func bytesToString(b []byte) string { > return *(*string)(unsafe.Pointer(&b)) > } > > https://play.golang.org/p/azJPbl946zj > > On Fri, 2019-09-20 at 13:30 -0700, Francis wrote: > > Thanks Ian, that's a very interesting solution. > > > > Is there a so

Re: [go-nuts] Clarification on unsafe conversion between string <-> []byte

2019-09-23 Thread francis
That's super interesting. Thanks for the pointer Jan :bow: On Monday, September 23, 2019 at 11:42:55 AM UTC+2, Jan Mercl wrote: > > On Mon, Sep 23, 2019 at 11:37 AM > wrote: > > > ... and the problems with storing a uinptr in a variable are mostly > related to moving garbage collectors ... > >

Re: [go-nuts] Clarification on unsafe conversion between string <-> []byte

2019-09-23 Thread Francis
So I think the current state of unsafe conversions of string <-> []byte is roughly 1. Use the reflect Slice/StringHeader struct. These structs give you clear fields to set and read from. If the runtime representation of a string or []byte ever changes then these structs should change to reflect

Re: [go-nuts] Clarification on unsafe conversion between string <-> []byte

2019-09-24 Thread francis
T >> space - things like UnsafeString or FastString in Java I would caution >> against doing this in Go - especially as proposed here. Taking an immutable >> object like string and making it mutable by accident is a recipe for >> disaster. You are almost always better

Re: [go-nuts] Clarification on unsafe conversion between string <-> []byte

2019-09-24 Thread francis
a recipe for > disaster. You are almost always better mapping a struct with accessors and > letting Go escape analysis perform the work on the stack and keep the > safety. > > > > On Sep 23, 2019, at 10:09 AM, Francis > > wrote: > > So I think the current stat

[go-nuts] Re: Clarification on unsafe conversion between string <-> []byte

2019-10-04 Thread francis
jfcg/sixb> with many > tests to ensure the conversion assumptions are correct. It could be helpful. > > Cheers.. > > On Wednesday, September 18, 2019 at 12:42:31 PM UTC+3, Francis wrote: >> >> I am looking at the correct way to convert from a byte slice to a string

[go-nuts] Re: Clarification on unsafe conversion between string <-> []byte

2019-10-04 Thread francis
I wrote a self contained implementation of the solution described by Keith Randall. It seemed at the end of this long thread it would be nice to have something concrete to look at. https://github.com/fmstephe/unsafeutil On Friday, October 4, 2019 at 11:38:22 AM UTC+2, Francis Stephens wrote

[go-nuts] Re: Clarification on unsafe conversion between string <-> []byte

2019-10-07 Thread francis
Thank you Serhat :) On Monday, October 7, 2019 at 10:04:05 AM UTC+2, Serhat Şevki Dinçer wrote: > > Turns out it did not really need uintptr so I switched to unsafe.Pointer. > Also added more tests. > > Thanks Francis.. > > On Friday, October 4, 2019 at 12:38:22 PM UTC+3, fr

[go-nuts] Surprising benchmark allocations

2016-09-02 Thread Francis
I have been working to reduce allocations in a local cache and found some confusing behaviour around the allocs/op output when benchmarking. A simplified reproducing version is pasted at bottom. The behaviour is that setting a value in a single map yields 0 allocations, setting a value in two m

Re: [go-nuts] Re: Surprising benchmark allocations

2016-09-04 Thread Francis
rving the 'once per b.N' rule is duly noted :) On Friday, 2 September 2016 22:51:01 UTC+2, peterGo wrote: > > Francis, > > And, of course, > > keyVals := make([]string, b.N*10) > // ... > for _, key := range keyVals { > setTwo(s, key) >

Re: [go-nuts] Re: Surprising benchmark allocations

2016-09-04 Thread Francis
21:31:04 UTC+2, Francis wrote: > > Thanks Peter, > > Your observation cracked the mystery for me. There were two things that > were causing me confusion. > > 1: That we were not observing any allocations at all, even though the > map/s must be allocating. > 2: Th

[go-nuts] fasthttp redirect control

2016-11-03 Thread Francis
I would like to be able to use the fasthttp client. But I need to be able to control the redirect logic. Specifically I would like to limit the number of redirects and abort the request if it redirects to a specific host. I am able to do that using the `http.Client.CheckRedirect` function, but

[go-nuts] A quick question about allocations when creating interface{} values

2016-12-06 Thread Francis
Today I was exploring some unexpected allocations that came from creating empty interface{} values wrapping a string and an int. I spent some time trying to clarify my understanding so I wouldn't be surprised in the future. I have consulted this excellent page http://research.swtch.com/interfac

Re: [go-nuts] A quick question about allocations when creating interface{} values

2016-12-06 Thread Francis
> On Tue, Dec 6, 2016 at 8:08 AM, Francis > wrote: > > Today I was exploring some unexpected allocations that came from > creating > > empty interface{} values wrapping a string and an int. I spent some time > > trying to clarify my understanding so I wouldn't be

[go-nuts] Re: Measure/monitor Go CPU usage by garbage collector over time?

2017-02-08 Thread francis
I would also very much like to have access to this finer grained information. On Wednesday, January 11, 2017 at 11:55:34 PM UTC+1, Ian Rose wrote: > > Howdy, > > What's the best way to monitor the amount of CPU being consumed by a Go > server's GC? MemStats.GCCPUFraction doesn't really help bec

Re: [go-nuts] Latency spike during GC

2017-06-01 Thread Francis
Xun Liu, Are you able to post the actual trace here? I appreciate that it contains information about your source code, so I can understand if you don't want to share it. But I would be very interested to look at the full trace. Thanks Francis On Wednesday, 31 May 2017 21:02:33 UTC+2, Xu

Re: [go-nuts] Latency spike during GC

2017-07-07 Thread Francis
When you describe the first and second half of gc are you referring to the mark and sweep phases? -- 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+un

Re: [go-nuts] main.go:1:1: expected 'package', found 'EOF'

2021-11-16 Thread Francis
Thank you all, CRTL + S , was the trick!.. I had a similar problem. On Thursday, April 20, 2017 at 12:45:07 AM UTC rame...@gmail.com wrote: > Thank you, Nico. > > > On Friday, January 23, 2015 at 6:16:15 AM UTC-8, Nico wrote: >> >> Did you save before calling GoRun? >> > -- You received this m

[go-nuts] Dependency hell with Go modules

2019-01-17 Thread Francis Chuang
possible, because I'd like to use go modules to manage my dependencies. Are there any other options I've missed? Cheers, Francis -- You received this message because you are subscribed to the Google Groups "golang-nuts" group. To unsubscribe from this group and stop rece

Re: [go-nuts] Dependency hell with Go modules

2019-01-17 Thread Francis Chuang
wrote: > > On Fri, Jan 18, 2019 at 07:18:41AM +1300, Justin Israel wrote: > > On Fri, Jan 18, 2019, 12:36 AM Francis Chuang > wrote: > > > > > Hey everyone, > > > > > > I was wondering if I can get some ideas on how to solve this > dep

[go-nuts] How do I update all direct and indirect dependencies in go.mod

2019-02-26 Thread Francis Chuang
I have dependencies (direct and some indirect) listed in my go.mod file. This was initially populated using `go ./...` after creating the go.mod using `go mod init`. I now want to upgrade the dependencies and the indirect dependencies in the go.mod file to their latest versions. If I run `go g

[go-nuts] Re: How do I update all direct and indirect dependencies in go.mod

2019-02-26 Thread Francis Chuang
Thanks for the tip! I've subscribed to your github issue as well. Hopefully, it will be implemented in 1.13, as I feel that this is a pretty common usecase. On Wednesday, February 27, 2019 at 12:06:13 PM UTC+11, thepud...@gmail.com wrote: > > Hi Francis, > > To ask

[go-nuts] Will database/sql leak memory if I don't call Close() and remove references to it?

2016-10-31 Thread Francis Chuang
ishes and no longer hold references to the old sql instance. The old sql instance is GC'd. Is this possible without calling Close()? 4. New goroutines are launched and they use the new sql instance. Cheers, Francis -- You received this message because you are subscribed to the Google Gr

[go-nuts] Re: Will database/sql leak memory if I don't call Close() and remove references to it?

2016-11-01 Thread Francis Chuang
pport changing/updating the DSN for a connection pool. Francis -- 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. F

[go-nuts] Re: Will database/sql leak memory if I don't call Close() and remove references to it?

2016-11-01 Thread Francis Chuang
Just some further questions. I think the easiest way would be to combine ksug and Chris' suggestions. I would prefer not having to maintain a wrapper for each database as we talk to quite a few different types of databases using database/sql. Does this some bullet proof? 1. Rotate usernames/pas

[go-nuts] import csv file

2016-08-18 Thread francis badasu
Hi guys, How do i import a csv file and save it in sql or sqlite thanks in advance -- 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...@g

[go-nuts] Re: import csv file

2016-08-19 Thread francis badasu
This is a snippets of the first part of my code package main import ( "encoding/csv" "fmt" "os" ) func main() { file, err := os.Open("Account_balances.csv") if err != nil { fmt.Println("Error", err) return } defer file.Close() reader := csv.NewReader(file) record, err := reader.Rea

[go-nuts] Re: import csv file

2016-08-19 Thread francis badasu
Yh, thanks so much. but still getting this error when i run it. undefined: sql in sql.Open > > -- 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+unsu

[go-nuts] Re: import csv file

2016-08-19 Thread francis badasu
loud and clear -- You received this message because you are subscribed to the Google Groups "golang-nuts" group. To unsubscribe from this group and stop receiving emails from it, send an email to golang-nuts+unsubscr...@googlegroups.com. For more options, visit https://groups.google.com/d/optou

[go-nuts] Should a program always exit in main()?

2017-02-07 Thread Francis Chuang
s is the most idiomatic? Cheers, Francis -- You received this message because you are subscribed to the Google Groups "golang-nuts" group. To unsubscribe from this group and stop receiving emails from it, send an email to golang-nuts+unsubscr...@googlegroups.com. For more options, visit https://groups.google.com/d/optout.

[go-nuts] Re: Should a program always exit in main()?

2017-02-08 Thread Francis Chuang
I made a mistake with my example. c.Start() needs to be a separate go routine because it is an infinite loop waiting for messages: go c.Start(). In that case, I am guessing an errors channel would be the best? Cheers, Francis -- You received this message because you are subscribed to the