-
Notifications
You must be signed in to change notification settings - Fork 919
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
feat: Add stubs for more of the reflect package #2624
Conversation
Simplest might be to add testdata/template.{go,txt} and then add "template.go" into main_test.go's list of tests. template.txt should contain the expected output. |
Looks like my initial testing was incorrect.
I didn't realize that |
You could add a smoke test instead a la #2565 Then once you get that other fix pushed upstream, maybe add testcases/protobuf.{go,txt}. |
Yeah, I ran into exactly that |
That windows failure looks spurious. |
Smoke test added, let me know if you'd like it in a different place / format. |
You also need to invoke it from Makefile's smoketest rule, otherwise it doesn't get run. Most of the tests in that rule specify a target, but this one probably shouldn't. Note that the tinygo maintainers may have different feedback; I have added a smoke test, but am a relative newcomer. |
I added the line but forgot to commit it. Will fix |
Maybe I need to specify a target in the Makefile?
|
Heh. Nope! Note which build failed.... it's the go 1.15 build. Perhaps you took your example from go 1.16 or newer, and it needs 1.16-only features, who knows. It's probably fine to exclude 1.15 on this file. I think the syntax is:
The other problem is that you have not turned it into a test, so it's still not compiling the examples.
and of course import testing, and fix the one variable name clash and any lint problems that pop up. They won't be the greatest tests of all, but they will do just fine as a "does it compile at all" smoke test. |
|
Oh, apologies, it's not the version of go you got the code from, it's the version the user is running (and thus which go code they're getting.) |
Oh, ffs:
So add a pacifier test file, I guess. |
Okay I give up lol. Is there a better place / way for me to add these tests? |
heh. Hang on, let me give it a shot. |
@dkegel-fastly any luck? |
Been swamped, will try in the morning. |
luck. See last commit in https://github.com/dkegel-fastly/tinygo/commits/compile-text-template empty.go and the build constraint can be deleted once we drop support for go 1.15, I think. |
@dankegel tests are now passing. Is this ready to merge? |
No, now it's ready for code review :-) Congrats on getting this far, though! This is the point I often get stuck at, especially when a maintainer is on vacation... |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks! Can you rebase and squash some of these commits?
cc @deadprogram I suppose we can always squash on merge too.
With these methods stubbed out, the text/template package can be imported. These changes also allow code generated by protoc to compile.
d757f02
to
b912a7e
Compare
@dgryski Done! |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM
Now that this is merged, are you going to open an issue on vtprotobuf as mentioned earlier ( #2574 (comment) ) ? |
With this change, tinygo can now compile and pass the example_test.go for the
text/template
package.@dgryski @dkegel-fastly How do I add the
example_test.go
to tinygo?Replaces #2574