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
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
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
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
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
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
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
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 ...
>
>
; 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
; 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
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
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
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
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
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
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
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", &
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
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
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
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 `
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
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
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
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
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
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
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
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.
> 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
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
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
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
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
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
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
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)
>
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
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
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
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
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
42 matches
Mail list logo