internal/build:include target build-tags in Go package compilation

This commit is contained in:
luoliwoshang
2025-08-12 18:59:49 +08:00
parent f43e2c0dee
commit a069e1d438

View File

@@ -170,6 +170,9 @@ func Do(args []string, conf *Config) ([]Package, error) {
if conf.Tags != "" { if conf.Tags != "" {
tags += "," + conf.Tags tags += "," + conf.Tags
} }
if len(export.BuildTags) > 0 {
tags += "," + strings.Join(export.BuildTags, ",")
}
cfg := &packages.Config{ cfg := &packages.Config{
Mode: loadSyntax | packages.NeedDeps | packages.NeedModule | packages.NeedExportFile, Mode: loadSyntax | packages.NeedDeps | packages.NeedModule | packages.NeedExportFile,
BuildFlags: []string{"-tags=" + tags}, BuildFlags: []string{"-tags=" + tags},