[go-nuts] Re: Short destination error with unicode.Transform

2023-01-12 Thread Joe Schafer
Update after seeing the error again.

I inlined everything, creating the transformer on every invocation, to 
avoid any races, but the error persists. 
https://gist.github.com/jschaf/bd600ce71ad3798af6c160d74904ac9c

I'm unable to reproduce the error locally. My current plan is to attempt to 
workaround the issue and use transform.String instead of calling Transform 
directly.

My best guess is that I needed to allocate a larger buffer than the input 
buffer because normalization form D (and C?) may expand characters greater 
than unicode.MaxASCII to multiple bytes. The error occurs with the 
following strings (not a regular apostrophe):

wind-Andy’s
wind-Carr’s

I've tested that hypothesis unsuccessfully 
at https://go.dev/play/p/6FT6KHzeBwM.

On Saturday, July 30, 2022 at 12:13:27 AM UTC-7 Brian Candler wrote:

> If this is non-repeatable then perhaps it is some sort of race? Have you 
> tried running your code with the race detector enabled?
>
> On Saturday, 30 July 2022 at 03:01:39 UTC+1 j...@simplecircle.io wrote:
>
>> I had a curious bug appear in my server logs when using a unicode 
>> Transformer:
>>
>> transform unicode "wind-Pa\x00\x00\x00" to ascii: transform: short 
>> destination buffer
>>
>> Here's the simplified code that caused the error (Gist 
>>  and Go 
>> Playground ). I assumed that 
>> converting from unicode to ascii would always have an equal or smaller 
>> length, hence the panic. Here's the essential bits of the simplified code:
>>
>> cs := []byte("wind-Pa\x00\x00\x00")
>> chars := make([]byte, len(cs))
>> t := transform.Chain(norm.NFD, runes.Remove(runes.In(unicode.Mn)), 
>> norm.NFC)
>> nDst, _, err := t.Transform(chars, cs, true)
>>
>> I suspect the error is thrown by text/runes.go:149 
>>  (or 
>> perhaps on line 165) by the remove transformer. It looks like the form 
>> transformers never throw ErrShortDestination.
>>
>> I haven't been able to reproduce the error on my dev mac or on the 
>> playground and there's only been a single occurrence of the error in my 
>> server logs. The server binary was compiled with Bazel for 
>> the @io_bazel_rules_go//go/toolchain:linux_amd64 toolchain using Go 
>> version 1.18.4.
>>
>> I'd like to understand when ErrShortDestination is thrown by the 
>> Transformer. My code allocates a buffer the same length as the input so I 
>> thought I'd avoid the short destination error.
>>
>

-- 
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/d99ab4e6-b945-450b-8ce7-b23e74b64a41n%40googlegroups.com.


[go-nuts] Re: [golang-dev] Go 1.20 Release Candidate 3 is released

2023-01-12 Thread 'Heschi Kreinick' via golang-nuts
Hi gophers,

This is a small RC that primarily includes the latest fix for
https://go.dev/issue/56784, crashes while running processes with os/exec on
macOS and iOS. All testing is always welcome, but we're particularly
interested in that bug.

Thanks,
Heschi for the Go team

On Thu, Jan 12, 2023 at 12:19 PM  wrote:

> Hello gophers,
>
> We have just released go1.20rc3, a release candidate version of Go 1.20.
> It is cut from release-branch.go1.20 at the revision tagged go1.20rc3.
>
> 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://go.dev/issue/new
>
> If you have Go installed already, an easy way to try go1.20rc3
> is by using the go command:
> $ go install golang.org/dl/go1.20rc3@latest
> $ go1.20rc3 download
>
> You can download binary and source distributions from the usual place:
> https://go.dev/dl/#go1.20rc3
>
> To find out what has changed in Go 1.20, read the draft release notes:
> https://tip.golang.org/doc/go1.20
>
> Cheers,
> Carlos and Heschi for the Go team
>
> --
> You received this message because you are subscribed to the Google Groups
> "golang-dev" group.
> To unsubscribe from this group and stop receiving emails from it, send an
> email to golang-dev+unsubscr...@googlegroups.com.
> To view this discussion on the web visit
> https://groups.google.com/d/msgid/golang-dev/xLIi-2sLQ7uaRZ6ZyJwbKw%40geopod-ismtpd-5-1
> 
> .
>

-- 
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/CAAnZ_26oKpwy53E%3DMYwU6jUM%3DPaTiPD4U%3DKba%2BZBoKg82G1wkA%40mail.gmail.com.


Re: [go-nuts] Re: Design patterns. builder ?

2023-01-12 Thread alex-coder
Hi All !

In case some one is in interest of the builder patterm industrial 
implementation.
So, I have found that there are a very intresting use the package  named 
https://github.com/spf13/cobra.
The package should be considered In context of the builder pattern 
implementation for realizaton of the template pattern to implement 
command/fasade pattern.
And to say everything above a little bit simpler: package is used to build 
CLI.
Sorry, English is not native for me. :-)

Thank you.

суббота, 3 апреля 2021 г. в 14:13:39 UTC+3, alex-coder: 

> Hi, 
> thank you for  everyone!
>
> The main point here is: "generally isn't needed", but sometimes structure 
> does not come described properly in some kind of string representation. :-)
> the pair Func / funchandler - just excellent ! 
> But what about other GO-4 patterns, I mean "isn't needed in go" ?
> Where take a look at ?
>
> Thank you.
>
> On Thursday, April 1, 2021 at 4:29:14 PM UTC+3 ren...@ix.netcom.com wrote:
>
>> The Go protobufs impl uses the builder pattern. 
>>
>> On Apr 1, 2021, at 2:21 AM, Brian Candler  wrote:
>>
>> The builder pattern generally isn't needed in go, because go has 
>> flexible struct literals where you can omit any members you don't want. 
>>
>>
>> You can implement it if you like, but it just adds a layer of boilerplate:
>> https://gist.github.com/vaskoz/10073335
>>
>> Some people are drawn to functional options instead:
>> https://dave.cheney.net/2014/10/17/functional-options-for-friendly-apis
>>
>> https://www.calhoun.io/using-functional-options-instead-of-method-chaining-in-go/
>>
>> But if you look at the standard library as a source of inspiration and 
>> good practice, complex configuration is typically done via structs.  See 
>> for example http.Server 
>>
>> -- 
>> 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...@googlegroups.com.
>> To view this discussion on the web visit 
>> https://groups.google.com/d/msgid/golang-nuts/39e38cd7-93ee-4084-89e4-a22bcd1baaa6n%40googlegroups.com
>>  
>> 
>> .
>>
>>

-- 
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/88d9f62e-4a2f-4623-8f50-0fdbb33f58f9n%40googlegroups.com.


[go-nuts] Go 1.20 Release Candidate 3 is released

2023-01-12 Thread announce
Hello gophers,

We have just released go1.20rc3, a release candidate version of Go 1.20.
It is cut from release-branch.go1.20 at the revision tagged go1.20rc3.

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://go.dev/issue/new

If you have Go installed already, an easy way to try go1.20rc3
is by using the go command:
$ go install golang.org/dl/go1.20rc3@latest
$ go1.20rc3 download

You can download binary and source distributions from the usual place:
https://go.dev/dl/#go1.20rc3

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

Cheers,
Carlos and Heschi for 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/xLIi-2sLQ7uaRZ6ZyJwbKw%40geopod-ismtpd-5-1.


[go-nuts] Re: Automation with the ultimate guide to GO language

2023-01-12 Thread Jozef Reisinger
"Although the official logo  has two 
capital letters, the language name is written Go, not 
GO." https://go.dev/doc/faq#go_or_golang

On Wednesday, January 11, 2023 at 9:27:46 PM UTC+1 ashwin...@gmail.com 
wrote:

> Unlock the full potential of automation with the ultimate guide to GO 
> language. Discover the power of GO's efficient and streamlined syntax while 
> mastering key techniques for automating repetitive tasks and optimizing 
> performance. Whether you're a seasoned developer or new to programming, 
> this book is an essential resource for mastering GO and driving your 
> automation projects to success.
>
> https://www.amazon.com/dp/B0BRDG5Y4P
>
>
>
>
>

-- 
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/73b75528-36a3-44dd-a8a1-1767c534e148n%40googlegroups.com.


Re: [go-nuts] Re: Debugging memory leak when a GO process crashed

2023-01-12 Thread Robert Engels
You can certainly have memory leaks in Go - due to undesired references 
retaining the object. What the op is asking for is a memory dump at OOM crash. 

If the dump shows 1M object X and the author believes there should only be 1 - 
you have a leak   

> On Jan 12, 2023, at 4:01 AM, mariappan balraj  
> wrote:
> 
> 
> Hi Brian,
> 
> A Go program can crash because of Out of Memory. Yes it can be because of 
> goroutine leak. Or it can have some reference to global variables, but it 
> should be freed? How to debug this?
> When the leak is happening while using CGO, is there any tool to debug this?
> 
> Best Regards
> Mariappan
> 
> On Thu, Jan 12, 2023 at 2:19 PM Brian Candler  wrote:
>> I think you're not being clear on your problem you're trying to solve.
>> 
>> There are no "memory leaks" in Go in the traditional sense (omitting to free 
>> an allocation) because of the garbage collector. Therefore, if memory is not 
>> being freed in a pure Go program, it's because you are keeping a reference 
>> to it somewhere - e.g. in a global variable, directly or indirectly. Or it 
>> could be referenced from a local variable in a goroutine which isn't 
>> terminating - in that case I'd say that's a goroutine leak, not a memory 
>> leak.  Is that the sort of thing you're trying to debug?
>> 
>> Or, is the situation that you're using CGO and forgetting to free some 
>> allocations in your C code?
>> 
>> Or, I've seen some people complain that Go doesn't not release unused memory 
>> back to the operating system as quickly as they'd like or expect, showing as 
>> high RSS. If that's your issue then it can be discussed.
>> 
>> On Thursday, 12 January 2023 at 03:58:52 UTC mariappa...@gmail.com wrote:
>>> Hello Go experts,
>>> 
>>> Can someone please help with this?
>>> 
>>> Best Regards
>>> Mariappan
>>> 
>>> On Tue, Jan 10, 2023 at 1:24 PM mariappan balraj  
>>> wrote:
 Hello Go experts,
 
 I could able to find the solution to debug memory leaks of GO process, 
 when it is running by using PPROF. Is it possible to collect the heap 
 profile for debugging, when GO process crashed using core dump? or what is 
 the recommended way to root cause the memory leak? Based on the need, 
 enabling PPROF and debugging may not be possible in the production 
 environment. Please help. 
 
 Best Regards
 Mariappan
>> 
>> -- 
>> 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/19a761a1-7707-4300-9128-93f22b9ee342n%40googlegroups.com.
> 
> -- 
> 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/CAKKWi6SKZr9x7-YoJNLLp57815bzg40wjCsYSYxtd7SQ2VMEUA%40mail.gmail.com.

-- 
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/390B033D-44D7-469B-BB36-88BF5A5D6D57%40ix.netcom.com.


Re: [go-nuts] Re: Debugging memory leak when a GO process crashed

2023-01-12 Thread mariappan balraj
Hi Brian,

A Go program can crash because of Out of Memory. Yes it can be because of
goroutine leak. Or it can have some reference to global variables, but it
should be freed? How to debug this?
When the leak is happening while using CGO, is there any tool to debug this?

Best Regards
Mariappan

On Thu, Jan 12, 2023 at 2:19 PM Brian Candler  wrote:

> I think you're not being clear on your problem you're trying to solve.
>
> There are no "memory leaks" in Go in the traditional sense (omitting to
> free an allocation) because of the garbage collector. Therefore, if memory
> is not being freed in a pure Go program, it's because you are keeping a
> reference to it somewhere - e.g. in a global variable, directly or
> indirectly. Or it could be referenced from a local variable in a goroutine
> which isn't terminating - in that case I'd say that's a goroutine leak, not
> a memory leak.  Is that the sort of thing you're trying to debug?
>
> Or, is the situation that you're using CGO and forgetting to free some
> allocations in your C code?
>
> Or, I've seen some people complain that Go doesn't not release unused
> memory back to the operating system as quickly as they'd like or expect,
> showing as high RSS. If that's your issue then it can be discussed.
>
> On Thursday, 12 January 2023 at 03:58:52 UTC mariappa...@gmail.com wrote:
>
>> Hello Go experts,
>>
>> Can someone please help with this?
>>
>> Best Regards
>> Mariappan
>>
>> On Tue, Jan 10, 2023 at 1:24 PM mariappan balraj 
>> wrote:
>>
>>> Hello Go experts,
>>>
>>> I could able to find the solution to debug memory leaks of GO process,
>>> when it is running by using PPROF. Is it possible to collect the heap
>>> profile for debugging, when GO process crashed using core dump? or what is
>>> the recommended way to root cause the memory leak? Based on the need,
>>> enabling PPROF and debugging may not be possible in the production
>>> environment. Please help.
>>>
>>> Best Regards
>>> Mariappan
>>>
>> --
> 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/19a761a1-7707-4300-9128-93f22b9ee342n%40googlegroups.com
> 
> .
>

-- 
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/CAKKWi6SKZr9x7-YoJNLLp57815bzg40wjCsYSYxtd7SQ2VMEUA%40mail.gmail.com.


[go-nuts] Re: Debugging memory leak when a GO process crashed

2023-01-12 Thread Brian Candler
I think you're not being clear on your problem you're trying to solve.

There are no "memory leaks" in Go in the traditional sense (omitting to 
free an allocation) because of the garbage collector. Therefore, if memory 
is not being freed in a pure Go program, it's because you are keeping a 
reference to it somewhere - e.g. in a global variable, directly or 
indirectly. Or it could be referenced from a local variable in a goroutine 
which isn't terminating - in that case I'd say that's a goroutine leak, not 
a memory leak.  Is that the sort of thing you're trying to debug?

Or, is the situation that you're using CGO and forgetting to free some 
allocations in your C code?

Or, I've seen some people complain that Go doesn't not release unused 
memory back to the operating system as quickly as they'd like or expect, 
showing as high RSS. If that's your issue then it can be discussed.

On Thursday, 12 January 2023 at 03:58:52 UTC mariappa...@gmail.com wrote:

> Hello Go experts,
>
> Can someone please help with this?
>
> Best Regards
> Mariappan
>
> On Tue, Jan 10, 2023 at 1:24 PM mariappan balraj  
> wrote:
>
>> Hello Go experts,
>>
>> I could able to find the solution to debug memory leaks of GO process, 
>> when it is running by using PPROF. Is it possible to collect the heap 
>> profile for debugging, when GO process crashed using core dump? or what is 
>> the recommended way to root cause the memory leak? Based on the need, 
>> enabling PPROF and debugging may not be possible in the production 
>> environment. Please help. 
>>
>> Best Regards
>> Mariappan
>>
>

-- 
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/19a761a1-7707-4300-9128-93f22b9ee342n%40googlegroups.com.