Re: [go-nuts] Example tests: access to module testdata files

2025-01-21 Thread Rory Campbell-Lange
That's a really helpful comment. I'll give the embed/fs.FS approach a go -- thank you. On 20/01/25, Sean Liao (s...@liao.dev) wrote: > The playground, which also serves pkg.go.dev examples. runs in an > isolated environment with just the built test/example binary, without > the source code. > Con

Re: [go-nuts] Example tests: access to module testdata files

2025-01-20 Thread 'Sean Liao' via golang-nuts
The playground, which also serves pkg.go.dev examples. runs in an isolated environment with just the built test/example binary, without the source code. Consider embedding any files you need with "embed" and accessing them through io/fs.FS rather than through os calls. - sean On Fri, Jan 10, 2025

[go-nuts] Example tests: access to module testdata files

2025-01-10 Thread Rory Campbell-Lange
Hi. I have written a small package with an example which runs fine locally, but doesn't work through the web interface of either my local godoc or pkg.go.dev. https://pkg.go.dev/github.com/rorycl/mailboxoperator@v0.0.4#example-package The test attempts to access files in the testdata directories