Skip to content
This repository has been archived by the owner on Oct 31, 2023. It is now read-only.

Got go list to respect the tags given [fixes #125] #126

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 5 additions & 2 deletions go.go
Original file line number Diff line number Diff line change
Expand Up @@ -122,9 +122,12 @@ func GoCrossCompile(opts *CompileOpts) error {
// GoMainDirs returns the file paths to the packages that are "main"
// packages, from the list of packages given. The list of packages can
// include relative paths, the special "..." Go keyword, etc.
func GoMainDirs(packages []string, GoCmd string) ([]string, error) {
args := make([]string, 0, len(packages)+3)
func GoMainDirs(packages []string, GoCmd, tags string) ([]string, error) {
args := make([]string, 0, len(packages)+5)
args = append(args, "list", "-f", "{{.Name}}|{{.ImportPath}}")
if tags != "" {
args = append(args, "-tags", tags)
}
args = append(args, packages...)

output, err := execGo(GoCmd, nil, "", args...)
Expand Down
2 changes: 1 addition & 1 deletion main.go
Original file line number Diff line number Diff line change
Expand Up @@ -95,7 +95,7 @@ func realMain() int {
}

// Get the packages that are in the given paths
mainDirs, err := GoMainDirs(packages, flagGoCmd)
mainDirs, err := GoMainDirs(packages, flagGoCmd, tags)
if err != nil {
fmt.Fprintf(os.Stderr, "Error reading packages: %s", err)
return 1
Expand Down