Re: [go-nuts] JSON: Having trouble parsing map keys with dots like {"foo.bar":"baz"}

2020-01-29 Thread Mark Hansen
Ah, I see what's going on: Go is mapping the "qux" field to the Qux struct arg just because they're case-insensitively equal. Go's totally ignoring my invalid struct tag. D'oh, I was totally holding it wrong. Thanks everyone! :-) On Wed, 29 Jan 2020 at 08:12, Mark Hansen wrote: &g

[go-nuts] SWIG-generated Go wrapper mishandling(?) pointers to pointers to structs

2020-04-17 Thread mark mellar
the GetTitle function to receive a Book** instead of Book* things started working as expected. Any hints on how we might configure SWIG to generate a version of the code which works for us. without us having to hack what it generates? Thanks! Mark -- You received this message be

[go-nuts] Re: Client certificate not sent to server

2020-05-19 Thread Mark Petrovic
I know this is an old thread, but I found it, so others might, too. I struggled with a similar problem of the Go HTTP client not sending client certs when challenged by the server. Yet, curl worked fine when given the same client certs, calling the same server endpoint. The cert chains I

[go-nuts] go.pkg.dev: blitznote.com/src/semver doesn't show up

2020-06-26 Thread Mark Kubacki
, Mark -- 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 on the web visit https://groups.

[go-nuts] Re: Writing bitmap data to a canvas with WebAssembly

2020-07-24 Thread Mark Farnan
Little old, but this might also help. A while back I built a helper package to deal with these issues for canvas rendering from Go. https://github.com/markfarnan/go-canvas I'm currently working on it to add WebGL support & get it working in TinyGo (some issues still). Regards

Re: [go-nuts] Why isn't go more popular?

2021-08-06 Thread Mark Sinoberg
can not agree more with u, go cool. 在2021年8月6日星期五 UTC+8 上午10:28:03 写道: > On Thu, Aug 5, 2021 at 7:20 PM Santi Ferra > wrote: > > > > When you see the ranking of the most liked programming languages, go is > near c++, a really "hated app". But since is efficient and produces really > clean

Re: [go-nuts] Go build speed dependent on time after source modification

2021-11-04 Thread Mark Fletcher
tead edit the file using vi, I get consistent 16 second compile times regardless of how long I wait. So, thanks for the suggestion. I still don't understand why my compile times are the same between the i9 and M1 Max, but I guess I need to do some more research. Thanks, Mark -- You rec

Re: [go-nuts] Go build speed dependent on time after source modification

2021-11-05 Thread Mark Fletcher
ng on 1.17.2 takes ~14 seconds. On tip, it takes ~5 seconds. Mark -- 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...@goo

[go-nuts] Go build speed dependent on time after source modification

2021-11-04 Thread Mark Fletcher
/suggestions would be appreciated. Mark -- 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

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

2023-09-08 Thread 'Mark' via golang-nuts
I often create small multi-value flag types, e.g. ```go type mode uint8 const ( argMode mode = iota baseMode cmdMode ) ``` The problem is that if I write, say, `m := baseMode`, although `m` has the correct type (`mode`), there is no way to constrain its values to the consts I've declared. In

[go-nuts] bufio.Scanner - possible bug or doc err?

2023-10-12 Thread 'Mark' via golang-nuts
I'm reading Debian *Package files, some of which are over 1M lines long. I used bufio.Scanner and found that it won't read past 1M lines (I'm using Go 1.21.1 linux/amd64). Is this a limitation of bufio.Scanner? If so then it ought to be in the docs. Or is it a bug? Or maybe I made a mistake

Re: [go-nuts] bufio.Scanner - possible bug or doc err?

2023-10-12 Thread 'Mark' via golang-nuts
ed fine, so I > suspect it's a bug in your code. But if not, please provide a complete > working executable example, with data, to help identify the problem. > > -rob > > > On Thu, Oct 12, 2023 at 7:39 PM 'Mark' via golang-nuts < > golan...@googlegroups.com> wrote: &

Re: [go-nuts] bufio.Scanner - possible bug or doc err?

2023-10-14 Thread 'Mark' via golang-nuts
Yes, that's a much better solution. On Friday, October 13, 2023 at 8:40:45 PM UTC+1 Ian Lance Taylor wrote: > On Thu, Oct 12, 2023 at 11:42 PM 'Mark' via golang-nuts > wrote: > > > > Yes, I can see now. > > > > Perhaps consider changing: > > > >

Re: [go-nuts] bufio.Scanner - possible bug or doc err?

2023-10-13 Thread 'Mark' via golang-nuts
MaxScanTokenSize), or must run sequential scans on a reader, should use bufio.Reader instead. Just a thought. Thanks. On Thursday, October 12, 2023 at 8:56:05 PM UTC+1 Ian Lance Taylor wrote: > On Thu, Oct 12, 2023 at 10:21 AM 'Mark' via golang-nuts > wrote: > > > > The docs

[go-nuts] Trying to create a test app for a library package

2022-11-02 Thread 'Mark' via golang-nuts
I have this layout: ``` mylib/ mylib/go.mod # module github.com/me/mylib mylib/mylib.go mylib/mylib_test.go ``` All this works fine, with both .go files being in the same pkg: mylib. However, there are some tests that I can't really do using the test module because they write to stdout. So I

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

2022-11-02 Thread 'Mark' via golang-nuts
like --version print the json. >> >> Note that this is about the version of some binary - not the version of a >> package. However, you could embed go.mod. But there may be better ways. >> >> Hope this helps. >> >> 'Mark' via golang-nuts schrieb am D

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

2022-11-02 Thread 'Mark' via golang-nuts
Oh, except that debug.BuildInfo (unsurprisingly) is only available in debug not release builds. So I guess the answer is that there isn't any nice way to do it. On Wednesday, November 2, 2022 at 8:31:29 AM UTC Mark wrote: > I hadn't realised about debug.BuildInfo - thanks! > > O

[go-nuts] Which tool provide's the Go playground's import handling...

2023-01-06 Thread 'Mark' via golang-nuts
If I visit the Go playground and change the body of `main()` to, say, `fmt.Println("hello", math.Abs(-5))` and then click Run, the `import "fmt"` line is _automatically_ corrected to be `import (\n\t"fmt"\n\t"math"\n)`. I'd like to be able to use this functionality so

Re: [go-nuts] Which tool provide's the Go playground's import handling...

2023-01-06 Thread 'Mark' via golang-nuts
Thanks, that's just what I needed :-) On Friday, January 6, 2023 at 8:21:02 AM UTC kortschak wrote: > On Fri, 2023-01-06 at 00:13 -0800, 'Mark' via golang-nuts wrote: > > If I visit the Go playground and change the body of `main()` to, say, > > `fmt.Println("hello", math

Re: [go-nuts] How to fix an awful marshal reflection hack

2022-11-30 Thread 'Mark' via golang-nuts
Yes, I'd already tried that (that's what I started with) and unfortunately it doesn't work. On Wednesday, November 30, 2022 at 3:37:47 PM UTC bse...@computer.org wrote: > On Wed, Nov 30, 2022 at 5:29 AM 'Mark' via golang-nuts < > golan...@googlegroups.com> wrote: > >> I

[go-nuts] How to read struct field names from an empty slice of structs

2022-11-21 Thread 'Mark' via golang-nuts
I have a two level general-purpose data structure: a struct containing one or more slices of structs. I want to be able to use reflection to populate this, but as a first step I want to extract the "table names" (i.e., the names of the fields of the outer struct), and the "field names" (the

[go-nuts] Re: How to read struct field names from an empty slice of structs

2022-11-21 Thread 'Mark' via golang-nuts
After struggling, I finally solved it; playground <https://go.dev/play/p/w0OSFCX10Rx> On Monday, November 21, 2022 at 10:55:06 AM UTC Mark wrote: > I have a two level general-purpose data structure: a struct containing one > or more slices of structs. > I want to be able to

Re: [go-nuts] How to fix an awful marshal reflection hack

2022-12-01 Thread 'Mark' via golang-nuts
ed without the print statements too.) And, of course the tests fail. So I'm _still_ using the awful hack! On Wednesday, November 30, 2022 at 5:30:24 PM UTC bse...@computer.org wrote: > On Wed, Nov 30, 2022 at 10:17 AM 'Mark' via golang-nuts < > golan...@googlegroups.com> wrote: > >

Re: [go-nuts] How to fix an awful marshal reflection hack

2022-12-01 Thread 'Mark' via golang-nuts
I tried that and it works in the playground, and I added more types and it still works in the playground <https://go.dev/play/p/Yxzj4tAAGhM>. But in my program it still doesn't work:-( The actual code is here tdb-go <https://github.com/mark-summerfield/tdb-go> in the file marshal.

Re: [go-nuts] How to fix an awful marshal reflection hack

2022-12-01 Thread 'Mark' via golang-nuts
the complete -- and working -- code is in the repo and go test works. But replacing the call to hack() with kind = field.Type().Elem().Kind() breaks the tests. On Thursday, December 1, 2022 at 1:09:50 PM UTC Marvin Renich wrote: > * 'Mark' via golang-nuts [221201 05:17]: > >

[go-nuts] How to fix an awful marshal reflection hack

2022-11-30 Thread 'Mark' via golang-nuts
I have this code which works but has a horrible hack: ... nullable := false kind := field.Kind() // field's type is reflect.Value if kind == reflect.Ptr { // FIXME How can I improve upon this truly awful hack? switch field.Type().String() { case "*int", "*int8", "*uint8", "*int16",

Re: [go-nuts] Is it possible to switch on type T in a generic function?

2022-11-08 Thread 'Mark' via golang-nuts
ings(elements) / s := "{" sep := "" for _, element := range elements { s += fmt.Sprintf("%s%s", sep, element) sep = " " } return s + "}" } On Tuesday, November 8, 2022 at 9:19:48 AM UTC Jan Mercl

[go-nuts] Is it possible to switch on type T in a generic function?

2022-11-08 Thread 'Mark' via golang-nuts
I've created: https://github.com/mark-summerfield/gset In the String() method I want to return a string with the elements sorted (for human readability and for testing convenience); but at the moment I can only do this by converting all elements to strings and sorting them which isn't good

Re: [go-nuts] Is it possible to switch on type T in a generic function?

2022-11-09 Thread 'Mark' via golang-nuts
Builder for > building a string > > On Tuesday, 8 November 2022 at 13:09:51 UTC Mark wrote: > >> Thanks for your help and very interesting ideas. In the end I used this: >> >> type Set[T comparable] map[T]struct{} >> >> func New[T comparable](elements ...T

Re: [go-nuts] Is it possible to switch on type T in a generic function?

2022-11-08 Thread 'Mark' via golang-nuts
ev/play/p/oKTGSm_o22a > > To answer the specific question you asked, there is an issue that tracks > the ability to do a switch directly on a type parameter: > https://github.com/golang/go/issues/45380 > > But you can also work around the lack of that feature by doing something &

[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] Doc suggestion (& one const suggestion)

2023-05-02 Thread 'Mark' via golang-nuts
In the docs file modes are often shown in octal, e.g., `0600`. Doc suggestion: update octal to use the modern unambiguous format, e.g., `0o600`. Const suggestion: add at least one const to `os`, e.g., ```go const ModeUserRW = 0o600 // plus any one or two others that are really common? ``` If

[go-nuts] Can a struct be made comparable?

2023-07-13 Thread 'Mark' via golang-nuts
I have a package which has a function `Do[T comparable](a, b []T) Result`. I have a struct: ```go type N struct { x int y int t string } ``` Is it possible to make `N` comparable; in particular by a field of my choice, e.g., `t`? Or will I have to make, say, `DoFunc(a, b []N, eq func(i, j

[go-nuts] Re: Can a struct be made comparable?

2023-07-14 Thread 'Mark' via golang-nuts
UTC+1 Mark wrote: > What I really want to do is to be able to diff slices of structs on the > basis of one single field. > For example, given: > ``` > type Item struct { > I int > S string > } > ``` > and given `a` and `b` are both of type`[]Item`, I want to dif

[go-nuts] Re: Can a struct be made comparable?

2023-07-14 Thread 'Mark' via golang-nuts
://pkg.go.dev/slices#EqualFunc >> >> For the case of "ordered" rather than "comparable", have a look at >> slices.BinarySearchFunc and related functions. >> >> On Thursday, 13 July 2023 at 09:29:38 UTC+1 Mark wrote: >> >>> I have a

[go-nuts] Re: Can a struct be made comparable?

2023-07-14 Thread 'Mark' via golang-nuts
t; slice, then Atoi(change.Path[0]) is the index into the slice. > > On Friday, 14 July 2023 at 10:47:47 UTC+1 Mark wrote: > >> Hi Brian, >> Your code certainly identifies the different items. >> However, that's not a diff tool in the sense I mean. >> Unix diff and

[go-nuts] Re: Can a struct be made comparable?

2023-07-14 Thread 'Mark' via golang-nuts
into slice y. There are quite a few go diff tools that will do this, including my own <https://pkg.go.dev/github.com/mark-summerfield/go-diff> based on Python's difflib sequence matcher. What I want to do is find one that does this for slices of structs where only one struct field is cons

[go-nuts] Re: Can a struct be made comparable?

2023-07-14 Thread 'Mark' via golang-nuts
I finally worked out how to make my go-diff pkg <https://pkg.go.dev/github.com/mark-summerfield/go-diff> (v1.1.0) able to diff sequences of structs based on a key function. On Friday, July 14, 2023 at 12:27:46 PM UTC+1 Mark wrote: > Hi Brian, > Ah, thank you, that helped a lot. &

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

2023-08-03 Thread 'Mark' via golang-nuts
I know this has been asked before, just wondered if there were any pure-Go solutions? -- 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

[go-nuts] Re: Error handling

2023-07-31 Thread 'Mark' via golang-nuts
Given that this proposal is to reduce boilerplate, and assuming the semantic issues could be solved, it seems to me that the 'return' is redundant (i.e., could be implicit) and that 'orelse' could be done with the existing 'else' keyword, i.e., ``` result, err := someCall() else rest, err ```

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

2023-08-04 Thread 'Mark' via golang-nuts
Thanks! On Friday, August 4, 2023 at 8:46:18 AM UTC+1 Tamás Gulácsi wrote: > https://pkg.go.dev/github.com/goki/gi/svg > > Mark a következőt írta (2023. augusztus 3., csütörtök, 13:18:48 UTC+2): > >> I know this has been asked before, just wondered if there were any &g

[go-nuts] range func experiment typo?

2024-01-19 Thread 'Mark' via golang-nuts
In the RangefuncExperiment doc it says: for k, v := range g { ... } // g has type Seq[K,V], k and v have types K and V but shouldn't this be: for k, v := range g { ... } // g has type Seq2[K,V], k and v have types K and V Anyway, it looks

Re: [go-nuts] a simple linux audio player pkg?

2023-11-23 Thread 'Mark' via golang-nuts
onvert to PCM) and github.com/ebitengine/oto/v3 to play the PCM. > I don't know of a full ogg player in Go > > > On Wed, Nov 22, 2023 at 2:02 PM 'Mark' via golang-nuts < > golan...@googlegroups.com> wrote: > >> Is there a simple vorbis/oga audio player package for Go

Re: [go-nuts] a simple linux audio player pkg?

2023-11-23 Thread 'Mark' via golang-nuts
om/jfreymuth/oggvorbis to read the ogg file (and > convert to PCM) and github.com/ebitengine/oto/v3 to play the PCM. > I don't know of a full ogg player in Go > > > On Wed, Nov 22, 2023 at 2:02 PM 'Mark' via golang-nuts < > golan...@googlegroups.com> wrote: > >> Is th

Re: [go-nuts] a simple linux audio player pkg?

2023-11-23 Thread 'Mark' via golang-nuts
); err != nil { panic(err) } } return buf.Bytes() } On Thursday, November 23, 2023 at 10:03:24 AM UTC Mark wrote: > I've now tried using those libraries, but there seems to be an > incompatibility []float32 vs []byte. > Here's the error: > > ./play.go:24:29: cannot use reader (v

[go-nuts] a simple linux audio player pkg?

2023-11-22 Thread 'Mark' via golang-nuts
Is there a simple vorbis/oga audio player package for Go that works on Linux. The only API I need is something like this: player.SetFilename(string) error // string is say tune.ogg; stops playing previous if any player.Play(float32) error // plays current filename from given second e.g. 0.0

[go-nuts] Is there a Go equivalent to Python's ctypes library?

2023-11-21 Thread 'Mark' via golang-nuts
I would like to be able to access a dynamic C library (and ideally C++), i.e., `.so` or `.dll` _without_ using cgo, i.e., without needing a compiler on the target platform. Python provides a `ctypes` module with this facility. Is there an equivalent for Go? -- You received this message

[go-nuts] Re: Is there a Go equivalent to Python's ctypes library?

2023-11-21 Thread 'Mark' via golang-nuts
Thank you, that looks just like what I want. On Tuesday, November 21, 2023 at 10:21:14 AM UTC Mark wrote: > I would like to be able to access a dynamic C library (and ideally C++), > i.e., `.so` or `.dll` _without_ using cgo, i.e., without needing a compiler > on the target platform.

[go-nuts] Re: Is there a Go equivalent to Python's ctypes library?

2023-11-21 Thread 'Mark' via golang-nuts
Gulácsi wrote: > Which is what? > Please share with the golang-nuts list if you've found a solution! > > Mark a következőt írta (2023. november 21., kedd, 11:54:11 UTC+1): > >> Thank you, that looks just like what I want. >> >> On Tuesday, November 21, 2023 at 10:21:14 

[go-nuts] Can't figure out how to create an All() iter.Seq[T] method

2024-03-13 Thread 'Mark' via golang-nuts
I've been trying to learn how to create an `All() iter.Seq[T]` method for a simple set type (a map wrapper): playground It won't work in the playground of course, but when I do: `GOEXPERIMENT=rangefunc go run .` using Go 1.22 I get this error: ```

Re: [go-nuts] Can't figure out how to create an All() iter.Seq[T] method

2024-03-13 Thread 'Mark' via golang-nuts
Thank you, that solved the problem. On Wednesday, March 13, 2024 at 1:22:06 PM UTC Sebastien Binet wrote: > hi Mark, > > On Wed Mar 13, 2024 at 13:32 CET, 'Mark' via golang-nuts wrote: > > I've been trying to learn how to create an `All() iter.Seq[T]` method > > for a >

<    1   2