The answer to both of the questions is that I followed this examples from 
the ssa <https://godoc.org/golang.org/x/tools/go/ssa> package 
(LoadWholeProgram):


// Load, parse, and type-check the whole program.
cfg := packages.Config{Mode: packages.LoadAllSyntax}
initial, err := packages.Load(&cfg, "fmt", "net/http")
if err != nil {
    log.Fatal(err)
}



It implies that a list of packages (or package paths) needs to be passed to 
the Load function. Otherwise, I am not sure how would the tool know what to 
load, particularly that the GOPATH is set to the tool itself and not to the 
codebase that the tool analyses.

FYI, Michael Matloob answered this question in the golang-tools 
<https://groups.google.com/forum/#!topic/golang-tools/hIRQ60on35M> list and 
it seems like it is a legit problem that should be filed as a bug.

Adam

On Thursday, January 30, 2020 at 5:54:36 AM UTC-8, Manlio Perillo wrote:
>
> On Wednesday, January 29, 2020 at 11:12:40 PM UTC+1, adam...@uber.com 
> wrote:
>>
>> I am trying to analyze a large application using Go's static analysis 
>> support. I am using the "packages" 
>> <https://godoc.org/golang.org/x/tools/go/packages> package to load all 
>> application packages using the Load 
>> <https://godoc.org/golang.org/x/tools/go/packages#Load> function.
>>
>
> What arguments are you passing to the Load function?
> It should suffice a simple "all".
>  
>
>>   Unfortunately the application is really big and the list of patterns 
>> that the Load function takes the second parameter is really long.
>>
>
> Why are you passing a list of patterns to Load? Where are these patterns 
> coming from?
>
> > [...]
>  
>
>> Adam
>>
>
>
> Manlio Perillo 
>

-- 
You received this message because you are subscribed to the Google Groups 
"golang-nuts" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to golang-nuts+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/golang-nuts/2346d411-45d1-4d76-87fa-c77a1f8c67c1%40googlegroups.com.

Reply via email to