Skip to content
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

x/tools/go/packages: log.Fatalf inside library routine #45584

Closed
rsc opened this issue Apr 15, 2021 · 5 comments
Closed

x/tools/go/packages: log.Fatalf inside library routine #45584

rsc opened this issue Apr 15, 2021 · 5 comments
Labels
FrozenDueToAge NeedsFix The path to resolution is known, but the work has not been done. Tools This label describes issues relating to any tools in the x/tools repository.
Milestone

Comments

@rsc
Copy link
Contributor

rsc commented Apr 15, 2021

This program triggers a log.Fatalf inside golang.org/x/tools/go/packages.

% ls
go.mod	go.sum	x.go
% cat go.mod
module m

go 1.16

require golang.org/x/tools v0.1.0 // indirect
% cat x.go
package main

import "golang.org/x/tools/go/packages"

func main() {
	cfg := &packages.Config{
		Mode: packages.NeedName | packages.NeedTypes | packages.NeedExportsFile,
	}
	packages.Load(cfg, "fmt")
}
% go run .
2021/04/15 10:31:34 Unexpected package creation during export data loading
exit status 1
%
@rsc rsc added this to the Unreleased milestone Apr 15, 2021
@rsc rsc changed the title golang.org/x/tools/go/packages: golang.org/x/tools/go/packages: log.Fatalf inside library routine Apr 15, 2021
@rsc
Copy link
Contributor Author

rsc commented Apr 15, 2021

I added some debug prints and am pretty confused.

2021/04/15 11:58:51 Unexpected package creation during export data loading fmt 1 7:
old map[]
new map[fmt:package fmt ("fmt") internal/poll:package poll ("internal/poll") io:package io ("io") io/fs:package fs ("io/fs") os:package os ("os") syscall:package syscall ("syscall") time:package time ("time")]

This all looks fine. Reading the fmt export data will build stub packages for a bunch of its dependencies.

@rsc
Copy link
Contributor Author

rsc commented Apr 15, 2021

I found it. impliedLoadMode should set NeedImports for NeedExportFile. Will send CL.

@gopherbot
Copy link
Contributor

Change https://golang.org/cl/310512 mentions this issue: go/packages: fix load with NeedTypes but not NeedImports

@seankhliao seankhliao added the NeedsFix The path to resolution is known, but the work has not been done. label Apr 15, 2021
@seankhliao seankhliao changed the title golang.org/x/tools/go/packages: log.Fatalf inside library routine x/tools/go/packages: log.Fatalf inside library routine Apr 15, 2021
@gopherbot gopherbot added the Tools This label describes issues relating to any tools in the x/tools repository. label Apr 15, 2021
@AlekSi
Copy link
Contributor

AlekSi commented Jan 15, 2022

@rsc @matloob @aclements ping. Should it still be merged?

AlekSi pushed a commit to AlekSi/tools that referenced this issue Jan 15, 2022
Fixes golang/go#45584.

Change-Id: I65238cc3bdc640bb044c615a5699e8d3cfa39db0
AlekSi pushed a commit to AlekSi/tools that referenced this issue Jan 29, 2022
Fixes golang/go#45584.

Change-Id: I65238cc3bdc640bb044c615a5699e8d3cfa39db0
@bradfitz
Copy link
Contributor

@rsc, what's the status here? Were you going to merge your changes?

benjaminjkraft added a commit to Khan/genqlient that referenced this issue Mar 22, 2022
Go 1.18 is out! So we should run tests on it.  gqlgen had some issues
with it (see 99designs/gqlgen#1961 and golang/go#45584) so I updated
that too, which updated some other things.

Test plan: make check
benjaminjkraft added a commit to Khan/genqlient that referenced this issue Mar 22, 2022
Go 1.18 is out! So we should run tests on it.

Additionally, gqlgen had some issues with it (see 99designs/gqlgen#1961
and golang/go#45584) so I updated that too, which updated some other
things.

Finally, latest gqlgen requires 1.16+, and it's time for us to do the
same anyway, so we can use `embed` and other newer goodies.  So I
dropped running tests for 1.14 and 1.15, and bumped the module language
version.

Test plan: make check
benjaminjkraft added a commit to Khan/genqlient that referenced this issue Mar 22, 2022
Go 1.18 is out! So we should run tests on it.

Additionally, gqlgen had some issues with it (see 99designs/gqlgen#1961
and golang/go#45584) so I updated that too, which updated some other
things.

Finally, latest gqlgen requires 1.16+, and it's time for us to do the
same anyway, so we can use `embed` and other newer goodies.  So I
dropped running tests for 1.14 and 1.15, and bumped the module language
version.

Test plan: make check
@rsc rsc unassigned matloob Jun 23, 2022
aarzilli added a commit to aarzilli/delve that referenced this issue Jul 2, 2022
The current version we use now crashes with go1.19:

golang/go#45584
derekparker pushed a commit to go-delve/delve that referenced this issue Jul 5, 2022
The current version we use now crashes with go1.19:

golang/go#45584
storjBuildBot pushed a commit to storj/ci that referenced this issue Aug 29, 2022
Versions below and v0.1.10 are sometimes causing problems for, e.g.,
check-monkit. Example failure:

check-monkit ./...
monkitunused: Unexpected package creation during export data loading

Related to golang/go#45584 (includes an explanation for the issue).

Change-Id: Icbd08570e8b0da869cf8c87ad024d150fac663af
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
FrozenDueToAge NeedsFix The path to resolution is known, but the work has not been done. Tools This label describes issues relating to any tools in the x/tools repository.
Projects
None yet
Development

No branches or pull requests

6 participants