go-consistent icon indicating copy to clipboard operation
go-consistent copied to clipboard

"Unexpected package creation during export data loading" on code with generics

Open AlekSi opened this issue 2 years ago • 8 comments

See https://github.com/FerretDB/FerretDB/pull/248 and https://github.com/FerretDB/FerretDB/runs/4758709579

AlekSi avatar Jan 10 '22 08:01 AlekSi

Perhaps go-consistent needs to update its golang.org/x/tools dependency.

quasilyte avatar Jan 10 '22 08:01 quasilyte

It is not something as simple as just that. FerretDB uses a separate tools module for all tools, including go-consistent, with golang.org/x/tools v0.1.8.

AlekSi avatar Jan 10 '22 08:01 AlekSi

Oh, ok. I'll see what could go wrong there this weekend, hopefully. I have a hunch that has something to do with the way go-consistent loads packages.

quasilyte avatar Jan 10 '22 08:01 quasilyte

Your hunch is correct :) https://github.com/AlekSi/go-consistent/pull/1/files

AlekSi avatar Jan 10 '22 09:01 AlekSi

That might be related:

  • https://github.com/golang/go/issues/45584
  • https://go-review.googlesource.com/c/tools/+/310512/

AlekSi avatar Jan 15 '22 07:01 AlekSi

It might be fixed by https://github.com/golang/tools/commit/afc6aad76eb1194c038c653531eef344468d2ac4

AlekSi avatar Apr 14 '22 20:04 AlekSi

Now, it sometimes fails on code with generics. For example:

/home/runner/work/FerretDB/FerretDB/internal/util/telemetry/reporter.go:204:13: iter.Close undefined (type iterator.Interface[string, any] has no field or method Close)

AlekSi avatar Oct 06 '23 05:10 AlekSi