Skip to content
This repository has been archived by the owner on Feb 3, 2018. It is now read-only.

Commit

Permalink
Update comment in ListPackages()
Browse files Browse the repository at this point in the history
The comment indicated that ListPackages() could handle multiple ignored
`package main` files in another package. Thanks to how how `go/build`
works, this wasn't true. This commit adds an extra bit to the comment
noting as much.
  • Loading branch information
sdboyer committed Jan 11, 2017
1 parent 669a62f commit 2e67c68
Showing 1 changed file with 10 additions and 6 deletions.
16 changes: 10 additions & 6 deletions analysis.go
Original file line number Diff line number Diff line change
Expand Up @@ -184,12 +184,16 @@ func ListPackages(fileRoot, importRoot string) (PackageTree, error) {
// combinations. That will be a more significant refactor.
//
// However, there is one case we want to allow here - one or
// more files with "+build ignore" with package `main`. (Ignore
// is just a convention, but for now it's good enough to just
// check that.) This is a fairly common way to give examples,
// and to make a more sophisticated build system than a Makefile
// allows, so we want to support that case. So, transparently
// lump the deps together.
// more files with package `main` having a "+build ignore" tag.
// (Ignore is just a convention, but for now it's good enough to
// just check that.) This is a fairly common way to give
// examples, and to make a more sophisticated build system than
// a Makefile allows, so we want to support that case. So,
// transparently lump the deps together.
//
// Caveat: this will only handle one file having an issue, as
// go/build stops scanning after it runs into the first problem.
// See https://github.com/sdboyer/gps/issues/138
mains := make(map[string]struct{})
for k, pkgname := range terr.Packages {
if pkgname == "main" {
Expand Down

0 comments on commit 2e67c68

Please sign in to comment.