[go-nuts] Re: syscall/js (wasm): Wrapped func, goroutines, GOMAXPROCS, mutex necessity?

2022-08-04 Thread atd...@gmail.com
Still pondering on this. Apparently, can't use a shared-access mutex within event handling callbacks. It deadlocks. Which might be normal if my unbderstand is correct in that the Wrapped funcs are almost always called in the same goroutine (the exception being due to promise callbacks). Other wr

Re: [go-nuts] Go Runtime sharing with buildmode=c-shared

2022-08-04 Thread Ian Lance Taylor
On Thu, Aug 4, 2022 at 12:16 PM Nikita Rirush wrote: > > Does that mean that writing plugins, e.g. for SQLite, can cause issues when > multiple Go extensions are loaded in the same process? > Or is this use-case actually safe, and issues can start to happen only when > there's a Go host and a Go

Re: [go-nuts] Go Runtime sharing with buildmode=c-shared

2022-08-04 Thread Nikita Rirush
Ok, thank you! Does that mean that writing plugins, e.g. for SQLite, can cause issues when multiple Go extensions are loaded in the same process? Or is this use-case actually safe, and issues can start to happen only when there's a Go host and a Go c-shared library in the same process? On Thurs

[go-nuts] Using Go Lang as a tiny server program at localhost , won't execute request

2022-08-04 Thread John Dutcher
I have a tiny server program in Go language (main2.go) running and 'listening' on port 8080 in a Windows command prompt session. While running I point a browser to http://localhost:8080/main2.go and main2.go executes and places a small html form into the browser window to fill and submit. If th

Re: [go-nuts] Go Runtime sharing with buildmode=c-shared

2022-08-04 Thread Ian Lance Taylor
On Thu, Aug 4, 2022 at 11:45 AM Nikita Rirush wrote: > > I recently stumbled onto a project that implements an SQLite extension in Go > as a c-shared library, and wondered if Go shares its runtime between multiple > c-shared Go libraries in the same process. > > I tried searching for issues on G

[go-nuts] Go Runtime sharing with buildmode=c-shared

2022-08-04 Thread Nikita Rirush
Greetings! I recently stumbled onto a project that implements an SQLite extension in Go as a c-shared library, and wondered if Go shares its runtime between multiple c-shared Go libraries in the same process. I tried searching for issues on Github and through this group, but I wasn't able to f

Re: [go-nuts] How to run a java file using go script.

2022-08-04 Thread Kurtis Rader
On Thu, Aug 4, 2022 at 12:44 AM TECHAX wrote: > Thank you so much, I am able to add java path. I also need to add some > other path as well, so Can I do like this: > > > > > > > *os.Setenv("PATH","/home/sdk/jdk-11.0.16/bin:/home/temp/jtreg/bin:$PATH")cmd,err:=exec.Command("java","-version").Combi

Re: [go-nuts] How to run a java file using go script.

2022-08-04 Thread 'Thomas Faughnan' via golang-nuts
On Thu Aug 4, 2022 at 12:24 AM EDT, TECHAX wrote: > I tried the following one but still, it's not working. > > *os.Setenv("PATH","/home/sdk/jdk-11.0.16/bin")* > *cmd,_:=exec.Command("java","-version").Output()* > *fmt.Println(string(cmd))* > > Since the path is set, so it should display the java ve

Re: [go-nuts] concurrent read/write different keys in map

2022-08-04 Thread 'Keith Randall' via golang-nuts
Updating existing keys in parallel is not guaranteed to be safe. If you want to modify values, you'd have to do the trick mentioned above where instead of a map[K]T you use a map[K]*T and to do modification you do *m[k] = T{...} or whatever. Go maps do incremental growth work on every update, s

[go-nuts] Re: Small language change for additional type safety (Go2?)

2022-08-04 Thread Andrew Phillips
Hi Marc, thanks for your comment: > The thing is, if you try to cover this for a mistake, then we can cover every mistake, right? Not at all. I think the idea is to try to catch at compile-time common mistakes, that are easily made, can be missed during testing and can have serious consequence

Re: [go-nuts] How to run a java file using go script.

2022-08-04 Thread Peter Galbavy
When you use cmd, err := exec.Command(...) you then set-up it's environment before execution by setting cmd.Env: cmd.Env = append(os.Environ(), `PATH="..."`) and only then run the command: out, err := cmd.Output() if err ... { ... } fmt.Println("output:", out) The above mostly from

Re: [go-nuts] How to run a java file using go script.

2022-08-04 Thread TECHAX
Thank you so much, I am able to add java path. I also need to add some other path as well, so Can I do like this: *os.Setenv("PATH","/home/sdk/jdk-11.0.16/bin:/home/temp/jtreg/bin:$PATH")cmd,err:=exec.Command("java","-version").CombinedOutput()if err != nil { fmt.Println(err)}fmt.Printl