Re: [go-nuts] Symbol of const string are not exported by compiler

2024-05-30 Thread Jan Mercl
On Thu, May 30, 2024 at 10:34 AM Benoît Marguerie wrote: > I discovered a "strange" behavior doing a simple operation. > I defined 2 const : one integer and one string. With delve (or other > debugger), I'm able to consult the const integer value but not the const > string value. Delve team

Re: [go-nuts] encoding/asn1 I can't Marshal a struct with pointer members

2024-04-27 Thread Jan Mercl
On Sun, Apr 28, 2024, 03:03 J Liu <8859210...@gmail.com> wrote: > My program is like this: > > type Girl struct { > Name string > Age int > } > > type Person struct { > girl *Girl > job string > } > > > What should I do to Marshal 'Person'? > I think you need to export

Re: [go-nuts] Is golang.org/x/text/message's Printer thread safe?

2024-04-22 Thread Jan Mercl
On Mon, Apr 22, 2024 at 11:23 AM Xiangrong Fang wrote: > Is golang.org/x/text/message's *message.Printer safe to use in goroutines? I don't know, but usually things are safe for concurrent use by multiple goroutines only when explicitly documented as such. -- You received this message because

Re: [go-nuts] Nillable basic types?

2024-03-18 Thread Jan Mercl
On Mon, Mar 18, 2024 at 4:41 AM Daniel Lepage wrote: > This change would be entirely backward-compatible ... Let's consider, for example, the type uint8, aka byte. A variable of type byte is specified* to occupy 8 bits of memory and has 256 possible values. To represent all those values and the

Re: [go-nuts] GO111MODULE=off go get deprecated?

2024-03-07 Thread Jan Mercl
On Sun, Mar 3, 2024 at 10:25 PM Jeffery Carr wrote: > Has this been deprecated or maybe it is broken in debian sid, but: > > bash$ GO111MODULE=off go get -v go.wit.com/apps/test > go: modules disabled by GO111MODULE=off; see 'go help modules' > basj$ go version > go version go1.22.0 linux/amd64

Re: [go-nuts] Enums, Go1 and proposals

2024-03-04 Thread Jan Mercl
On Mon, Mar 4, 2024 at 6:19 PM Jeremy French wrote: > More, to prevent PrintMonth(14), which the function would have to check for > and either return an error or panic, since there is no meaningful output. In > fact, it's fairly easy to see, even in this case, where the PrintMonth >

Re: [go-nuts] Enums, Go1 and proposals

2024-03-04 Thread Jan Mercl
On Mon, Mar 4, 2024 at 4:19 PM Jeremy French wrote: > It's checked at compile-time rather than run time. That requires immutability of variables of enum type. Go does not support immutable variables. -- You received this message because you are subscribed to the Google Groups "golang-nuts"

Re: [go-nuts] Equality of interface of an empty struct - why?

2024-02-26 Thread Jan Mercl
On Tue, Feb 27, 2024 at 6:20 AM tapi...@gmail.com wrote: > From common sense, this is an obvious bug. But the spec is indeed not clear > enough. > It doesn't state whether or not comparisons of pointers to two distinct > zero-size variables should be consistent in a run session. > Though, from

Re: [go-nuts] Unhappy with the official generics tutorial

2024-02-22 Thread Jan Mercl
On Thu, Feb 22, 2024 at 10:06 AM 'Carla Pfaff' via golang-nuts wrote: > This omission is notable considering "any" is among the most frequently used > constraints in writing generic code. Interesting to know, I'd naively guess the opposite. Can you please share the source data set? Thank you.

Re: [go-nuts] Ghost/indirect dependency on a custom package

2024-02-20 Thread Jan Mercl
On Tue, Feb 20, 2024 at 11:07 AM Peter Bočan wrote: > Is there a way to debug this? Is there a way to step over the initialisation > order? I try to get help from '$ go mod graph' in similar investigations. -- You received this message because you are subscribed to the Google Groups

Re: [go-nuts] big int panic on text conversion

2024-02-14 Thread Jan Mercl
On Wed, Feb 14, 2024 at 12:14 PM 'Dan Kortschak' via golang-nuts wrote: > Given that this can happen without a race or unsafe modifications it > might be worth filing a issue for. I think this is expected. Quoting from the big.Int docs https://pkg.go.dev/math/big#Int To "copy" an Int

Re: [go-nuts] How could we emulate condition variables using Go channels only?

2024-01-12 Thread Jan Mercl
On Fri, Jan 12, 2024 at 7:57 PM Rochus Keller wrote: > Here is the full question with examples (though meanwhile closed as usual in > recent times on stackoverflow, so answer here please): > https://stackoverflow.com/questions/77802102/mutex-and-condition-variables-in-go-without-using

Re: [go-nuts] Re: Rendering fonts in Go

2024-01-12 Thread Jan Mercl
On Fri, Jan 12, 2024 at 12:34 PM 'Brian Candler' via golang-nuts wrote: > At worst, it may possible to compile C into Go. It sounds mad, but I believe > SQLite has been ported to pure Go this way. Challenge accepted: https://pkg.go.dev/modernc.org/libfreetype -- You received this m

Re: [go-nuts] Re: A global panic handler for crash reporting

2023-12-26 Thread Jan Mercl
On Tue, Dec 26, 2023 at 9:12 AM Gergely Brautigam wrote: > If you have a top level recover in you main, it doesn't matter where the > panic happens, you'll capture it. Even in third party library. Iff the panic occurs in the same goroutine where the defer is. Every go statement starts a new

Re: [go-nuts] circular package dependency between golang.org/x/mod and golang.org/x/tools

2023-12-19 Thread Jan Mercl
On Tue, Dec 19, 2023 at 9:37 PM Nathan Lacey wrote: > I noticed that we have a circular dependency between golang.org/x/mod and > golang.org/x/tools > > golang.org/x/mod zip/zip_test.go includes golang.org/x/tools > I think we could get rid of the circular package dependency by changing that

Re: [go-nuts] Need help running "go get" on self hosted git server

2023-12-18 Thread Jan Mercl
On Mon, Dec 18, 2023 at 2:19 PM Brijesh Wawdhane wrote: > I added a go-import meta tag to my git server's website on the repo page and it looks like > > https://brijesh.dev/kairos.git;> > > but when I try running "go get brijesh.dev/kairos" I get an error saying 'go: unrecognized import path

Re: [go-nuts] detecting deleted file that is still open and appending without error in Go?

2023-12-10 Thread Jan Mercl
On Sun, Dec 10, 2023 at 8:34 PM Jason E. Aten wrote: > I noticed that the binary log was not growing, and its update timestamp was > not changing. I think the file was still growing as intended. It was only no more associated with the _new_ entry/name in the directory. I'm pointing it out

Re: [go-nuts] detecting deleted file that is still open and appending without error in Go?

2023-12-10 Thread Jan Mercl
On Sun, Dec 10, 2023 at 5:41 PM Jason E. Aten wrote: > My question is: is there a way to have the Go process detect if the file it > is writing to has been deleted by another process (git in this case) so that > attempting to append to the file is no longer effective? It is effective and

Re: [go-nuts] Go ARM

2023-11-15 Thread Jan Mercl
On Wed, Nov 15, 2023 at 9:59 PM Stephen Illingworth wrote: > > That works better although not perfectly for my purposes. More work required > from me. > > I'm curious though, about the -marm flag. How can I remove it from the > GOGCCFLAGS variable? Or are we saying we can't use the aarch64

Re: [go-nuts] Go ARM

2023-11-15 Thread Jan Mercl
On Wed, Nov 15, 2023 at 8:30 PM Stephen Illingworth < stephen.illingwo...@gmail.com> wrote: > I'm trying to build a project on the Raspberry Pi, natively. > > Using "go env" I can see that Go has the following value for GOGCCFLAGS > > GOGCCFLAGS='-fPIC -marm -Wl,--no-gc-sections -fmessage-length=0

[go-nuts] Re: Why golang's garbage collector didn't free obj when an finalizer is associate with it?

2023-11-08 Thread Jan
mber 7, 2023 at 3:51:51 PM UTC+1 Michael Knyszek wrote: > On Tuesday, November 7, 2023 at 2:32:28 AM UTC-5 Jan wrote: > > Btw, I don't follow the sentence: > > "the GC necessarily has to keep referents of the object-to-be-finalized > live even if the object isn't referen

Re: [go-nuts] ldflags -X

2023-11-08 Thread Jan Mercl
On Wed, Nov 8, 2023 at 4:01 PM Stephen Illingworth wrote: > I would have expected the "main.A" string to require the same form. But > either way, that's the correct solution. It is the correct form. Package main cannot be imported and has a special import path. Though I don't know where it is

Re: [go-nuts] ldflags -X

2023-11-08 Thread Jan Mercl
On Wed, Nov 8, 2023 at 1:35 PM Stephen Illingworth < stephen.illingwo...@gmail.com> wrote: > > Hello, > > I'm trying to use the -X ldflag to set a string at compile time. I can do this successfully if the string is in the main package but it does not work if the string is in a subpackage. > > For

[go-nuts] Re: Why golang's garbage collector didn't free obj when an finalizer is associate with it?

2023-11-06 Thread Jan
, those memory will never be freed and keep >> piling on ? That can be disastrous. >> >> On Monday, November 6, 2023 at 3:39:50 PM UTC+5:30 Jan wrote: >> >>> For what it's worth, a bit of "memory management" on structures in many >>> cases is

[go-nuts] Re: Why golang's garbage collector didn't free obj when an finalizer is associate with it?

2023-11-06 Thread Jan
shred_ptr<>`), which gets most of the benefit of GC, but with a much lower cost. They required manually breaking cycles, which I didn't find to be an issue at all in the great majority of the cases. On Monday, November 6, 2023 at 11:01:04 AM UTC+1 Jan wrote: > I was very surprised by

[go-nuts] Re: Why golang's garbage collector didn't free obj when an finalizer is associate with it?

2023-11-06 Thread Jan
I was very surprised by this behavior of SetFinalizer: and indeed if you remove the SetFinalizer one can see that s1 is freed, because the memory reported by `m.HeapAlloc` goes back down. I think you already have the answer: the block that has the cycle (s1 and s2) have a SetFinalizer set, and

Re: [go-nuts] Re: Recommended way to distribute pre-compiled C-dependencies for modules using CGO ?

2023-11-03 Thread Jan
en trying to run it on > blah standard Ubuntu 22. > > On Wednesday, November 1, 2023 at 9:08:51 PM UTC Jan wrote: > >> Thanks @Jason, but the point was exactly not need to do anything extra: >> no manual unzipping of a file, or manual Makefile/Magefile. >> >&

Re: [go-nuts] Re: Recommended way to distribute pre-compiled C-dependencies for modules using CGO ?

2023-11-01 Thread Jan
Thanks @Jason, but the point was exactly not need to do anything extra: no manual unzipping of a file, or manual Makefile/Magefile. Let's say project in Go links some 30 external modules, 5 of them have their own specific steps that need to be read, understood and and run to install them ...

Re: [go-nuts] Re: recommended statistics package? Requirements: ANOVA, Brown-Forsythe

2023-10-24 Thread Jan
2yDRof0z > > Have fun! > > On 10/23/23 07:38, Jan wrote: > > hi, I did a quick search and I didn't find anything in Go. But looking > > at the definition and at one implementation in JS > > < > https://github.com/lukem512/brown-forsythe-test/blob/master/src/brow

[go-nuts] Re: recommended statistics package? Requirements: ANOVA, Brown-Forsythe

2023-10-22 Thread Jan
hi, I did a quick search and I didn't find anything in Go. But looking at the definition and at one implementation in JS , it sounds something relatively easy to write and share :) You can use the R

Re: [go-nuts] Re: Recommended way to distribute pre-compiled C-dependencies for modules using CGO ?

2023-10-20 Thread Jan
action for the user. > > > With only headers and static libs in the thirdparty directory, is this > package "go-gettable"? > Will go make the subdirectory available in that case? It usually ignores > if there is no Go source files. > > > M-A > > Le lun. 16 oct. 2023,

[go-nuts] Re: Recommended way to distribute pre-compiled C-dependencies for modules using CGO ?

2023-10-15 Thread Jan
es in it). > > So your next mission is to prepare the right #cgo CFLAGS LDFLAGS > incantations to use those libraries. > > Jan a következőt írta (2023. október 14., szombat, 8:37:48 UTC+2): > >> Thanks Tamás, I may not be understanding correctly, but after taking a >

[go-nuts] Re: Recommended way to distribute pre-compiled C-dependencies for modules using CGO ?

2023-10-14 Thread Jan
; in the odpi/* subdirs). > But it may work that your precompiled libs in a subdir, with a mock .go > file gets downloaded. > But how will it found by your lib/app ? > > Tamás > > > Jan a következőt írta (2023. október 12., csütörtök, 8:14:41 UTC+2): > >> Thanks Richard. In

Re: [go-nuts] Re: Recommended way to distribute pre-compiled C-dependencies for modules using CGO ?

2023-10-12 Thread Jan
automatically (setting up of CGO's CFLAG, LDFLAG LD_LIBRARY_PATH, etc), and be removed if no longer used ? With minimum user headache/work... cheers Jan On Thursday, October 12, 2023 at 3:16:58 AM UTC+2 Tim Casey wrote: > > > I would put down Makefile includes for the supported targets and buil

[go-nuts] Re: Recommended way to distribute pre-compiled C-dependencies for modules using CGO ?

2023-10-12 Thread Jan
ng very similar. > > - Rich > > On Wednesday, October 11, 2023 at 2:58:23 AM UTC-7 Jan wrote: > >> hi, >> >> I'm developing a couple of ML framework/libraries for Go that depend on >> C/C++ code. Once C-libraries dependencies are installed, the CGO >> integra

Re: [go-nuts] Re: Why causes []any trouble in type equations?

2023-10-11 Thread Jan Mercl
On Wed, Oct 11, 2023 at 8:11 PM Torsten Bronger wrote: > Then, all boils down to the fact that you can’t pass []float64 as an > []any. To be honest, I still don’t fully understand why this is > forbidden, so I just accept that the language does not allow it. It's the same reason why one cannot

[go-nuts] Re: Recommended way to distribute pre-compiled C-dependencies for modules using CGO ?

2023-10-11 Thread Jan
build tags are >> there to not require GLIBC for user and dns lookups. >> >> >> >> On Wednesday, 11 October 2023 at 11:43:20 UTC+1 Jan wrote: >> >>> Edit: ...so folks using your library don't need to install them manually >>> ? What about uninstalling ? >&g

[go-nuts] Re: Recommended way to distribute pre-compiled C-dependencies for modules using CGO ?

2023-10-11 Thread Jan
Edit: ...so folks using your library don't need to install them manually ? What about uninstalling ? On Wednesday, October 11, 2023 at 12:41:40 PM UTC+2 Jan wrote: > Thanks Peter, but I don't follow ... I also use docker to build the > pre-built binaries. > > But how do you distrib

[go-nuts] Re: Recommended way to distribute pre-compiled C-dependencies for modules using CGO ?

2023-10-11 Thread Jan
ter > > On Wednesday, 11 October 2023 at 10:58:23 UTC+1 Jan wrote: > >> hi, >> >> I'm developing a couple of ML framework/libraries for Go that depend on >> C/C++ code. Once C-libraries dependencies are installed, the CGO >> integration work great. >> &

[go-nuts] Recommended way to distribute pre-compiled C-dependencies for modules using CGO ?

2023-10-11 Thread Jan
-directory of the python library installation. I was hoping there would be a similar way (maybe with a separate tool) to integrate with `go.mod`. Any pointers, thoughts or suggestions are very appreciated. Thanks! Jan ps: While searching I saw similar questions, but none that exactly answered

Re: [go-nuts] how do you compie and link a go main with an assembly code file?

2023-10-09 Thread Jan Mercl
On Mon, Oct 9, 2023 at 6:02 PM Peter Riemenschneider wrote: Just '$ go build' as usual, but one must declare the asm function: https://go.dev/play/p/KySqFvCVz_T -- You received this message because you are subscribed to the Google Groups "golang-nuts" group. To unsubscribe from this group and

Re: [go-nuts] The docs for secretbox seem very wrong

2023-10-09 Thread Jan Mercl
On Mon, Oct 9, 2023 at 3:46 PM Dean Schulze wrote: > If the docs are correct, how do you append to nil? https://go.dev/play/p/WY0Bycj-_Tn -- You received this message because you are subscribed to the Google Groups "golang-nuts" group. To unsubscribe from this group and stop receiving emails

Re: [go-nuts] Help understanding slices, variable arguments, and passing slices to functions

2023-09-25 Thread Jan Mercl
On Mon, Sep 25, 2023 at 1:57 PM Andrew Pillar wrote: A nice discussion of slices can be found for example here: https://research.swtch.com/godata tl;dr: Yes, slices are passed by value (everything in Go is passed by value), but a slice does not contain the backing array, only a pointer to it.

Re: [go-nuts] Re: Weird error when trying to fetch a module.

2023-09-15 Thread Jan Mercl
On Fri, Sep 15, 2023 at 10:31 AM 'Jim Idle' via golang-nuts < golang-nuts@googlegroups.com> wrote: > The go.mod at the root was one thing that might work, but it will cause the entire repo to be pulled in so the tag will still have to be sec/go/ etc. tl;dr: Putting a go.mod in the repository

Re: [go-nuts] How ignore a subdirectory

2023-09-13 Thread Jan Mercl
On Wed, Sep 13, 2023 at 12:25 PM John Souvestre wrote: > I did try that also. I get this error message: > > CreateFile *.go: The filename, directory name, or volume label syntax is incorrect. Sorry, I'm not familiar with Windows and only TIL cmd.exe does not expand globs. I suggest to

Re: [go-nuts] How ignore a subdirectory

2023-09-13 Thread Jan Mercl
On Wed, Sep 13, 2023 at 5:47 AM 'John Souvestre' via golang-nuts wrote: > I’m trying to run gofmt on all of the .go files in a directory, but not any > subdirectories. $ gofmt *.go -- You received this message because you are subscribed to the Google Groups "golang-nuts" group. To

Re: [go-nuts] How to constrain an integral type's values

2023-09-08 Thread Jan Mercl
On Fri, Sep 8, 2023 at 9:24 AM 'Mark' via golang-nuts wrote: > Is there a compile-time solution for this that I've missed? No. Go does not have enum types. -- You received this message because you are subscribed to the Google Groups "golang-nuts" group. To unsubscribe from this group and

[go-nuts] Re: does gonum insist on row-major?

2023-08-26 Thread Jan
Not exactly what you asked, but something that you may consider: GoMLX . It's an accelerated ML and Math library that uses XLA --> it just-in-time compiles a computation graph to CPU/GPU (and hopefully soon TPU). It powers

Re: [go-nuts] Re: Best IDE for GO ?

2023-08-26 Thread Jan Mercl
On Sat, Aug 26, 2023 at 2:33 PM Jason E. Aten wrote: > > Is there any IDE that allows you to jump through a stack trace like emacs > does? I think many code editors can do that, for example vim: https://vim.fandom.com/wiki/Open_file_under_cursor -- You received this message because you are

[go-nuts] Re: Would it be possible to make this work in the future?

2023-08-26 Thread Jan
Notice that if you don't assign to `tok`, multiple alternatives in `case` works. But the issue is that in Go there are no "duck typing" for data, only for methods (interfaces). `xml.StartElement` and `xmlEndElement` not being the same type, the assignment ('tok.name.Local = "types"`) won't

[go-nuts] Re: custom coverage report

2023-08-24 Thread Jan
hey Vasiliy, I'm not sure I understood your requirements, but let me take a stab at it. By handlers of the protobuf I imagine you refer to those stubs generated by `protoc`, for the gRPCs. Is it correct ? They have well defined names/packages that can easily be filtered (grep?) from the the

Re: [go-nuts] Re: [ANN] go-zeromq/zmq4: pure-Go implementation of ZeroMQ

2023-08-24 Thread Jan
Btw, I should add to it that GoNB , a successor to gophernotes also uses github.com/go-zeromq/zmq4 to communicate with Jupyter -- it's been working flawlessly for that use case. On Thursday, August 24, 2023 at 3:20:49 PM UTC+2 Sebastien Binet wrote: > Hi

Re: [go-nuts] Best IDE for GO ?

2023-08-19 Thread Jan Mercl
On Sat, Aug 19, 2023 at 10:06 PM Christian Stewart wrote: > Autocomplete and a go language server (gopls) add a ton of speed because you > don't need to look up the docs for function and variable names. And go to > definition improves speed navigating code significantly. - Using autocomplete

Re: [go-nuts] Best IDE for GO ?

2023-08-19 Thread Jan Mercl
On Sat, Aug 19, 2023 at 9:42 PM Robert Engels wrote: > I guarantee that two developers of equal competence - the one with a powerful > IDE will outperform the other using a text editor with syntax highlighting > (but come on that is a crutch a real developer doesn’t need) by 2-10x > depending

Re: [go-nuts] Best IDE for GO ?

2023-08-19 Thread Jan Mercl
On Sat, Aug 19, 2023 at 11:27 AM alex-coder wrote: > Gophers, may be there is another place where I should look for IDE for GO ? Unix is my IDE and vim is its prophet. IME IDEs make programmers write low quality code while enjoying the illusion of being "more productive". -- You received

[go-nuts] Re: Test coverage: joint unit test and integration test coverage

2023-08-17 Thread Jan
in go1.21.0. On Thursday, August 17, 2023 at 8:08:51 AM UTC+2 Jan wrote: > Oh yes, it's true that the new mechanism is more general, and allows > integration tests, it's a huge improvement for cases like this! Thanks for > the design btw! > > Now the ergonomics of the case of unit test

[go-nuts] Re: Test coverage: joint unit test and integration test coverage

2023-08-17 Thread Jan
un as root, especially error > handling. So there is some value in the new mechanism even "just" for unit > tests. Admittedly, not all will need that in their unit tests. > > On Wednesday, August 16, 2023 at 8:53:56 PM UTC+2 Jan wrote: > >> Thanks, that's very helpful!

[go-nuts] Re: Test coverage: joint unit test and integration test coverage

2023-08-16 Thread Jan
e similar to this? > https://github.com/thediveo/lxkns/blob/cef5a31d7517cb126378f81628f51672cb793527/scripts/cov.sh#L28 > > On Wednesday, August 16, 2023 at 1:54:48 PM UTC+2 Jan wrote: > >> hi all, >> >> After reading the documentation >> <https://go.dev/blog

[go-nuts] Test coverage: joint unit test and integration test coverage

2023-08-16 Thread Jan
hi all, After reading the documentation , I managed to set up a process in which I compile and run my integration tests, and get coverage from them in the `$GOCOVERDIR` subdirectory. Now I would like to have a combined unit tests + integration

Re: [go-nuts] Re: Go 1.21.0 is released

2023-08-09 Thread Jan Mercl
On Wed, Aug 9, 2023, 09:12 Marcello H wrote: > https://go.dev/dl/go1.21.0.windows-arm64.zip > > It is found when you click on "Other Ports" Thanks. I may have a false memory of always finding the windows/arm64 port beside the windows/amd64 one in the same section. -j -- You received this

[go-nuts] Re: Go 1.21.0 is released

2023-08-08 Thread Jan Mercl
On Tue, Aug 8, 2023 at 5:24 PM wrote: > We have just released Go 1.21.0. > > To find out what has changed in Go 1.21, read the release notes: > https://go.dev/doc/go1.21 > > You can download binary and source distributions from our download page: > https://go.dev/dl/#go1.21.0 It looks like the

Re: [go-nuts] Re: How to convert an svg to a png (or gif) image?

2023-08-04 Thread Jan Mercl
On Fri, Aug 4, 2023 at 1:22 PM Brian Candler wrote: > Also there's a project which compiles C code to Go - ISTR it was used to > build a pure Go version of Sqlite. Presumably the same approach could be > applied to an image processing library. > >

Re: [go-nuts] Re: Error handling

2023-08-01 Thread Jan Mercl
On Tue, Aug 1, 2023 at 1:47 AM DrGo wrote: > The verbosity of error handling is the number one concern for Go developers > in the most recent survey. That says something about those developers, about their preferences, opinions, taste etc and that it differs from what the Original Language

Re: [go-nuts] [go test] pure Test Classes.

2023-07-26 Thread Jan Mercl
On Wed, Jul 26, 2023 at 9:44 AM sumith s wrote: > Currently, we do not have pure Test Classes defined by us. We are using > Golang specific Test Class structure. Each FILENAME_test.go will have its own > test class under "Golang Test". > I'm trying to define a pure Test Classes. how can do

Re: [go-nuts] go package dating back to 2009

2023-07-25 Thread Jan Mercl
On Wed, Jul 26, 2023 at 12:32 AM Bravo Moua wrote: > For a fact, bytes, fmt, and packages in those category are from Satoshi > Nakamoto and myself. Extraordinary claims require extraordinary evidence. -- You received this message because you are subscribed to the Google Groups "golang-nuts"

Re: [go-nuts] no way to pause `Listen` on net connections

2023-07-24 Thread Jan Mercl
On Mon, Jul 24, 2023 at 9:26 AM David N wrote: > Yup, this makes sense and should work, but I'm still surprised this can't be > entirely done in Golang. Who says it's not possible? I'm not aware of a reason why the required parts cannot be implemented in pure Go (+ syscalls + right permission

Re: [go-nuts] no way to pause `Listen` on net connections

2023-07-24 Thread Jan Mercl
On Mon, Jul 24, 2023 at 9:14 AM David N wrote: On Linux you may try fiddling with iptables, limitations apply: https://stackoverflow.com/questions/44464617/stop-accepting-new-tcp-connections-without-dropping-any-existing-ones/44509993#44509993 -- You received this message because you are

Re: [go-nuts] testing whether two maps are the same object

2023-07-18 Thread Jan Mercl
On Tue, Jul 18, 2023 at 4:35 PM Jochen Voss wrote: > Is there a better way? I have never been here and please don't do this: https://go.dev/play/p/x4QYJubXMnQ -- You received this message because you are subscribed to the Google Groups "golang-nuts" group. To unsubscribe from this group and

Re: [go-nuts] map type conversion

2023-07-16 Thread Jan Mercl
On Sun, Jul 16, 2023 at 6:02 PM Leonard Mittmann wrote: > Hi everyone, I am wondering if there is efficient way to do the following > type conversion (without looping over the map): > > var m = map[uint]uint{ /*...*/ } > type uintXXX uint > // this does not work > var m2 map[uintXXX]uintXXX =

[go-nuts] Re: `go get` and workspaces (`go.work`)

2023-07-15 Thread Jan
Yes, I read through the thread -- but it seemed different (go work sync / go mod tidy). I'll follow up there then. thanks! On Friday, July 14, 2023 at 7:10:53 PM UTC+2 Howard C. Shaw III wrote: > Such an issue is what I linked you to earlier in the thread. So I do not > think you need to

[go-nuts] Re: `go get` and workspaces (`go.work`)

2023-07-14 Thread Jan
Still on the topic, if I have to use `go.mod` replace clauses, what is the point of `go.work` ? Notice replace in `go.work` doesn't work. Any thoughts if it would be appropriate to create an issue to add workspace support for `go get` ? cheers On Wednesday, July 12, 2023 at 12:48:57 AM UTC+2

[go-nuts] Re: `go get` and workspaces (`go.work`)

2023-07-11 Thread Jan
I tried exactly that, it doesn't do that ... Am I doing something wrong ? Notice in the example below the dependency to `github.com/janpfeifer/gonb/gonbui`. The command `go work sync` doesn't do anything. And `go get` still fails with the same error: ``` $ cat main.go package main import (

[go-nuts] Re: `go get` and workspaces (`go.work`)

2023-07-11 Thread Jan
Thanks, yes, I had checked out `go work sync`. I still don't understand what it means with "update the modules withing a workspace" though, or what this command does. I wish the documentation was more concrete (which files it changes, who uses those files, or maybe an example). `go help work

[go-nuts] Re: `go get` and workspaces (`go.work`)

2023-07-11 Thread Jan
Thanks for the reply, but I'm not sure what exactly what you mean. In my example it's not that I need to `go get` anything for my locally stored packages (so I don't need to get `github.com/joe/b`). Rather, I need `go get` for other packages. But it (`go get`) fails on the local stored

[go-nuts] `go get` and workspaces (`go.work`)

2023-07-11 Thread Jan
deliberate and I'm missing some point, but ... for my use case, I would love to have `go get` ignore the packages that are imported from directories in `go.work`, and just "get" the other ones. Is there a way to have that ? (I couldn't find any flag in `go get`). Or any other ideas ?

Re: [go-nuts] Why not return after calling http.Error()

2023-07-04 Thread Jan Mercl
On Tue, Jul 4, 2023 at 5:38 PM Gurunandan Bhat wrote: > Every example of http Handler that I have seen so far looks like this: > > func handleSomeRequest(w http.ResponseWriter, r *http.Request) { > > // do something that returns an error > if err != nil { > http.Error(w,

Re: [go-nuts] [RFC] Yet another proposal for Go2 error handling

2023-06-28 Thread Jan
Thanks for the pointer Sven! I think I was once told not to use panic/defer/recover to implement generic exceptions in Go, and never reconsidered it. I think I'm taking up on your suggestion for my library. On Wednesday, June 28, 2023 at 7:30:41 PM UTC+2 Sven Anderson wrote: > I think for

Re: [go-nuts] Re: [RFC] Yet another proposal for Go2 error handling

2023-06-26 Thread Jan
oilerplate code there is - you > don’t read or edit it. > > On Jun 18, 2023, at 3:10 PM, Jan Pfeifer wrote: > >  > > A DSL + code generator is a longer discussion. But I'm not sure I'm > getting the scope of your suggestion right: > > If you refer to having

Re: [go-nuts] delve crashes in presence of a circular reference variable

2023-06-23 Thread Jan Mercl
On Fri, Jun 23, 2023 at 10:38 AM christoph...@gmail.com wrote: > > Here is the minimal example code causing delve 1.20.2 to crash with a stack > overflow > > func TestExample(t *testing.T) { > type pptr *pptr > var p pptr > p = > t.Error("hello") > } > > Here is the stack trace

Re: [go-nuts] Please consider voting to reopen Golang subreddit

2023-06-23 Thread Jan Mercl
On Fri, Jun 23, 2023 at 10:18 AM Axel Wagner wrote: > Just for context, as not everyone seems to be aware: I was, in that sentence > you quoted, referring to examples like this > https://www.reddit.com/r/ModCoord/comments/14eq8ip/the_entire_rmildlyinteresting_mod_team_has_just/ > This

Re: [go-nuts] Please consider voting to reopen Golang subreddit

2023-06-23 Thread Jan Mercl
On Fri, Jun 23, 2023 at 7:01 AM 'Axel Wagner' via golang-nuts < golang-nuts@googlegroups.com> wrote: > And even *when* they ask and get overwhelming backing from their communities, ... Latest poll results on r/golang as of now: [image: image.png]

Re: [go-nuts] Why is reflect.CanAddr() returning false in this case ?

2023-06-22 Thread Jan Mercl
On Thu, Jun 22, 2023 at 12:16 PM christoph...@gmail.com wrote: > > I'm trying to get the uintptr address of a value p for which I have the > reflect.Value so that I can compare it with the value obtained with > v.Pointer() when p is a pointer. > > Here is a simple recursive pointer example code

Re: [go-nuts] Re: Using go run with #!

2023-06-21 Thread Jan Mercl
On Wed, Jun 21, 2023 at 8:33 PM Dzmitry Lahoda wrote: > > rust just got shebang and cargo in one file. i was hoping using go as good > fit for some cases. but seem it will be rust. we are go, bash, nix, rust > coders. sure there is some js in our repo. but i hate it. i like to so script >

Re: [go-nuts] Re: [RFC] Yet another proposal for Go2 error handling

2023-06-18 Thread Jan Pfeifer
is use case. On Sun, Jun 18, 2023 at 5:11 PM Robert Engels wrote: > Seems the easiest way to address that is with a DSL and a code generator. > > On Jun 18, 2023, at 9:47 AM, Jan Pfeifer wrote: > >  > hi Shulhan, I see your points, thanks for the reply. Let me comment on

Re: [go-nuts] Re: [RFC] Yet another proposal for Go2 error handling

2023-06-18 Thread Jan Pfeifer
hi Shulhan, I see your points, thanks for the reply. Let me comment on them below: On Sat, Jun 17, 2023 at 9:21 AM Shulhan wrote: > Hi Jan, thanks for response. > > On Mon, 5 Jun 2023 01:06:37 -0700 (PDT) > Jan wrote: > > > Repeating Justin's consideration: one of my (

Re: [go-nuts] Unexpected circular type definition limitation

2023-06-15 Thread Jan Mercl
On Thu, Jun 15, 2023 at 10:16 AM christoph...@gmail.com wrote: > It is possible to define two structures globally with mutual type dependency > as this: > > type A struct { > B []B > } > > type B struct { > A A[] > } > > but I just noticed that we can't do that inside a function: > >

Re: [go-nuts] Hosting to deploy && run exe ?

2023-06-11 Thread Jan Mercl
On Sun, Jun 11, 2023 at 7:40 PM alex-coder wrote: > Could you please advise me the simple hosting to deploy && run a small exe > assembled from go. I'm using https://www.hetzner.com/cloud?country=us and Google Cloud free tier. The later natively supports deployment of Go programs. -- You

[go-nuts] Re: [RFC] Yet another proposal for Go2 error handling

2023-06-05 Thread Jan
Repeating Justin's consideration: one of my (and from colleagues I discuss the topic with) major issues with current error handling is the repetition of identical code. Your proposal still requires `when err handle ...` at every statement. It also doesn't allow for nested call of functions that

[go-nuts] Re: glog: how to add wrapper to log sinks ? Maybe move glog/internal/logsync out of internal ?

2023-05-22 Thread Jan
A bit more of search and I found klog <https://pkg.go.dev/k8s.io/klog/v2>, which conveniently already provides SetLogFilter <https://pkg.go.dev/k8s.io/klog/v2#SetLogFilter>, which resolves the issue. cheers Jan ps.: s/logsync/logsink -- sorry. On Monday, May 22, 2023 at 7:30:11 

[go-nuts] glog: how to add wrapper to log sinks ? Maybe move glog/internal/logsync out of internal ?

2023-05-21 Thread Jan
it is marked as `internal`, so not accessible. Any chances it could be made public ? Or any suggestions on how to easily achieve the same result ? Thanks! Jan ps.: I looked at other logging libraries, but I do require (use often) fine-grained level control of logging per file, like glog

[go-nuts] Re: unsafe.Slice and CGO odd behaviour

2023-05-18 Thread Jan
ndices, [0]) runtime.GC() // Apparently changes content of indices fmt.Printf("\tindices=%v, ptr=%0X\n", indices, [0]) runtime.KeepAlive(indicesT) ... Apologies for the noise in the list. Problem solved. cheers Jan On Thursday, May 18, 2023 at 6:46:04 PM UTC+2

[go-nuts] unsafe.Slice and CGO odd behaviour

2023-05-18 Thread Jan
9770 11613 9906 11786], ptr=179C300 I observed the same issue with other larger tensors I was working on (some garbled images stored as tensors). Any thoughts ? many thanks! Jan -- You received this message because you are subscribed to the Google Groups "golang-nuts" group. To u

Re: [go-nuts] Re: HTTP client timeout

2023-05-05 Thread Jan Mercl
On Fri, May 5, 2023 at 4:21 PM envee wrote: > > Thanks Jan. > My interface speed is 20 Gb/s > The payload size is about 2.8Kb. > So at 9000 Txn/s this works out to 9000 x 3 ≅27MB/s ≅ 200 Mb/s (This matches > the so (socket out) value shown in my atop command output) > I gues

Re: [go-nuts] Re: HTTP client timeout

2023-05-05 Thread Jan Mercl
On Fri, May 5, 2023 at 2:45 PM envee wrote: > Still, I don't understand why I cannot achieve higher throughput than 9000 > per second. What is the max bitrate of the network interface used in the measurement and what is the size of the payload that has to get through for every connection? --

Re: [go-nuts] Re: Home directory?

2023-04-23 Thread Jan Mercl
On Sun, Apr 23, 2023 at 10:28 AM Amnon wrote: > Yes GOPATH and GOROOT have been deprecated. Both are alive and well. They are essential for the build system/go command to work as required. tl;dr: There's a default value of GOPATH so one does not have to set it. A much longer version can be

Re: [go-nuts] gofmt: expected declaration, found ')'

2023-04-16 Thread Jan Mercl
On Sun, Apr 16, 2023 at 12:51 PM Andreas Götz wrote: > Isn't gofmt ist part of the go command? Go ist the latest version: It is but it's a separate binary/executable file. Go version is one thing, the version of the binary file that is actually executed when '$ gofmt' is invoked is another

Re: [go-nuts] gofmt: expected declaration, found ')'

2023-04-16 Thread Jan Mercl
On Sun, Apr 16, 2023 at 12:17 PM Andreas Götz wrote: > > Good morning. Please excuse me for asking here- I'm stuck with something that > looks like a gofmt bug though that seems very unlikely. > > In CI > (https://github.com/evcc-io/evcc/actions/runs/4712710735/jobs/8357929411?pr=7485) > I'm

Re: [go-nuts] Re: Pointer constraint to generics

2023-04-16 Thread Jan
ess to the underlying C calls. But you do you, of > course. > > On Sun, Apr 16, 2023 at 7:59 AM Jan wrote: > >> Thanks for the suggestions Alex. Interesting that enumerating the >> pointers in a constraint would work ... but it makes sense. >> >> I think I disagree

Re: [go-nuts] Re: Pointer constraint to generics

2023-04-15 Thread Jan
&& k != >> reflect.UnsafePointer { >> panic("PointerOrError must be instantiated with pointer type") >> } >> >> Obviously, none of this is ideal, but maybe it's the best you can do - >> apart from generating code. >> >> On Sat, A

[go-nuts] Re: Pointer constraint to generics

2023-04-15 Thread Jan
} t = (T)(ptr) return } func UnsafePointerOrError(v int) (unsafe.Pointer, error) { return unsafe.Pointer(), nil } func main() { flag.Parse() t, _ := PointerOrError[*C.MyThing](1) fmt.Println(t) } ``` On Saturday, April 15, 2023 at 8:41:28 PM UT

  1   2   3   4   5   6   7   8   9   10   >