Re: [go-nuts] Create a 1GB ballast but it takes up RSS and pages are Dirty?

2022-11-06 Thread tapi...@gmail.com
I ever also found this problem: global ballast doesn't work. So I always use local ballast instead now. On Sunday, November 6, 2022 at 8:37:55 PM UTC+8 hit.zh...@gmail.com wrote: > Before, I think the memory is allocated by mmap anon, which Linux OS > guarantees reading will return zero value an

Re: [go-nuts] Shellquote in stdlib

2022-11-06 Thread Kurtis Rader
On Sun, Nov 6, 2022 at 8:48 PM 'Christian Stewart' via golang-nuts < golang-nuts@googlegroups.com> wrote: > There have been several discussions about shellquote in go-nuts in the > past: > > https://github.com/kballard/go-shellquote > https://github.com/gonuts/go-shellquote > > I've found it neces

[go-nuts] Shellquote in stdlib

2022-11-06 Thread 'Christian Stewart' via golang-nuts
Hi all, There have been several discussions about shellquote in go-nuts in the past: https://github.com/kballard/go-shellquote https://github.com/gonuts/go-shellquote I've found it necessary to use both Split and Join in some cases when working with exec.Command. This seems like the type of th

[go-nuts] Re: Parsing comments that don't start with a space

2022-11-06 Thread 'Christian Stewart' via golang-nuts
Hi all, Figured it out: the comments appear in the comment.List, but not comment.Text(): cmap := ast.NewCommentMap(fset, codeFile, codeFile.Comments) for nod, comments := range cmap { for _, comment := range comments { comment.Text() // Does not contain comments w/o a space before th

Re: [go-nuts] Parsing comments that don't start with a space

2022-11-06 Thread 'Dan Kortschak' via golang-nuts
On Sun, 2022-11-06 at 11:55 -0800, 'Christian Stewart' via golang-nuts wrote: >  - Why does the comment not appear unless I put a space before? (in > ast CommentMap) This is explained here https://pkg.go.dev/go/ast#CommentGroup.Text > Comment directives like "//line" and "//go:noinline" are also

[go-nuts] Parsing comments that don't start with a space

2022-11-06 Thread 'Christian Stewart' via golang-nuts
Hi all, I'm trying to use packages.Load to parse the following comment: // Thing does something. // //my:value do-something I'm trying to parse the my:value comment similar to go:embed. Interestingly the comment does not appear in the AST unless I put a space: // my:value do-something My ques

Re: [go-nuts] Re: Unicode variable name error

2022-11-06 Thread Bakul Shah
In Indic scripts in certain contexts you have to use a vowel sign for the typography to make sense; you can’t use a vowel letter in its place. So for example the middle “ku” in my name has to be written as ક+ુ — which will be rendered as કુ — even though it is equivalent to ક+્+ઉ. Also, “halant” (્

Re: [go-nuts] Create a 1GB ballast but it takes up RSS and pages are Dirty?

2022-11-06 Thread Kn (Kn)
Before, I think the memory is allocated by mmap anon, which Linux OS guarantees reading will return zero value and no physical pages allocated. When writing happens, the physical pages will be allocated. Then I think the create a byte slice maybe the same. Your idea is clear. I agree with it.

Re: [go-nuts] Create a 1GB ballast but it takes up RSS and pages are Dirty?

2022-11-06 Thread Kn (Kn)
@ On Sunday, November 6, 2022 at 8:11:51 PM UTC+8 Jan Mercl wrote: > On Sun, Nov 6, 2022 at 12:54 PM Kn (Kn) wrote: > > > Now the problem begins. I expect the ballast like `ballast := > make([]byte, 1<<30)` shouldn't take up any physical memory because there's > no any writing to it. > > The b

Re: [go-nuts] Create a 1GB ballast but it takes up RSS and pages are Dirty?

2022-11-06 Thread Jan Mercl
On Sun, Nov 6, 2022 at 12:54 PM Kn (Kn) wrote: > Now the problem begins. I expect the ballast like `ballast := make([]byte, > 1<<30)` shouldn't take up any physical memory because there's no any writing > to it. The backing array is specified to be zeroed, so we cannot say there's no writing t

Re: [go-nuts] Re: Unicode variable name error

2022-11-06 Thread Rob Pike
% unicode -d పే U+0C2A 'ప' telugu letter pa U+0C47 'ే' telugu vowel sign ee % unicode -U C2A C47 U+0C2A 'ప' TELUGU LETTER PA category: Lo canonical combining classes: 0 bidirectional category: L mirrored: N U+0C47 'ే' TELUGU VOWEL SIGN EE category: Mn canonical combining classes: 0 bidi

[go-nuts] Create a 1GB ballast but it takes up RSS and pages are Dirty?

2022-11-06 Thread Kn (Kn)
Hi, guys, I have a question about memory management. I created a ballast in my go application, I didn't create the ballast in the very beginning like initializing a global variable or do this in package level init functions. I initialize it later after some setup process. Now the problem begin

Re: [go-nuts] Refactor Asynchronous JS to Go

2022-11-06 Thread Konstantin Khomoutov
On Sun, Nov 06, 2022 at 02:42:52PM +0400, Konstantin Khomoutov wrote: [...] > The chief idea of Go's concurrency is that it's integrated into the language's > code - as opposed to be bolted on in form of a library Sorry, I meant core, of course, not code. -- You received this message because you

Re: [go-nuts] Re: Unicode variable name error

2022-11-06 Thread Konstantin Khomoutov
On Sun, Nov 06, 2022 at 01:45:53PM +0530, Nikhilesh Susarla wrote: >> Per the Go spec[1], an identifier consists of a Unicode letter followed by >> zero or more Unicode letters or digits. The character పే is in the Unicode >> category nonspacing mark rather than the category letter. [...] > So, if

Re: [go-nuts] Refactor Asynchronous JS to Go

2022-11-06 Thread Konstantin Khomoutov
On Sun, Nov 06, 2022 at 01:33:59AM +0530, Shubh Karman Singh wrote: > I am refactoring a JS library to Go. I have some questions but I'm not able > to find some concrete answers for this. > 1. What's the idiomatic way to refactor Asynchronous JS APIs to Go? > 2. How to refactor Callbacks from JS t

Re: [go-nuts] Error Interfaces

2022-11-06 Thread Jason Phillips
Also note that in your original example you created two unique pointers to your error type. Even if the errors created using errors.New were equal, your example would never return true. https://play.golang.com/p/A7SltVZTlvW On Sunday, November 6, 2022 at 12:43:26 AM UTC-4 nikhil...@gmail.com wr