Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

-record flag example #18

Open
shaneHowearth opened this issue Jan 12, 2022 · 3 comments
Open

-record flag example #18

shaneHowearth opened this issue Jan 12, 2022 · 3 comments

Comments

@shaneHowearth
Copy link

Hi I was trying to record the output for a test and I got the following

$ go test -run TestDictWordList -record
Foo {} no recording exists with this name: TestDictWordList/Foo

PASS

I also tried with a double dash between

$ go test -run TestDictWordList -- -record
Foo {} no recording exists with this name: TestDictWordList/Foo

PASS

The only way I could get it to work was

COPYIST_RECORD=1 go test -run TestDictWordList

FTR

$ go version
go version go1.17.5 darwin/arm64

go.mod has

github.com/cockroachdb/copyist v1.4.1
@andy-kimball
Copy link
Contributor

I'm not sure what might be happening here. We use -record all the time without seeing this issue. I'd need a repro to dig further, if you're able to post one (e.g. a Go test file that I can run on my machine).

@shaneHowearth
Copy link
Author

I suspect the problem is that the test code expects the init or TestMain functions to handle the -record

I didn't have an init or TestMain in my code, so perhaps experiment with that as a requirement?

@dan-j
Copy link
Contributor

dan-j commented Jul 1, 2022

I've just ran into this issue after using copyist for a long time with no issue.

If I add a flag.Parse() statement before I call copyist.IsRecording() then everything works.

Not yet sure why it's happening to me now all of a sudden 🤔

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants