Re: [go-nuts] stamped lock in Go?

2025-01-31 Thread 'Michael Knyszek' via golang-nuts
On Friday, January 31, 2025 at 1:58:39 PM UTC-5 Michael Knyszek wrote: I think I got a little overzealous with my opinions, it wasn't my intent to be particularly prescriptive. I also did not get the impression that you were suggesting the memory model should be different. Bottom line

Re: [go-nuts] stamped lock in Go?

2025-01-31 Thread 'Michael Knyszek' via golang-nuts
applicable). > > I think a more viable performant replacement in Go is to use copy on write > with an atomic object reference - which in most cases is going to be more > performant than using a StampedLock. > > On Jan 31, 2025, at 11:55 AM, 'Michael Knyszek' via gola

[go-nuts] Re: stamped lock in Go?

2025-01-31 Thread 'Michael Knyszek' via golang-nuts
This is a well-known pattern (use an atomic counter to check if anyone else modified some data in a critical section and retry or fall back if it happened), but as the extensive Java docs imply, any such abstraction is going be fairly leaky. Java has a very thoroughly defined memory model that

Re: [go-nuts] PDF to text

2025-01-23 Thread Michael Bright
Hi Mike, Not wanting to suggest that you take the Python route, but just sharing my experience. I've tried Acrobat Reader's "Save as Text" functionality, and also one or two Python libraries to extract text from PDFs (PyPDF2 is the one I've settled on). But what I learnt - without really dig

Re: [go-nuts] Go 1.24 BLooper

2025-01-21 Thread 'Michael Pratt' via golang-nuts
There was a lot of discussion of this on the proposal, starting with (and well summarized by) https://go.dev/issue/61515#issuecomment-1646194700. If we don't inline, there will be cases like yours that wanted to benchmark with inlining but don't get it. If we do inline, there will be cases that are

[go-nuts] Re: How does Go GC set target heap size in kubernetes?

2025-01-17 Thread 'Michael Knyszek' via golang-nuts
The Go runtime isn't aware if it's running in a pod/container/cgroup/etc. or not, not out of the box anyway. Also, GOMEMLIMIT=infinity (effectively) by default. Are you using something like https://github.com/KimMachineGun/automemlimit? At least, that would also explain why you saw things chang

[go-nuts] [security] Go 1.24 Release Candidate 2 is released

2025-01-16 Thread 'Michael Knyszek' via golang-nuts
https://go.dev/dl/#go1.24rc2 To find out what has changed in Go 1.24, read the draft release notes: https://tip.golang.org/doc/go1.24 Cheers, Michael and Michael for the Go team -- You received this message because you are subscribed to the Google Groups "golang-nuts" group. To unsub

[go-nuts] [security] Go 1.23.5, Go 1.22.11, and Go 1.24 RC2 pre-announcement

2025-01-13 Thread 'Michael Knyszek' via golang-nuts
, Michael and Michael for the Go team -- You received this message because you are subscribed to the Google Groups "golang-nuts" group. To unsubscribe from this group and stop receiving emails from it, send an email to golang-nuts+unsubscr...@googlegroups.com. To view this discussion vi

Re: [go-nuts] Re: Working with release candidates

2024-12-20 Thread 'Michael Pratt' via golang-nuts
Could you file an issue about this with reproduction steps? My attempt to reproduce this works fine. go.mod ``` module example.com go 1.24rc1 tool ( golang.org/x/tools/cmd/stringer golang.org/x/tools/cmd/toolstash ) require ( golang.org/x/mod v0.22.0 // indirect

Re: [go-nuts] draft 1.24 release notes: broken link

2024-12-10 Thread 'Michael Pratt' via golang-nuts
Thanks for the report. Normally, https://go.dev/issue/46477 redirects to https://github.com/golang/go/issues/46477. That redirect doesn't work on tip.golang.org, tracked by https://go.dev/issue/58484. Russ just mailed https://go.dev/cl/634915, which should fix this when it rolls out. On Tue, Dec 1

[go-nuts] documentation for dlog output

2024-08-27 Thread Michael Mitchell
At the end of dlog trace, we get the following. These seem like basic assembly instructions with addresses but I have no idea what any of it means, and I can't find any documentation for it. Can someone take the time to go through the significance of each one by one, and that way at least if

[go-nuts] Re: Advancing the container/set design?

2024-08-22 Thread Michael Whatcott
+1 On Monday, July 1, 2024 at 2:49:40 PM UTC-6 twp...@gmail.com wrote: > +1 on this. > > At the moment, every module that needs a set implementation ends up > creating its own, either using map[T]struct{} or map[T]bool. Having a set > implementation in the standard library would significantly i

Re: [go-nuts] GOEXPERIMENT source code build

2024-08-16 Thread 'Michael Pratt' via golang-nuts
You can just set the environment variable, so `GOEXPERIMENT=swissmap go test`. On Fri, Aug 16, 2024 at 3:28 PM Leah Stapleton wrote: > Hi, > I have a question about building go source code to run the tests go swiss > maps experiments. > > first off, > There are tests with the same name in map_sw

[go-nuts] Re: ANN: fun: call your LLMs like they are just a function

2024-08-04 Thread Michael Oguidan
Thank you @Mitar for sharing this knowledge with us. On Sunday, August 4, 2024 at 8:52:29 AM UTC Mitar wrote: > Hi! > > I made a small library which allows using AI models like they were > just a Go function, but that Go function can be: > > - defined with natural language description > - example

[go-nuts] Re: Go 1.21 / FIPS

2024-07-04 Thread Michael Oguidan
Hi Dagood, Please can you tell me what FIPS's for? And why we can't use it outside Google. On Thursday, July 4, 2024 at 1:45:37 AM UTC dagood wrote: > Hi Devin, > > The FIPS functionality in Go (which, to be clear, is not supported for use > outside of Google) is documented here: > go/src/cryp

[go-nuts] Re: Go 1.21 / FIPS

2024-07-03 Thread Michael Oguidan
C Damien A wrote: > Michael, > > I am not fully sure what you mean? Can you elaborate on what you are > asking me? I am not really a Go Developer just a Linux Admin who often gets > tasked with trying to build packages. > > On Tuesday, July 2, 2024 at 10:42:06 AM UTC-7 Michael Og

[go-nuts] Re: Go 1.21 / FIPS

2024-07-02 Thread Michael Oguidan
Hi, Please can we dig the "crypto backend" first to see? On Tuesday, July 2, 2024 at 3:45:40 PM UTC Damien A wrote: > > I have been building Grafana packages previously using Go 1.20.5 on Oracle > Enterprise Linux 9 with the following settings: > > export IMPORTPATH=%{_builddir}/grafana-%{versio

[go-nuts] Re: Performance of unique package

2024-06-25 Thread 'Michael Knyszek' via golang-nuts
The unique package itself has a few benchmarks you can run if you'd like, though they're somewhat limited. They exist primarily to validate that the implementation has

Re: [go-nuts] Memory operations hung in semacquire state, GC routine parked while holding semaphore?

2024-05-29 Thread 'Michael Knyszek' via golang-nuts
The example goroutine in the original post is parked waiting for some other goroutine to finish up the GC cycle. Somewhere, a goroutine is getting stuck trying to finish it up, which could possibly be a deadlock. (I am especially suspicious of a deadlock bug because most threads are stopped the

Re: [go-nuts] Loop unit char entered

2024-03-05 Thread Michael Adamus
Daniel, I'd like to see source code for this if you're able. Thanks, Mike On Saturday, April 16, 2022 at 6:21:30 AM UTC-4 Daniel Jankins wrote: > Thank you, > That is what I did. It works very well. > Thank you again > > On Fri, Apr 15, 2022 at 8:48 PM Kurtis Rader wrote: > >> On Fri, Apr 15,

[go-nuts] Re: discrepancy between goal heap size and NextGC

2024-01-30 Thread 'Michael Knyszek' via golang-nuts
, you'll observe that 799 MiB heap goal after 12 GCs have completed (your read of numgc), but you'll be reading that heap goal *during* the 13th GC cycle, which is what the GC trace is reporting on. On Tuesday, January 30, 2024 at 10:48:26 AM UTC-5 Michael Mitchell wrote: > Might

[go-nuts] Re: array index not starting at 0

2024-01-30 Thread 'Michael Knyszek' via golang-nuts
I see that you're on Windows. The clock granularity on Windows is really coarse (15 ms) because AFAIK there are no fast fine-grained OS-level clocks available. There are fine-grained clocks, but they're heavyweight. They're too heavyweight for many situations in the runtime, but honestly, they'

[go-nuts] Re: discrepancy between goal heap size and NextGC

2024-01-30 Thread Michael Mitchell
number of completed GC cycles, where a GC // cycle is sweep termination, mark, mark termination, and // sweep. This differs from memstats.numgc, which is // incremented at mark termination. cycles uint32 On Monday, January 29, 2024 at 7:12:53 AM UTC-5 Michael Mitchell wrote: > In the twelfth garb

Re: [go-nuts] Re: Passing 2d arrays from Go to C using runtime.Pinner

2024-01-29 Thread 'Michael Knyszek' via golang-nuts
inters to C memory (pinned or not) may end up restricting GC implementations in a way we don't want to. I filed https://github.com/golang/go/issues/65349 to track this. On Mon, Jan 29, 2024 at 11:17 AM peterGo wrote: > Michael, > > The OP appears to have lost interest in debugging. Here's

[go-nuts] discrepancy between goal heap size and NextGC

2024-01-29 Thread Michael Mitchell
In the twelfth garbage collection of a short program I ran, GC trace reports the goal heap size as 735 MB (see below for gc11, gc12 and gc13 from GC trace) I also checked runtime Memstats (see attached image), and it says the nextGC target after 12 GCs have run is 838103616. Should goal Heap

[go-nuts] Re: Passing 2d arrays from Go to C using runtime.Pinner

2024-01-26 Thread 'Michael Knyszek' via golang-nuts
Ignoring more efficient ways to pass memory to C for a moment, superficially I do think your code using Pinner should work. Do you have a full reproducer? It's hard to tell from just looking at your code if your code is the problem, or its just enough to trigger some other cgo issue elsewhere i

[go-nuts] pauseEnd times in runtime.Memstats

2024-01-12 Thread Michael Mitchell
In runtime.Memstates, one of the stats given is the timestamps for the last 256 garbage collections in the PauseEnd array, i.e. when those garbage collections took place. So if you subtract one timestamp from another, you can find out how much time took place between garbage collections. Is th

[go-nuts] Re: garbage collections on Windows and Mac

2024-01-09 Thread 'Michael Knyszek' via golang-nuts
On Tuesday, January 9, 2024 at 10:21:26 PM UTC-5 Michael Mitchell wrote: Hi, I have noticed on my macbook pro that HeapInUse is always slightly above NextGC when the garbage collection occurs. According to mstats.go, the "garbage collector's goal is to keep HeapAlloc less than N

[go-nuts] garbage collections on Windows and Mac

2024-01-09 Thread Michael Mitchell
Hi, I have noticed on my macbook pro that HeapInUse is always slightly above NextGC when the garbage collection occurs. According to mstats.go, the "garbage collector's goal is to keep HeapAlloc less than NextGC" and also according to mstats.go, "HeapInUse minus HeapAlloc estimates the amou

[go-nuts] Re: Low memory utilization when using soft memory limit with GOGC=off

2023-12-06 Thread 'Michael Knyszek' via golang-nuts
On Tuesday, December 5, 2023 at 1:06:19 AM UTC-5 Zhihui Jiang wrote: Hi there, We are running a large scale recommendation system using Golang and we are working on some GC related improvement recently. One of the changes we are trying to apply is to use soft memory limit with GOGC=off as su

Re: [go-nuts] Go/Python interop

2023-11-27 Thread 'Michael Knyszek' via golang-nuts
On Thu, Nov 23, 2023 at 11:52 AM Sebastien Binet wrote: > On Thu Nov 23, 2023 at 15:23 CET, 'Michael Knyszek' via golang-nuts wrote: > > Also, I'd like to clarify: > > > > - [David]: is it a good idea to use cgo for Go-Python interop? > > - [Michael

Re: [go-nuts] Go/Python interop

2023-11-23 Thread 'Michael Knyszek' via golang-nuts
Also, I'd like to clarify: - [David]: is it a good idea to use cgo for Go-Python interop? - [Michael]: no. better with pipe or RPC I'm wrong about this. A conversation after the meeting clarified a misunderstanding I had about Go->Python calls specifically. Both Go->Python and

Re: [go-nuts] Shrinking pprof data for PGO through quantization.

2023-11-09 Thread 'Michael Pratt' via golang-nuts
Hi Adam, Thanks for sending this, lots of interesting ideas here! I've been meaning for a long time to have more concrete guidelines for how much data collection is enough for good results, to include on https://go.dev/doc/pgo. I also think it would be valuable to provide tooling that can help m

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

2023-11-07 Thread 'Michael Knyszek' via golang-nuts
t one finalizer, one could argue such an ordering problem doesn't exist (unless I'm missing something of course). Nonetheless, the cycle still isn't collected. On Tuesday, November 7, 2023 at 3:51:58 AM UTC+1 Michael Knyszek wrote: Yes, cycles containing a finalizer aren't guaran

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

2023-11-06 Thread 'Michael Knyszek' via golang-nuts
Yes, cycles containing a finalizer aren't guaranteed to be freed. As others have pointed out, this is documented. SetFinalizer is really designed for a narrow set of use-cases, so concessions were made for overall GC performance. This case is one of them. IIUC, the core problem is a combination

Re: [go-nuts] Suggestions on optimizing Go GC

2023-10-30 Thread 'Michael Knyszek' via golang-nuts
I second Jason's message, and +1 to off-heap memory as a last resort. Here are a few more details: For a starting point on how to reduce memory allocations directly, see https://go.dev/doc/gc-guide#Optimization_guide. Note that this may require restructuring your program in places. (e.g. passin

Re: [go-nuts] Question about runtime.Pinner

2023-10-12 Thread 'Michael Knyszek' via golang-nuts
On Thursday, October 12, 2023 at 9:55:12 AM UTC-4 Ian Lance Taylor wrote: On Thu, Oct 12, 2023 at 5:06 AM Pascal Costanza wrote: > > I have a question about runtime.Pinner: The documentation states that you can only pin an object when it’s the result of calling new, taking the address of a

[go-nuts] Re: Question about runtime.Pinner

2023-10-12 Thread 'Michael Knyszek' via golang-nuts
On Thursday, October 12, 2023 at 8:07:02 AM UTC-4 Pascal Costanza wrote: Hi, I have a question about runtime.Pinner: The documentation states that you can only pin an object when it’s the result of calling new, taking the address of a composite literal, or taking the address of a local variab

[go-nuts] Re: go 1.21 tuned gc: what's it about?

2023-08-07 Thread 'Michael Knyszek' via golang-nuts
I saw this post a while back and forgot to reply; sorry about that. It's about this issue but also a little bit about this issue . Both of those problems can be summarized as the GC pacing itself for the exac

[go-nuts] Re: Maybe a Bug? The Go compiler stores a stack pointer into a global object

2023-08-03 Thread 'Michael Knyszek' via golang-nuts
That line (the full sentence is "The garbage collector now includes non-heap sources of garbage collector work (e.g., stack scanning) when determining how frequently to run.") is unrelated. It only refers to a change in accounting for what gets included in the GOGC calculation, not a change in

[go-nuts] Re: about "hybrid barrier"

2023-07-30 Thread 'Michael Knyszek' via golang-nuts
On Friday, July 28, 2023 at 8:05:03 AM UTC-4 metronome wrote: Hi, I came across two questions regarding the hybrid barrier that I am hoping someone can help with. 1. Chang https://go-review.googlesource.com/c/go/+/31765 says: *"It's unconditional for now because barriers on channel operati

[go-nuts] Re: Possible Go Compiler or Runtime bug?

2023-07-27 Thread 'Michael Knyszek' via golang-nuts
On Thursday, July 27, 2023 at 6:16:57 PM UTC-4 Michael Knyszek wrote: I believe this is working as intended, because I don't think the spec <https://go.dev/ref/spec#Conversions> makes any guarantees about the capacity of the slice you get back from a conversion. (Other than the fa

[go-nuts] Re: Possible Go Compiler or Runtime bug?

2023-07-27 Thread &#x27;Michael Knyszek' via golang-nuts
The number 32 for the capacity comes from this constant , and the returned byte slice in that case is likely coming from a compiler-inserted call to stringtoslicebyte

[go-nuts] Docker container vscode debugging issue

2023-06-10 Thread Michael Odumosu
Greetings I am trying to debug an open source pacakge hashicorp vault from a docker container, I am using vscode remote debugging however its not stopping on any of the breakpoints. I tried changing the remote path according to this article but no luck, the reason I am debugging hashicorp vault

[go-nuts] ANN: ficta 1.0.0

2023-05-10 Thread Michael Ellis
I've just released ficta, a small project built using Francisco Escher's goopenai package. https://github.com/Michael-F-Ellis/ficta Ficta is a command line program that lets you use OpenAI's completion API from any text editor. Ficta exists because I found it frustrating to writ

Re: [go-nuts] Re: Looking for a specialized proxy package

2023-03-15 Thread Michael Ellis
d on the client at all and the > server can still request things in real time. > > Like: > https://www.talentica.com/blogs/part-3-building-a-bidirectional-streaming-grpc-service-using-golang/ > > On Wed, Mar 15, 2023, 6:35 PM Michael Ellis wrote: > >> FWIW, I p

[go-nuts] Re: Looking for a specialized proxy package

2023-03-15 Thread Michael Ellis
5, 2023 at 5:57:48 PM UTC-4 Michael Ellis wrote: > I posted a question about this on ServerFault > <https://serverfault.com/questions/1125770/iot-http-multiplexing-through-cloud-host>last > > week but didn't get any answers other than a few comments from one person >

[go-nuts] Looking for a specialized proxy package

2023-03-15 Thread Michael Ellis
I posted a question about this on ServerFault last week but didn't get any answers other than a few comments from one person who said (basically) "use a VPN". That seems like overkill. I'm trying to find a

[go-nuts] Go 1.20 is released

2023-02-01 Thread &#x27;Michael Knyszek' via golang-nuts
go1.20 is by using the go command: $ go install golang.org/dl/go1.20@latest $ go1.20 download To compile from source using a Git clone, update to the release with git checkout go1.20 and build as usual. Thanks to everyone who contributed to the release! Cheers, Michael, Matthew, and Dmitri for the Go

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

2022-11-16 Thread &#x27;Michael Knyszek' via golang-nuts
On Wed, Nov 16, 2022 at 10:19 AM Jie Zhang wrote: > Actually, we used go1.16.5 before go1.19 released. Now we're consider > using go1.19 GOMEMLIMIT instead. > > But GOMEMLIMIT is a soft limit, if you deploy multiple services in the > same host (not per container per service), there will be proble

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

2022-11-10 Thread &#x27;Michael Knyszek' via golang-nuts
That's correct. The runtime has a simple heuristic for avoiding zeroing but it's far from perfect. As a result, a ballast is inherently always going to be a little risky. This is especially true on some platforms, such as Windows, since there's no way to avoid marking the memory as committed (W

[go-nuts] Re: Facing issues while using builtin functions while executing golang templates

2022-10-20 Thread Michael Ellis
I did a quick search for "is not a defined function". That message appears once in https://go.dev/src/text/template/exec.go. It's triggered when findFunction() fails while executing a template. Hope that's of some use. On Wednesday, October 19, 2022 at 8:20:46 AM UTC-4 rit...@ext.dunzo.in w

Re: [go-nuts] How long does it take to import packages?

2022-08-31 Thread &#x27;Michael Pratt' via golang-nuts
Setting GODEBUG=inittrace=1 will log a trace of init function execution, which you can use to determine if init is slow, and if so which packages. e.g., `GODEBUG=inittrace=1 go version` ends with "init main @9.5 ms", indicating that it look 9.5ms to run all init functions. The format is described

[go-nuts] Is there FIX exchange trading server or client simulator project with Go

2022-07-23 Thread &#x27;michael yue' via golang-nuts
Is there FIX exchange trading server or client simulator project with Go -- You received this message because you are subscribed to the Google Groups "golang-nuts" group. To unsubscribe from this group and stop receiving emails from it, send an email to golang-nuts+unsubscr...@googlegroups.com.

Re: [go-nuts] noinline is 25% faster than inline on apple m1 ?

2022-07-22 Thread &#x27;Michael Pratt' via golang-nuts
I can reproduce similar behavior on linux-amd64: $ perf stat ./example.com.test -test.bench=BenchmarkInline -test.benchtime=1x goos: linux goarch: amd64 pkg: example.com cpu: Intel(R) Xeon(R) W-2135 CPU @ 3.70GHz BenchmarkInline-12 1 16.78 ns/op PASS Performan

[go-nuts] Re: Go allocator: allocates arenas, reclaims pages?

2022-06-20 Thread &#x27;Michael Knyszek' via golang-nuts
une 20, 2022 at 5:46:36 PM UTC-4 Michael Knyszek wrote: > Thanks for the question. The scavenger isn't as publicly visible as other > parts of the runtime. You've got it mostly right, but I'm going to repeat > some things you've already said to make it cl

[go-nuts] Re: Go allocator: allocates arenas, reclaims pages?

2022-06-20 Thread &#x27;Michael Knyszek' via golang-nuts
Thanks for the question. The scavenger isn't as publicly visible as other parts of the runtime. You've got it mostly right, but I'm going to repeat some things you've already said to make it clear what's different. The Go runtime maps new heap memory (specifically: a new virtual memory mapping

Re: [go-nuts] Crash within netpoll.go?

2022-06-08 Thread Michael Sweeney
at 4:55:47 PM UTC-7 Ian Lance Taylor wrote: > On Wed, Jun 8, 2022 at 4:21 PM Michael Sweeney wrote: > > > > Hi All, I searched around for details and references for a similar error > and could not find anything. I am posting here to see if someone has any > pointers to help

[go-nuts] Crash within netpoll.go?

2022-06-08 Thread Michael Sweeney
Hi All, I searched around for details and references for a similar error and could not find anything. I am posting here to see if someone has any pointers to help me discover the root cause. A GO 1.15.4 executable encountered a panic and generated a core file. Using 'dlv' to analyze the core fi

Re: [go-nuts] Re: Can’t view golang source when clicking on method name in a pkg.go.dev

2022-04-26 Thread &#x27;Michael Pratt' via golang-nuts
This sounds like https://go.dev/issue/48956. In that case, it was some interference from an extension. On Tue, Apr 26, 2022 at 4:55 PM Ian Lance Taylor wrote: > On Tue, Apr 26, 2022 at 12:40 AM christoph...@gmail.com > wrote: > > > > This is a screen capture of what I see https://imgur.com/a/nu

Re: [go-nuts] Generics faster than native float64?

2022-04-19 Thread Michael Ellis
FWIW, no difference on my MacBook. (base) michaels-mbp copybench % go test -bench=. goos: darwin goarch: amd64 pkg: localgo/copybench cpu: Intel(R) Core(TM) i7-4770HQ CPU @ 2.20GHz BenchmarkCopy-8 6999800 169.4 ns/op BenchmarkCopyG-86967590 170.6 ns/op PASS ok

Re: [go-nuts] encoding/json mistakenly transfer int64 format to string

2022-04-14 Thread Michael Ellis
@Brian That example is a superbly concise explanation go mod. Thanks! And I had no idea you could specify filenames and modules in the Playground. That's really useful! On Wednesday, April 13, 2022 at 3:11:54 AM UTC-4 Brian Candler wrote: > > I am a little bewildered by the new mod configurat

Re: [go-nuts] Looked at using Go ... nil/SEGV really bothered me .. Go2 Proposal?

2022-03-25 Thread &#x27;Michael Toy' via golang-nuts
ime you talk about something complex and important. I think I disagree with some statements, but even the disagreement is super helpful. Thanks for the discussion! -Michael Toy On Thursday, March 24, 2022 at 12:22:44 AM UTC-10 Brian Candler wrote: > The OP hasn't said specifically whi

[go-nuts] Looked at using Go ... nil/SEGV really bothered me .. Go2 Proposal?

2022-03-23 Thread &#x27;Michael Toy' via golang-nuts
I barely understand Go, so this is likely a stupid idea. Since Go uses nil for a lot of things, lots of things can be nil. I am not a huge fan of the null safe accessor. ( https://github.com/golang/go/issues/42847 ) I am a huge fan of the compiler telling me the places where I have not checked

[go-nuts] Constrain a type parameter to be assignable to another

2022-03-16 Thread Michael Andersen
omeStruct) and the interface it's meant to adhere to. The above code does not compile with 1.18 (cannot use a type parameter as constraint) I have a runtime check that works, but I'd love a compile time check. Is there a way to do that? Thanks Michael -- You received this mes

Re: [go-nuts] Generic member of recursive struct

2021-12-20 Thread Michael Ellis
string | > *HtmlNode[Something]]`. And the fact that there is no actual answer to what > "Something" would be should be a strong indicator for how much generics are > not what you want for this. > > On Mon, Dec 20, 2021 at 8:29 PM Axel Wagner > wrote: > >> &

Re: [go-nuts] Generic member of recursive struct

2021-12-20 Thread Michael Ellis
On Monday, December 20, 2021 at 1:33:49 PM UTC-5 ren...@ix.netcom.com wrote: > You should use interfaces and a “node” type. > Hmm, I tried type Node interface { string | []*HtmlTree } type HtmlTree struct { T string // html tagname, e.g. 'head' A string // zer

Re: [go-nuts] Generic member of recursive struct

2021-12-20 Thread Michael Ellis
se that is not a use case for generics, it's a use case for sum types > (which Go does not have). > > On Mon, Dec 20, 2021 at 4:11 PM Michael Ellis > wrote: > >> > They can't, sorry. >> Ok. Thanks, Axel. >> Saves me wasting more time. In the past 3

Re: [go-nuts] Generic member of recursive struct

2021-12-20 Thread Michael Ellis
> They can't, sorry. Ok. Thanks, Axel. Saves me wasting more time. In the past 3 years of using Go, this is the only use case where I've really wanted generics (other cases I've encountered so far are easily handled with code generation). -- You received this message because you are subscri

[go-nuts] Generic member of recursive struct

2021-12-20 Thread Michael Ellis
I've got a package, github.com/Michael-F-Ellis/goht, that supports creating HTML docs in Go. It works well, for my purposes at least, but I've always been bothered by having to use []interface{} to define the struct member, C, that supports recursion. type HtmlTree struct {

[go-nuts] Re: Do you have a minimal runnable go code that contain all key words in go?

2021-12-06 Thread Michael Ellis
Nice! Noticed it didn't have "new" so I changed the counter initializer in main() from var c = counter to p := new(counter) var c = *p https://go.dev/play/p/2vw4w44qSWm On Sunday, December 5, 2021 at 4:10:54 PM UTC-5 ben...@gmail.com wrote: > Not strictly "minimal" -- it uses s

[go-nuts] Go 1.17.4 and Go 1.16.11 are released

2021-12-02 Thread Michael Knyszek
from source using a Git clone, update to the release with "git checkout go1.17.4" and build as usual. Thanks to everyone who contributed to the releases. Cheers, Michael, Heschi, Dmitri, and Carlos for the Go team -- You received this message because you are subscribed to the Google Group

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

2021-11-12 Thread Michael Ellis
FWIW (which may not be much) I've settled on explicitly naming my return values in the function declaration. If the function returns include an error, I name always name it err. The general pattern is func foo() (v someType, err error) { err = doSomething() if err != nil { err = fmt.Err

Re: [go-nuts] initialization loop ?

2021-10-23 Thread Michael Ellis
> The rules for when an initialization loop occurs are part of the language spec: https://golang.org/ref/spec#Package_initialization. Thanks for the link. It helps with questions I've had recently about package initialization. Can you confirm that the statement "If a package has imports, the

[go-nuts] [security] Go 1.17.2 and Go 1.16.9 are released

2021-10-07 Thread Michael Knyszek
m the Go web site: https://golang.org/dl/ To compile from source using a Git clone, update to the release with "git checkout go1.17.2" and build as usual. Thanks to everyone who contributed to the releases. Cheers, Michael and Heschi for the Go team -- You received this message beca

Re: [go-nuts] Re: Questions about documentation of Go standard library

2021-10-07 Thread Michael Ellis
Kamil, Have you read https://go.dev/blog/errors-are-values by Rob Pike? Wrapping my head around the concept that an error is simply a value returned from a function was tremendously helpful when I had questions along the same lines as yours. -- You received this message because you are subscr

Re: [go-nuts] Question on handling Data Race

2021-09-11 Thread Michael Dwyer
lem sufficiently? Have I missed any potential edge cases, that I have not thought through? I look forward to your reply. Thank you for your time and patience ... THANX(MKD). On Saturday, September 11, 2021 at 8:42:36 PM UTC-4 Kurtis Rader wrote: > On Sat, Sep 11, 2021 at 5:01 PM Michael

[go-nuts] Question on handling Data Race

2021-09-11 Thread Michael Dwyer
Presently working on a Data Race and have some questions on how to proceed. The code example is a hypothetical mock up of the actual code under review, but is a fair representation. The struct used by both functions is named Foo. In the hypothetical, SomeFunc() reads variable from foo.bar, checki

Re: [go-nuts] Two consecutive reads from a buffered channel results in deadlock

2021-09-04 Thread Michael Dwyer
helpful hints and documentation, so others can learn. Greatly appreciate your time an assistance. THANX(MKD). On Saturday, September 4, 2021 at 9:31:32 PM UTC-4 Kurtis Rader wrote: > On Sat, Sep 4, 2021 at 5:55 PM Michael Dwyer wrote: > >> I encountered a deadlock when reading fro

[go-nuts] Two consecutive reads from a buffered channel results in deadlock

2021-09-04 Thread Michael Dwyer
I encountered a deadlock when reading from a buffered channel. The deadlock occurs when an attempt is made to read from the channel twice, without an intermediate write to the channel. The problematic code is as follows: func main() { myInt := 432 readerChan := make(chan int, 3) for forI

[go-nuts] Re: Printing a slice of structs recursively

2021-09-02 Thread Michael Ellis
Here's one way. https://goplay.space/#5KzrUc0171N On Thursday, September 2, 2021 at 1:03:48 AM UTC-4 seank...@gmail.com wrote: > Try doing it recursively, passing in both the current parent id and > indentation level > > On Thursday, September 2, 2021 at 3:55:01 AM UTC+2 n.erde...@gmail.com > w

Re: [go-nuts] Makefiles for Go Programs

2021-08-23 Thread Michael Ellis
Three cheers for mage . It's more verbose than make but it's pure Go. I use it to build and test projects that include generated html/css/js supported by a Web Assembly clients communicating with a server. On Monday, August 23, 2021 at 7:33:10 PM UTC-4 Connor Kuehl wrote

[go-nuts] Go 1.17 is released

2021-08-16 Thread Michael Knyszek
by using the go command: $ go get golang.org/dl/go1.17 $ go1.17 download To compile from source using a Git clone, update to the release with "git checkout go1.17" and build as usual. Thanks to everyone who contributed to the release! Cheers, Michael and Dmitri for the Go Team -- Yo

[go-nuts] GOOS=js/GOARCH=wasm

2021-07-27 Thread W. Michael Petullo
I have been building applications using the GOOS=js/GOARCH=wasm for around two years. I really like being able to write both client and server code in Go. I have four questions that I have not yet found a clear answer for: (1) The syscall/js package is marked EXPERIMENTAL. Is there any consensus

Re: [go-nuts] Go and GPUs

2021-06-25 Thread Michael Poole
for portability. If I were going to spend the time on this, I would probably target SPIR-V with Vulkan or OpenCL for portability rather than Nvidia's PTX or Apple's Metal. AMD, Nvidia and Google (Android) all have good support for SPIR-V through their Vulkan stacks, and there are t

Re: [go-nuts] How to cast a multi-value?

2021-05-18 Thread 'Marc Michael' via golang-nuts
; > It's still using additional variables, but they are hidden inside the > helper function. > On Sunday, May 16, 2021 at 8:07:24 PM UTC-7 Kurtis Rader wrote: > >> On Sun, May 16, 2021 at 7:49 PM 'Marc Michael' via golang-nuts < >> golan...@googlegroups.com&

[go-nuts] How to cast a multi-value?

2021-05-16 Thread 'Marc Michael' via golang-nuts
Hello, as Go provides multi values I would expect that's possible to cast such a multi value. Do I see it correctly, that Go does not provide it? Example: os.ReadFile returns []byte, error. I want to cast the []byte to a string. content, err := os.ReadFile(path) Is it possible to cast the []by

Re: [go-nuts] Syscalls that take structs with embedded pointers

2021-05-14 Thread &#x27;Michael Pratt' via golang-nuts
e you sure that's not a bug? What's to stop the *Byte from being > moved by the GC? > > On Fri, May 14, 2021 at 2:27 PM Michael Pratt wrote: > > > > You can use a *byte for the buffer. For instance, unix.Iovec does this: > https://pkg.go.dev/golang.org/x/sy

Re: [go-nuts] Syscalls that take structs with embedded pointers

2021-05-14 Thread &#x27;Michael Pratt' via golang-nuts
You can use a *byte for the buffer. For instance, unix.Iovec does this: https://pkg.go.dev/golang.org/x/sys/unix#Iovec Users can cast a *unix.Iovec directly to unsafe.Pointer for Syscall without any special handling of the *byte field. On Fri, May 14, 2021, 09:01 sh...@tigera.io wrote: > Now, i

Re: [go-nuts] TotalAlloc dropped in runtime/metrics

2021-04-29 Thread &#x27;Michael Knyszek' via golang-nuts
Hi Marco, https://go-review.googlesource.com/c/go/+/312431 just landed and should resolve the issue for Go 1.17. On Tue, Apr 20, 2021 at 3:28 PM Michael Knyszek wrote: > Oh, actually, you can compute Mallocs and Frees from allocs-by-size and > frees-by-size (summing the total # of samples

Re: [go-nuts] Re: How to do vdso calls in my own code?

2021-04-27 Thread &#x27;Michael Pratt' via golang-nuts
Oops, I should say the syscall package could do this. x/sys/unix has the extra complexity of not being tied to a Go release. On Tue, Apr 27, 2021, 12:53 Michael Pratt wrote: > I'm not sure if calling through the VDSO is the best solution to this > specific issue, though it does s

Re: [go-nuts] Re: How to do vdso calls in my own code?

2021-04-27 Thread &#x27;Michael Pratt' via golang-nuts
I'm not sure if calling through the VDSO is the best solution to this specific issue, though it does sound like a case that would certainly benefit. Regardless, one fairly clean way we could support this would be to make x/sys/unix.ClockGettime (and Gettimeofday) call through the VDSO rather than

Re: [go-nuts] TotalAlloc dropped in runtime/metrics

2021-04-20 Thread &#x27;Michael Knyszek' via golang-nuts
Oh, actually, you can compute Mallocs and Frees from allocs-by-size and frees-by-size (summing the total # of samples). You can only estimate TotalAlloc though, which is genuinely missing. On Tue, Apr 20, 2021 at 3:14 PM Michael Knyszek wrote: > Oh gosh, I think TotalAlloc, Mallocs, and Fr

Re: [go-nuts] TotalAlloc dropped in runtime/metrics

2021-04-20 Thread &#x27;Michael Knyszek' via golang-nuts
Oh gosh, I think TotalAlloc, Mallocs, and Frees are actually an oversight on my part. Sorry about that. They're very easy to add and I can probably even add them for this release. Please do use the new runtime/metrics package! Most of the other metrics should be there in some form (e.g. the divis

Re: [go-nuts] Why does Go ignore HTTP_PROXY and HTTPS_PROXY if the proxy address is localhost

2021-04-14 Thread Michael Baker
On 14/04/2021 20:25, Jeff Peck wrote: Just a complete shot in the dark. Have you verified that the environment variables you set are indeed getting picked up inside of your application? Try checking the output of os.GetEnv("HTTP_PROXY"), os.GetEnv("HTTPS_PROXY"), and os.GetEnv("NO_PROXY"). Ma

Re: [go-nuts] Modules... why it has to be so painfull?

2021-04-09 Thread Michael Ellis
not yet published. I'm using the replace statement in tbflash's go.mod file, i.e., replace github.com/Michael-F-Ellis/tbchrom v1.0.0 => /Users/mellis/localgo/tbchrom localgo ├── go.mod ├── mypkg │ └── pkg.go ├── myprog │ └── main.go ├── tbchrom │ ├── .git │ ├── .gitig

Re: [go-nuts] Re: [golang-dev] Go 1.16.3 and Go 1.15.11 are released

2021-04-02 Thread &#x27;Michael Pratt' via golang-nuts
mgcsweepbuf.go was deleted in 1.16, so it seems you still have files from 1.15 sitting around in /usr/local/go/. On Fri, Apr 2, 2021 at 4:13 AM Jan Mercl <0xj...@gmail.com> wrote: > On Thu, Apr 1, 2021 at 11:52 PM Dmitri Shuralyov > wrote: > > > We have just released Go versions 1.16.3 and 1.15.

Re: [go-nuts] string matching

2021-04-01 Thread Michael Poole
s) } } As you can see, the regular expression-based solution suggested by others leads to less code. This input string is so short that CPU usage will be negligible for most purposes, outweighed by graceful error handling and code maintenance concerns. Best regards, Michael On

Re: [go-nuts] Finding error type for `errors.As` and `errors.Is`

2021-04-01 Thread &#x27;Michael Schaller' via golang-nuts
error types and values in the error chain would be a worthwhile addition to Go's `errors` package. On Wednesday, March 31, 2021 at 7:33:32 PM UTC+2 rog wrote: > On Wed, 31 Mar 2021 at 18:05, 'Michael Schaller' via golang-nuts < > golan...@googlegroups.com> wrote: > >

[go-nuts] Finding error type for `errors.As` and `errors.Is`

2021-03-31 Thread &#x27;Michael Schaller' via golang-nuts
error type (reflect.Type) and the respective error? Quick example: https://play.golang.org/p/hDW0_6P7O2Y Best, Michael -- You received this message because you are subscribed to the Google Groups "golang-nuts" group. To unsubscribe from this group and stop receiving emails from i

  1   2   3   4   5   6   7   8   9   10   >