hedwigz / entviz

entviz is an ent extension that provides visualization of the schema graph
96 stars 10 forks source link

"internal error" on go1.18 due to out of date transitive x/tools dependency #13

Closed willbicks closed 2 years ago

willbicks commented 2 years ago

When trying today to use /cmd/entviz for the first time, I ran into the following error:

$ entviz ./ent/schema
2022/06/11 16:01:21 internal error: package "context" without types was imported from "entgo.io/ent"

Digging further, it appears that this is an issue caused by an outdated version of golang.org/x/tools which lacks support for go1.18. This dependency is present in entgo.io/ent versions < v0.10.0, but later versions upgrade this dependency and fix the issue. (See discussion here: https://github.com/ent/ent/issues/2155).

Running the following two commands in a local clone of this repository before re-installing the package fixed the issue.

go get entgo.io/ent@latest
go mod tidy

I'm not sure if upgrading ent has the potential to break backwards compatibility, but if not I can open a PR to merge these changes.

hedwigz commented 2 years ago

Hey @willbicks thanks for this detailed report!
It shouldn't be a problem to upgrade ent so feel free to open a PR :)