Re: [go-nuts] Is there a way to specify or use the tmp directory used in testing?

2022-02-25 Thread Leam Hall
My apologies for taking so long to respond; a new job and cold weather have taken up most of my time. I have two versions of the application; one CLI and one web. The programs create characters for games and fiction, and use data text files relative to the binary ( /data/* ) to get names. The

Re: [go-nuts] Is there a way to specify or use the tmp directory used in testing?

2022-02-23 Thread David Finkel
On Wed, Feb 23, 2022 at 1:47 PM Gergely Brautigam wrote: > Hi! > > The best way to do it is, to have these files in a folder next to the test > called `testdata` and then when the test starts, simply copy them into a > temp location. And then make your program work with an environment property >

Re: [go-nuts] Is there a way to specify or use the tmp directory used in testing?

2022-02-23 Thread David Finkel
On Wed, Feb 23, 2022 at 8:53 AM Leam Hall wrote: > My program uses data and template files located relative to the binary. > Since go test creates the binary under test in /tmp/go-build., there > are no data or template files. How do I either specify what directory to > build in so I can

Re: [go-nuts] Is there a way to specify or use the tmp directory used in testing?

2022-02-23 Thread Amnon
Use t.TestDir() https://pkg.go.dev/testing#T.TempDir On Wednesday, 23 February 2022 at 14:37:54 UTC mlevi...@gmail.com wrote: > Use absolute paths? Feels like you're trying to bend something very hard > here > > On Wed, Feb 23, 2022 at 2:54 PM Leam Hall wrote: > >> My program uses data and

Re: [go-nuts] Is there a way to specify or use the tmp directory used in testing?

2022-02-23 Thread Levieux Michel
Use absolute paths? Feels like you're trying to bend something very hard here On Wed, Feb 23, 2022 at 2:54 PM Leam Hall wrote: > My program uses data and template files located relative to the binary. > Since go test creates the binary under test in /tmp/go-build., there > are no data or

[go-nuts] Is there a way to specify or use the tmp directory used in testing?

2022-02-23 Thread Leam Hall
My program uses data and template files located relative to the binary. Since go test creates the binary under test in /tmp/go-build., there are no data or template files. How do I either specify what directory to build in so I can create the files, or get the tmp directory name before the