Re: [go-nuts] Understanding some gotchas with linking slices together via indexing

2022-11-01 Thread burak serdar
On Tue, Nov 1, 2022 at 10:49 PM Brian, son of Bob wrote: > Can anyone explain these gotchas (demo )? > I've tried reading articles on this [one > , two >

[go-nuts] There is a passage in book that is difficult to understand, can anyone help explain it?

2022-11-01 Thread GuanYun
Hello, This is a passage in book : There is a good reason Go’s mutexes are not re-entrant. The purpose of a mutex is to ensure that certain invariants of the shared variables are maintained a

[go-nuts] Understanding some gotchas with linking slices together via indexing

2022-11-01 Thread Brian, son of Bob
Can anyone explain these gotchas (demo )? I've tried reading articles on this [one , two ] but they don't go into enough detail. *Slight gotcha #1

Re: [go-nuts] Once again: Include files in go?

2022-11-01 Thread Kurtis Rader
I think you're looking for the "//go:generate" directive. Google "go generate" and/or read documents such as https://ehrt74.medium.com/go-generate-89b20a27f7f9 and https://go.dev/blog/generate. On Tue, Nov 1, 2022 at 7:44 PM Frank Jüdes wrote: > Hi friends, i have found a couple of threads about

Re: [go-nuts] Once again: Include files in go?

2022-11-01 Thread 'Christian Stewart' via golang-nuts
Frank, Am I missing something - can't you just put multiple go files in the same directory? All the go files in the directory will be combined into the same package. This is frequently used for other codegen, like Protobuf. Best, Christian Stewart On Tue, Nov 1, 2022, 7:44 PM Frank Jüdes wrot

Re: [go-nuts] How does the go compiler treat initialized string variables?

2022-11-01 Thread Frank Jüdes
Just had an idea: I printed the address of the initialized variable, and for comparison another variable that was created in the heap: Address of package variable: 0x818710 Address of Program variable: 0xc10028 Imho it is a safe assumption that the initialized data-structure is not located in

[go-nuts] Once again: Include files in go?

2022-11-01 Thread Frank Jüdes
Hi friends, i have found a couple of threads about how to include c-headers into go-programs, but nothing that i could use for my rather unique challenge: I have an SQL-Database in which test-cases are being defined in a couple of tables. Those test-cases will be exported by a PL/SQL program as

Re: [go-nuts] How does the go compiler treat initialized string variables?

2022-11-01 Thread Frank Jüdes
Thank you very much for the answer! - It actually turns out that my structure is a bit more complex than i though. The test-cases themself are a structure of seven strings and one in64 which are organized as a test-case list into a map[string] and those lists are organized into groups also as m

Re: [go-nuts] Underlying type constraints and pointers

2022-11-01 Thread 'Aaron Beitch' via golang-nuts
Thanks for your help here! You helped me realize the thing I really want access to is the methods of Foo and Bar, and not the struct fields (my example was misleading). What I would really like to have is a constraint that the type must have an underlying type of Foo, but that isn't working how

Re: [go-nuts] How do I set a pkg's version?

2022-11-01 Thread Chris Burkert
During CI/CD we create a json file with a few details (git tag, branch, hash, date, time). Afterwards we compile Go Code which embeds this file into the binary. During runtime flags like --version print the json. Note that this is about the version of some binary - not the version of a package. Ho

Re: [go-nuts] Occasional hard lockup w/ 100% CPU usage in go applications

2022-11-01 Thread Roland Müller
Hello, Am Dienstag, 1. November 2022 schrieb Robert Engels : > Also, enabling and generating core dumps is somewhat OS version specific - even between Linux versions - so you probably need to check your docs. > dumping core files is a kernel feature, but I think most Linux distros have it disable

Re: [go-nuts] How does the go compiler treat initialized string variables?

2022-11-01 Thread Jan Mercl
On Tue, Nov 1, 2022, 20:36 Frank Jüdes wrote: > I have to write a program that should verify the content of > configuration-servers. It will need a lot of pre-initialized data to verify > the actual content of a server, so it has to initialize many strings. What > i know from other C-style langua

[go-nuts] How does the go compiler treat initialized string variables?

2022-11-01 Thread Frank Jüdes
I have to write a program that should verify the content of configuration-servers. It will need a lot of pre-initialized data to verify the actual content of a server, so it has to initialize many strings. What i know from other C-style languages is, that code like var MyString *string = 'Hel

[go-nuts] Re: [security] Go 1.19.3 and Go 1.18.8 are released

2022-11-01 Thread Wojciech Kaczmarek
I think it's important to report that go1.18.8.windows-amd64.msi doesn't match the published sha256 checksum. wtorek, 1 listopada 2022 o 18:01:35 UTC+1 anno...@golang.org napisał(a): > Hello gophers, > > We have just released Go versions 1.19.3

[go-nuts] Go Crashes on a long running process (with stack trace)

2022-11-01 Thread Vineet Jain
We have a long running process that listens to and processes a large number of network packets. It died today with the following stack trace. Anyone seen this before, or have any idea what is causing it? Nov 01 12:40:30 sv_svc[100448]: I1101 12:40:30.865268 100448 stratconn.go:83] Message Seq

[go-nuts] [security] Go 1.19.3 and Go 1.18.8 are released

2022-11-01 Thread announce
Hello gophers, We have just released Go versions 1.19.3 and 1.18.8, minor point releases. These minor releases include 1 security fixes following the security policy : - syscall, os/exec: unsanitized NUL in environment variables On Windows, syscall.StartP

Re: [go-nuts] Occasional hard lockup w/ 100% CPU usage in go applications

2022-11-01 Thread Robert Engels
Also, enabling and generating core dumps is somewhat OS version specific - even between Linux versions - so you probably need to check your docs. > On Nov 1, 2022, at 11:14 AM, Robert Engels wrote: > >  > Are you certain you aren’t integrating with some C library that is > interfering with t

Re: [go-nuts] Occasional hard lockup w/ 100% CPU usage in go applications

2022-11-01 Thread Robert Engels
Are you certain you aren’t integrating with some C library that is interfering with the default signal handling? > On Nov 1, 2022, at 11:12 AM, Steven Sokol wrote: > > Yep, I need to figure out how to generate a core dump. I've tried all the > usual methods without success. Any suggestions fo

Re: [go-nuts] Occasional hard lockup w/ 100% CPU usage in go applications

2022-11-01 Thread Steven Sokol
Yep, I need to figure out how to generate a core dump. I've tried all the usual methods without success. Any suggestions for alternate methods would be greatly appreciated. When the process is killed (SIGKILL) the system does return to its normal load. (Under production conditions systemd immed

Re: [go-nuts] Looking for some Go library or application as blueprint for concurrency stress tests

2022-11-01 Thread Robert Engels
github.com/robaho/go-concurrency-test may be of some interest. > On Nov 1, 2022, at 10:33 AM, Haddock wrote: > >  > Hello, > > I'm developing a little concurrency library in some language that has support > for fibers. That concurrency library is modeled after concurrency in Go > (because C

Re: [go-nuts] Occasional hard lockup w/ 100% CPU usage in go applications

2022-11-01 Thread Robert Engels
Perf doesn’t help. Perf only shows a sampling over time (eg where the cpu has spent) and as you see in the logs it doesn’t work for pre-existing threads. You need to figure out how to generate a core dump. When you go process dies does the system function as normal? > On Oct 31, 2022, at 11:5

[go-nuts] How do I set a pkg's version?

2022-11-01 Thread 'Mark' via golang-nuts
I am creating a pkg. It has a `go.mod` file: ``` module github.com/.../mypkg go 1.19 ``` And code files with functions in .go files all in the mypkg pkg. How do I specify which version the mypkg pkg is? I know about using `$ git tag vX.Y.Z` and `$ git push origin vX.Y.Z`, but is there any way I

[go-nuts] Looking for some Go library or application as blueprint for concurrency stress tests

2022-11-01 Thread Haddock
Hello, I'm developing a little concurrency library in some language that has support for fibers. That concurrency library is modeled after concurrency in Go (because CSP in Go makes concurrency a lot easier). My own more or less elaborated test cases are running fine now, but I'm missing some

Re: [go-nuts] GoLLVM: using the result of `go build -x . ` to rebuild the program got failed

2022-11-01 Thread 'Qingwei Li' via golang-nuts
Ok, I solved my problem again. The solution is to add `-S -emit-llvm` to get llvm IR for each package and use `llvm-link -S a.ll b.ll -o main.ll` to link all llvm IR files to get a whole program llvm IR. the command is as follows: ``` WORK=/tmp/go-build438096694 mkdir -p $WORK/b002/ cd $WORK

Re: [go-nuts] GoLLVM: using the result of `go build -x . ` to rebuild the program got failed

2022-11-01 Thread 'Qingwei Li' via golang-nuts
Ok, I solved my problem again. The solution is to add `-S -emit-llvm` to get llvm IR for each package and use `llvm-link -S a.ll b.ll -o main.ll` to link all llvm IR files to get a whole program llvm IR. the command is as follows: ```bash WORK=/tmp/go-build2352156760 mkdir -p $WORK/b002/ cd $W