From 2e67c68cb68b24430763b06891c800ae9b5f688e Mon Sep 17 00:00:00 2001 From: sam boyer Date: Tue, 10 Jan 2017 23:28:55 -0500 Subject: [PATCH] Update comment in ListPackages() 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. --- analysis.go | 16 ++++++++++------ 1 file changed, 10 insertions(+), 6 deletions(-) diff --git a/analysis.go b/analysis.go index 451e53e..b0a563e 100644 --- a/analysis.go +++ b/analysis.go @@ -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" {