diff options
| author | Eyal Posener <[email protected]> | 2017-05-18 23:40:02 +0300 |
|---|---|---|
| committer | Eyal Posener <[email protected]> | 2017-05-18 23:40:02 +0300 |
| commit | b3f5ec22d33ec8eda33606a6fc1406b8bce824ac (patch) | |
| tree | d360bf7fd72084cff519ac9579ef50fe21330979 /gocomplete/pkgs.go | |
| parent | dce08717c1081a4d35028ff7c2bc04d0b6b49d60 (diff) | |
gocomplete: go run should also predict non-main functions
Diffstat (limited to 'gocomplete/pkgs.go')
| -rw-r--r-- | gocomplete/pkgs.go | 26 |
1 files changed, 0 insertions, 26 deletions
diff --git a/gocomplete/pkgs.go b/gocomplete/pkgs.go index 356a0fa..e3a85d9 100644 --- a/gocomplete/pkgs.go +++ b/gocomplete/pkgs.go @@ -4,8 +4,6 @@ import ( "bytes" "encoding/json" "os/exec" - "path/filepath" - "regexp" "strings" "github.com/posener/complete" @@ -13,9 +11,6 @@ import ( const goListFormat = `{"Name": "{{.Name}}", "Path": "{{.Dir}}", "FilesString": "{{.GoFiles}}"}` -// regexp matches a main function -var reMainFunc = regexp.MustCompile("^main$") - func predictPackages(a complete.Args) (prediction []string) { dir := a.Directory() pkgs := listPackages(dir) @@ -27,27 +22,6 @@ func predictPackages(a complete.Args) (prediction []string) { return complete.PredictFilesSet(files).Predict(a) } -func predictRunnableFiles(a complete.Args) (prediction []string) { - dir := a.Directory() - pkgs := listPackages(dir) - - files := []string{} - for _, p := range pkgs { - // filter non main pacakges - if p.Name != "main" { - continue - } - for _, f := range p.Files { - path := filepath.Join(p.Path, f) - if len(functionsInFile(path, reMainFunc)) > 0 { - files = append(files, path) - } - } - } - complete.Log("FILES: %s", files) - return complete.PredictFilesSet(files).Predict(a) -} - type pack struct { Name string Path string |
