-
Notifications
You must be signed in to change notification settings - Fork 18.7k
Open
Labels
NeedsFixThe path to resolution is known, but the work has not been done.The path to resolution is known, but the work has not been done.ToolsThis label describes issues relating to any tools in the x/tools repository.This label describes issues relating to any tools in the x/tools repository.
Milestone
Description
The program below prints:
runtime (LoadMode(NeedName|NeedSyntax)):
len(Syntax) = 0
Errors: []
runtime (LoadMode(NeedName|NeedFiles|NeedSyntax)):
len(Syntax) = 136
Errors: []
runtime (LoadMode(NeedName|NeedCompiledGoFiles|NeedSyntax)):
len(Syntax) = 145
Errors: [/home/mdempsky/wd/go/src/runtime/asm.s:5:1: illegal character U+0023 '#' /home/mdempsky/wd/go/src/runtime/asm_amd64.s:5:1: illegal character U+0023 '#' /home/mdempsky/wd/go/src/runtime/duff_amd64.s:5:1: illegal character U+0023 '#' /home/mdempsky/wd/go/src/runtime/memclr_amd64.s:7:1: illegal character U+0023 '#' /home/mdempsky/wd/go/src/runtime/memmove_amd64.s:28:1: illegal character U+0023 '#' /home/mdempsky/wd/go/src/runtime/preempt_amd64.s:3:1: illegal character U+0023 '#' /home/mdempsky/wd/go/src/runtime/rt0_linux_amd64.s:5:1: illegal character U+0023 '#' /home/mdempsky/wd/go/src/runtime/sys_linux_amd64.s:9:1: illegal character U+0023 '#' /home/mdempsky/wd/go/src/runtime/time_linux_amd64.s:7:1: illegal character U+0023 '#']
I think only the middle case is working as documented.
The last case appears to be due to #56632.
package main
import (
"fmt"
"log"
"golang.org/x/tools/go/packages"
)
func main() {
var modes = []packages.LoadMode{
packages.NeedName | packages.NeedSyntax,
packages.NeedName | packages.NeedFiles | packages.NeedSyntax,
packages.NeedName | packages.NeedCompiledGoFiles | packages.NeedSyntax,
}
for _, mode := range modes {
cfg := packages.Config{Mode: mode}
pkgs, err := packages.Load(&cfg, "runtime")
if err != nil {
log.Fatal(err)
}
pkg := pkgs[0]
fmt.Printf("%v (%v):\n\tlen(Syntax) = %v\n\tErrors: %v\n\n", pkg.PkgPath, mode, len(pkg.Syntax), pkg.Errors)
}
}
dmitshur
Metadata
Metadata
Assignees
Labels
NeedsFixThe path to resolution is known, but the work has not been done.The path to resolution is known, but the work has not been done.ToolsThis label describes issues relating to any tools in the x/tools repository.This label describes issues relating to any tools in the x/tools repository.