Re: [go-nuts] Making Go More Accessible to Non-English Speakers

2025-03-16 Thread Zhang Jie (Kn)
Language is a tool, every programmer should learn the tool if they want to use them. For Non-English speakers, I think what go team can do is to make the documentation more clearer, use short statements and simple English syntax. Just like Linux man documents. On Monday, March 17, 2025 at 7:24:

[go-nuts] Re: Networking in Go

2025-03-11 Thread Zhang Jie (Kn)
If you want to learn network programming in Go, you can check this project [trpc](https://github.com/Tencent/trpc). trpc-cpp, trpc-go, trpc-java and other haven't been opensourced language versions. This is a microservice framework built for Tencent. You can learn many network programming best

[go-nuts] Re: Segment Header Table defines `.note.go.buildid` loaded, why?

2025-03-06 Thread Zhang Jie (Kn)
o get the right build id value. Please help. On Friday, March 7, 2025 at 11:22:02 AM UTC+8 Zhang Jie (Kn) wrote: > From the output of `readelf -l ` , we can see `.note.go.buildid` and > `.text` sections are both loaded. > > I want to know why `.note.go.buildid` is loaded, it seem

[go-nuts] Re: Segment Header Table defines `.note.go.buildid` loaded, why?

2025-03-06 Thread Zhang Jie (Kn)
o get the right build id value. Please help. On Friday, March 7, 2025 at 11:22:02 AM UTC+8 Zhang Jie (Kn) wrote: > From the output of `readelf -l ` , we can see `.note.go.buildid` and > `.text` sections are both loaded. > > I want to know why `.note.go.buildid` is loaded, it seem

[go-nuts] Segment Header Table defines `.note.go.buildid` loaded, why?

2025-03-06 Thread Zhang Jie (Kn)
>From the output of `readelf -l ` , we can see `.note.go.buildid` and `.text` sections are both loaded. I want to know why `.note.go.buildid` is loaded, it seems go source code doesn't read it at all. I read the discussion here: https://github.com/golang/go/issues/68652. Looks like gobuildid s

Re: [go-nuts] Help me study resources or guides

2023-05-23 Thread Zhang Jie (Kn)
1. https://go101.org, from beginner to true gopher 2. go perf book, search it from github, this will teach you some optimization techniques 3. here's a reading list about golang internals: https://hitzhangjie.notion.site/149643669e0846e6b8e3294d04a6df0d?v=e1cea88688ec4102ae5d9af8cf9ac4c7, ac

Re: [go-nuts] Help me study resources or guides

2023-05-23 Thread Zhang Jie (Kn)
Here're some good materials: 1. https://go101.org, after learning this, you will be a true gopher. 2. go语言设计实现,maybe there's no English version. When I learns golang, I want to know its internals, and I kept lots of good articles, here: https://www.notion.so/hitzhangjie/149643669e0846e6b8e3294d0

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

2022-11-15 Thread Kn (Kn)
;>>> >>>> Just now, I use gdb to dump the ballast anon memory and use hexdump to >>>> check its dirty content, all data is zero (Maybe zeroing happens). >>>> But after turning GC off, it works as expected (no RSS is taken, no >>>> DIRTY

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

2022-11-07 Thread Kn (Kn)
ust be something I didn't get it. >> >> 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 := >>>

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

2022-11-06 Thread Kn (Kn)
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. &

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

[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

[go-nuts] Ways to improve the fuzz testing?

2022-05-21 Thread Kn
Hi, guys. I'm learning the go fuzz testing in go 1.18 now. I find f.Add(args...) the seed corpus is really important. If I specify a seed corpus not so proper, the fuzz testing may spend lots of time, which is not meaningful. Are there ways to help the fuzz engine quickly find the better input

[go-nuts] Creating a shared C library out of go project to be loaded dynamically by other applications (C/Perl/Python) on AIX 7.2

2022-03-23 Thread miecc kn
Hello everyone, first time here so please bear with me. I got the tipp of asking this rather fringe case question here from comments on my /r/golang post. In brief I want to create a shared library out of a golang project so that it can be dynamically loaded by applications written in another

Re: [go-nuts] Which error handling pattern do you prefer?

2021-11-12 Thread Kn
nt is short, I use the one-line version, > otherwise (or if I need to use either result after the conditional) I use > the version with a separate statement. But that's a rule-of-thumb, as I > said, I decide case by case. > > On Fri, Nov 12, 2021 at 5:05 AM Kn wrote: > &g

Re: [go-nuts] Which error handling pattern do you prefer?

2021-11-12 Thread Kn
ents. If each error assignment statement only return single return value (the error itself), I code it in one-liner way. On Friday, November 12, 2021 at 4:53:21 PM UTC+8 Kn wrote: > > Oh, I have a typo error, in the second pattern, `err := doAnotherthing()` > should be `err = doAnotherth

Re: [go-nuts] Which error handling pattern do you prefer?

2021-11-12 Thread Kn
Oh, I have a typo error, in the second pattern, `err := doAnotherthing()` should be `err = doAnotherthing()`. On Friday, November 12, 2021 at 4:02:34 PM UTC+8 Brian Candler wrote: > func MyFunc() error { > v, err := doSomething() > ... > err := doAnotherthing() > } > > That won't compile a

[go-nuts] Which error handling pattern do you prefer?

2021-11-11 Thread Kn
Hi, guys, I want to know which error handling pattern do you prefer. Following is a code snippet from go stdlib. https://sourcegraph.com/github.com/golang/go/-/blob/src/net/http/h2_bundle.go?L1848 Let me simplify my questions: Pattern1: like the code in go stdlib, in the same function, we first

[go-nuts] Re: how to work around "go vet: possible misuse of unsafe.Pointer"?

2021-05-20 Thread Kn
I found this issue: https://github.com/golang/go/issues/41205. I found the answer, this conversation could be closed. On Thursday, May 20, 2021 at 3:39:28 PM UTC+8 Kn wrote: > So sorry I didn't get how to format the code in the edit window. > > On Thursday, May 20, 2021 at 3:37:

[go-nuts] Re: how to work around "go vet: possible misuse of unsafe.Pointer"?

2021-05-20 Thread Kn
So sorry I didn't get how to format the code in the edit window. On Thursday, May 20, 2021 at 3:37:35 PM UTC+8 Kn wrote: > Hi, guys, I need to acess shared memory, so I write some code like this: > > ```go > func shmget(key int, size int, mode int) (int, error)

[go-nuts] how to work around "go vet: possible misuse of unsafe.Pointer"?

2021-05-20 Thread Kn
Hi, guys, I need to acess shared memory, so I write some code like this: ```go func shmget(key int, size int, mode int) (int, error) { shmId, _, ret := syscall.Syscall(syscall.SYS_SHMGET, uintptr(key), uintptr(size), uintptr(mode)) if ret != 0 { return 0, fmt.Errorf("shmget ret: %d", ret) } retur

Re: [go-nuts] Cover report in multiple packages

2021-04-02 Thread Kn
Add option `-coverpkg=$(go list ./...|sed 's/ /,/g')` works. On Tuesday, May 24, 2016 at 9:31:52 PM UTC+8 Dave MacFarlane wrote: > If all you're trying to do is get coverage of all your subpackages for a > CI and aren't concerned about downstream packages or manually toggling > which ones are

Re: [go-nuts] Do we document the history of .gosymtab and .gopclntab, and the differences with .symtab and .debug_line, .debug_frame?

2020-11-26 Thread Kn
Ian, I understand now. Thanks you! :) On Friday, November 27, 2020 at 5:10:18 AM UTC+8 Ian Lance Taylor wrote: > On Thu, Nov 26, 2020 at 11:50 AM Kn wrote: > > > > Hi, I am writing a golang debugger and some documents to show others the > knowledge about how to develop

[go-nuts] Do we document the history of .gosymtab and .gopclntab, and the differences with .symtab and .debug_line, .debug_frame?

2020-11-26 Thread Kn
Hi, I am writing a golang debugger and some documents to show others the knowledge about how to develop a golang debugger. I notice go debug/elf, debug/gosym is enough for the occasions like lookup symbol, pcToLn, lnToPC, maybe even for backtrace? I want to know why go generate .gosymtab (now i