Re: [go-nuts] detecting cyclic references

2020-11-14 Thread twp...@gmail.com
> My use case is that I want to pretty print in-memory objects for debug purposes during testing, and one of the features would be to point out such cycles as this. Consider using an existing library for this, for example: https://github.com/sanity-io/litter

[go-nuts] [ANN] [Geospatial] New set of Go bindings for GEOS

2021-06-20 Thread twp...@gmail.com
GEOS is the standard geometry library that underpins PostGIS and much of the open source geospatial world. https://github.com/twpayne/go-geos is a new set of Go bindings for GEOS that make it easy to use GEOS geometries in your Go applications. Features include: - Fluent Go API. -

Re: [go-nuts] Getting cross-package test coverage data?

2021-09-29 Thread twp...@gmail.com
Very, very, late response to this, but I was missing the `-coverpkg=./...` argument to `go test`. /facepalm On Thursday, May 14, 2020 at 10:46:43 AM UTC+2 ppi...@gmail.com wrote: > Not sure if a tool is required. > It can be done with a couple of commands. > An elaborate example (of coverage

Re: [go-nuts] Improving on unit test styles

2022-03-03 Thread twp...@gmail.com
To identify failing test cases in a table of tests where you don't have individual names you can use its index: for i, testCase := range testCases { t.Run(strconv.Itoa(i), func(t *testing.T) { // ... For debugging an individual test case, just skip over all but the

[go-nuts] Re: BPF target

2022-02-26 Thread twp...@gmail.com
https://tinygo.org/ might be a more suitable initial project for compiling Go to eBPF. A lot is already in place including an LLVM backend and a simplified Go runtime suitable for small systems. On Thursday, February 24, 2022 at 6:41:00 PM UTC+1 stalke...@protonmail.ch wrote: > With the

Re: [go-nuts] Performance of syscall calls vs. CGO

2022-01-23 Thread twp...@gmail.com
Two tips from writing github.com/twpayne/go-geos (Go bindings for the popular GEOS geometry library), where I also encountered performance problems with cgo when calling small C functions: 1. Make each cgo call do more by moving common combinations of functions in to C, i.e. use a higher-level

Re: [go-nuts] go tool dist: FAILED: not a Git repo; must put a VERSION file in $GOROOT

2023-11-08 Thread twp...@gmail.com
For info, this is broken in Fedora 39, released a day or two ago: $ docker pull fedora:latest $ docker run -it fedora:latest /bin/bash [root@01330dfaac82 /]# dnf update && dnf install -y golang ... [root@01330dfaac82 /]# go version go version go1.21.3 linux/amd64 [root@01330dfaac82 /]# go tool

Re: [go-nuts] go tool dist: FAILED: not a Git repo; must put a VERSION file in $GOROOT

2023-11-08 Thread twp...@gmail.com
Reported to Fedora at https://bugzilla.redhat.com/show_bug.cgi?id=2248782 On Thursday, November 9, 2023 at 1:00:55 AM UTC+1 twp...@gmail.com wrote: > For info, this is broken in Fedora 39, released a day or two ago: > > $ docker pull fedora:latest > $ docker run -it fedora:late

[go-nuts] [ANN] go-xmlstruct: generate Go structs from multiple XML documents

2022-11-17 Thread twp...@gmail.com
There are a few existing XML document-to-Go struct generators, but none of them had all of the following features: * Taking multiple XML documents as input. * Generating correct field types. * Customizable field names. * Handling optional and repeated elements. * Ignoring whitespace. If you

[go-nuts] Does Go optimize math.Float64frombits(binary.LittleEndian.Uint64[...])) to a single instruction?

2022-11-24 Thread twp...@gmail.com
tl;dr: on 64-bit little-endian machines, does x := math.Float64frombits(binary.LittleEndian.Uint64(byteSlice[:8])) get optimized to a single move instruction from byteSlice[:8] to x? Background info: I'm currently writing a bunch of code that unmarshals binary data. A small example is

Re: [go-nuts] xml to json, parsing xml

2024-04-24 Thread twp...@gmail.com
You can parse XML and JSON quickly with these tools: https://github.com/twpayne/go-xmlstruct https://github.com/twpayne/go-jsonstruct They generate Go code that parses all the example XML and JSON files that you throw at them. Regards, Tom On Tuesday, April 23, 2024 at 9:17:33 PM UTC+2 Don

[go-nuts] rsc.io/script: How to contribute?

2024-03-06 Thread twp...@gmail.com
Internally, Go has a very nice package for integration testing . Roger Peppe has been doing a fantastic service by making it public and maintaining it as a community project at

[go-nuts] Re: rsc.io/script: How to contribute?

2024-03-06 Thread twp...@gmail.com
*rsc.io/script On Wednesday, March 6, 2024 at 10:46:23 PM UTC+1 twp...@gmail.com wrote: > Internally, Go has a very nice package for integration testing > <https://github.com/golang/go/tree/master/src/cmd/go/internal/script>. > > Roger Peppe <https://github.com/rog

Re: [go-nuts] rsc.io/script: How to contribute?

2024-03-08 Thread twp...@gmail.com
Many thanks for the response Russ. It's clear I should stick with testscript for now. Regards, Tom On Friday, March 8, 2024 at 3:04:10 AM UTC+1 Russ Cox wrote: > Hi all, > > I published rsc.io/script for people to play with, to support my testing > talk .

[go-nuts] Re: rsc.io/script: How to contribute?

2024-03-07 Thread twp...@gmail.com
n commander-cli. > > On Wednesday, March 6, 2024 at 1:52:57 PM UTC-8 twp...@gmail.com wrote: > >> *rsc.io/script >> >> On Wednesday, March 6, 2024 at 10:46:23 PM UTC+1 twp...@gmail.com wrote: >> >>> Internally, Go has a very nice package for integration testing >>

Re: [go-nuts] Re: rsc.io/script: How to contribute?

2024-03-07 Thread twp...@gmail.com
/script, then I'm keen to contribute to rsc.io/script to make it useable by other projects. But first, I need to know how to contribute to rsc.io/script... On Thursday, March 7, 2024 at 3:18:51 PM UTC+1 Eli Bendersky wrote: > On Thu, Mar 7, 2024 at 5:44 AM twp...@gmail.com wrote: > >&g

[go-nuts] pkg.go.dev: redirect URL for latest major version or big red warning for old version

2024-04-08 Thread twp...@gmail.com
Is there a way to get an unchanging URL that always redirects to the latest major version of a package on pkg.go.dev? Right now, if I go to https://pkg.go.dev/$PACKAGE_NAME I get the documentation for either v0 or v1 of a package, which is out of date if there's a more recent major version.

[go-nuts] Re: Alternative text/template function libraries to github.com/Masterminds/sprig?

2024-05-20 Thread twp...@gmail.com
Just following up on this old message, there now seems to be at least: https://github.com/go-sprout/sprout https://github.com/chezmoi/templatefuncs Regards, Tom On Monday, January 9, 2023 at 8:53:41 PM UTC+1 Tom Payne wrote: > github.com/Masterminds/sprig is a popular library of template