// might not expect those errors to stop showing up.
// See issue #52443.
SuppressDeps: !listJsonFields.needAny("Deps", "DepsErrors"),
- SuppressBuildInfo: !listJsonFields.needAny("Stale", "StaleReason"),
- SuppressEmbedFiles: !listJsonFields.needAny("EmbedFiles", "TestEmbedFiles", "XTestEmbedFiles"),
+ SuppressBuildInfo: !*listExport && !listJsonFields.needAny("Stale", "StaleReason"),
+ SuppressEmbedFiles: !*listExport && !listJsonFields.needAny("EmbedFiles", "TestEmbedFiles", "XTestEmbedFiles"),
}
pkgs := load.PackagesAndErrors(ctx, pkgOpts, args)
if !*listE {
--- /dev/null
+# Regression test for https://go.dev/issue/58885:
+# 'go list -json=Export' should not fail due to missing go:embed metadata.
+
+[short] skip 'runs the compiler to produce export data'
+
+go list -json=Export -export .
+
+-- go.mod --
+module example
+go 1.20
+-- example.go --
+package example
+
+import _ "embed"
+
+//go:embed example.go
+var src string