(odir, path, rootpath string, exmap map[string]struct{}, buildTags string)
| 135 | } |
| 136 | |
| 137 | func buildPkgRecurse(odir, path, rootpath string, exmap map[string]struct{}, buildTags string) error { |
| 138 | buildFirst := path == rootpath |
| 139 | bpkg, err := loadPackage(path, buildFirst, buildTags) |
| 140 | if err != nil { |
| 141 | return fmt.Errorf("gopy-gen: go build / load of package failed with path=%q: %v", path, err) |
| 142 | } |
| 143 | gofiles := bpkg.GoFiles |
| 144 | onego := "" |
| 145 | if len(gofiles) == 1 { |
| 146 | _, onego = filepath.Split(gofiles[0]) |
| 147 | } |
| 148 | if len(gofiles) == 0 || (len(gofiles) == 1 && onego == "doc.go") { |
| 149 | fmt.Printf("\n--- skipping dir with no go files or only doc.go: %s -- %s\n", path, gofiles) |
| 150 | if len(gofiles) == 0 { |
| 151 | // fmt.Printf("otherfiles: %v\nignorefiles: %v\n", bpkg.OtherFiles, bpkg.IgnoredFiles) |
| 152 | if len(bpkg.OtherFiles) > 0 { |
| 153 | gofiles = bpkg.OtherFiles |
| 154 | } else if len(bpkg.IgnoredFiles) > 0 { |
| 155 | gofiles = bpkg.IgnoredFiles |
| 156 | } else { |
| 157 | return nil // done |
| 158 | } |
| 159 | } |
| 160 | } else { |
| 161 | // fmt.Printf("gofiles: %s\n", gofiles) |
| 162 | parsePackage(bpkg) |
| 163 | } |
| 164 | |
| 165 | // now try all subdirs |
| 166 | dir, _ := filepath.Split(gofiles[0]) |
| 167 | drs := Dirs(dir) |
| 168 | for _, dr := range drs { |
| 169 | _, ex := exmap[dr] |
| 170 | if ex || dr[0] == '.' || dr[0] == '_' || dr == "internal" { |
| 171 | continue |
| 172 | } |
| 173 | sp := filepath.Join(path, dr) |
| 174 | buildPkgRecurse(odir, sp, rootpath, exmap, buildTags) |
| 175 | } |
| 176 | return nil |
| 177 | } |
no test coverage detected