-
Notifications
You must be signed in to change notification settings - Fork 918
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
Allows compilation of code using debug.BuildInfo and show correct tinygo version #4343
Conversation
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
src/runtime/debug/debug.go
Outdated
// | ||
// Not implemented. | ||
func (bi *BuildInfo) String() string { | ||
return "<build info placeholder>\n" |
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.
Can you implement this?
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.
given everything else is empty in the struct, what would that do?
could we just import the real code from big go?
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.
"else"? It's not printing anything at all. It could at least return "go. " + GoVersion, couldn't it?
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.
ic the first line sure, I didn't notice because when I use buildinfo I print the GoVersion separately let me add something
btw should it be
go tinygo0.33.1
or
tinygo tinygo0.33.1
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.
doing the former, copying the code
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.
@dkegel-fastly so I copied the real code but... it's ugly... what is the general philosophy/must not be the first time tinygo is just a small variant of an existing go file, can you import+patch or some other way to avoid copy pasta (this is more for my education than anything specific for this PR - hopefully it's ok now with 41dd04a )
output comparison (through fortio.org/version) - edited for latest commit:
|
src/runtime/debug/debug.go
Outdated
@@ -1,6 +1,13 @@ | |||
// Package debug is a dummy package that is not yet implemented. |
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.
Should this comment be removed?
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.
it's still kinda dummy - I was wondering about the comment
// Not implemented.
func ReadBuildInfo()
and figured to leave it as it's... only giving an empty one (no modules, no settings etc) except for GoVersion
I see the approvals, thanks, would one of you merge, I can't (wouldn't anyway) |
@@ -58,3 +66,60 @@ type Module struct { | |||
func SetGCPercent(n int) int { | |||
return n | |||
} | |||
|
|||
// Start of stolen from big go. TODO: import/reuse without copy pasta. |
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.
I do believe a copyright notice should be copied here...?
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.
isn’t this covered by https://github.com/tinygo-org/tinygo/blob/release/LICENSE#L3 ?
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.
I think the copyright folks like to have a greppable marker in each file.
I like the way runtime/timer.go does it: copy the three top llines from the file you're copying, and change "Copyright" to "Portions copyright".
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, I was looking for an example, thanks for mentioning src/runtime/timer.go
Done
|
The previous build https://github.com/tinygo-org/tinygo/actions/runs/9977696304 of size difference, before llvm18 got broken, passed, so can we merge this ? (only difference is the comment at the top of the file, since that build) |
ping |
@ldemailly please rebase against the latest |
Actually, I can just squash/merge this now, I think. Thank you very much @ldemailly for working on this and to @ydnar and @dkegel-fastly for guidance and reviews. |
That let's me build a 245k tinygo target grol-io/grol#37
(also needed some change in fortio.org/log)
Many thanks to @ydnar and @dankegel for their help and guidance.