You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
All packages auto-imported including "reflect" and a successful run
What did you see instead?
Notice that it didn't import "reflect" as that package in used only in the function signature, but successfully imported the rest of the packages, thus it failed to compile and I had to manually go import "reflect".
The text was updated successfully, but these errors were encountered:
josharian
changed the title
x/tools/playground: packages used only in function signatures are not auto-imported
x/tools/imports: packages used only in function signatures are not auto-imported
May 20, 2017
I just ran goimports -l -w on that code and it works fine, on x/tools bf4b54dc687c73b6ef63de8b8abf0ad3951e3edc and go version devel +495f55d27d Fri May 19 18:11:51 2017 +0000 linux/amd64.
I tried with a goimports built with Go 1.8.1, but still no luck. Maybe it's the playground having an old goimports?
Note that if you make the argument a reflect.Value it suddenly starts working. Both types have been in Go since 1.0, so I'm not sure why that would be.
@broady any information on how goimports/imports is being run in the Playground, or what version of it is being used?
Please answer these questions before submitting your issue. Thanks!
What version of Go are you using (
go version
)?Go1.8 running on the playground at https://play.golang.org/
What operating system and processor architecture are you using (
go env
)?Irrelevant
What did you do?
What did you expect to see?
All packages auto-imported including "reflect" and a successful run
What did you see instead?
Notice that it didn't import "reflect" as that package in used only in the function signature, but successfully imported the rest of the packages, thus it failed to compile and I had to manually go import "reflect".
The text was updated successfully, but these errors were encountered: