From 0a21264a9ce201139a1e4ce292bf219f36b563c3 Mon Sep 17 00:00:00 2001 From: bbernays Date: Thu, 24 Apr 2025 09:20:01 -0500 Subject: [PATCH 01/15] Update generator.go --- docs/generator.go | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/docs/generator.go b/docs/generator.go index 62dba4f67b..ab2820555a 100644 --- a/docs/generator.go +++ b/docs/generator.go @@ -2,6 +2,7 @@ package docs import ( "embed" + "errors" "fmt" "os" "regexp" @@ -119,7 +120,7 @@ func (g *Generator) Generate(dir string, format Format) error { switch format { case FormatMarkdown: - return g.renderTablesAsMarkdown(dir) + return errors.New("markdown format is not supported directly via the plugin, use the `cloudquery tables` command instead") case FormatJSON: return g.renderTablesAsJSON(dir) default: From e9613ba392e33eef71f856e2e953488906157413 Mon Sep 17 00:00:00 2001 From: bbernays Date: Thu, 24 Apr 2025 09:20:04 -0500 Subject: [PATCH 02/15] Update go.mod --- go.mod | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/go.mod b/go.mod index dc44116a86..610eae4fc1 100644 --- a/go.mod +++ b/go.mod @@ -25,7 +25,7 @@ require ( github.com/rs/zerolog v1.33.0 github.com/samber/lo v1.47.0 github.com/santhosh-tekuri/jsonschema/v6 v6.0.1 - github.com/spf13/cobra v1.8.1 + github.com/spf13/cobra v1.9.0 github.com/stretchr/testify v1.10.0 github.com/thoas/go-funk v0.9.3 go.opentelemetry.io/otel v1.34.0 @@ -81,7 +81,7 @@ require ( github.com/oapi-codegen/runtime v1.1.1 // indirect github.com/pierrec/lz4/v4 v4.1.22 // indirect github.com/pmezard/go-difflib v1.0.0 // indirect - github.com/spf13/pflag v1.0.5 // indirect + github.com/spf13/pflag v1.0.6 // indirect github.com/stoewer/go-strcase v1.3.0 // indirect github.com/wk8/go-ordered-map/v2 v2.1.8 // indirect github.com/zeebo/xxh3 v1.0.2 // indirect From a72e17ca1f277205886f301c82e8e48ccff00bcc Mon Sep 17 00:00:00 2001 From: bbernays Date: Thu, 24 Apr 2025 09:20:07 -0500 Subject: [PATCH 03/15] Update go.sum --- go.sum | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/go.sum b/go.sum index 2c7cf6a0e8..9987b28c8b 100644 --- a/go.sum +++ b/go.sum @@ -57,7 +57,7 @@ github.com/cloudquery/plugin-pb-go v1.26.9/go.mod h1:euhtVJKRtmWzukBxOjJyCKHPU9O github.com/cloudquery/plugin-sdk/v2 v2.7.0 h1:hRXsdEiaOxJtsn/wZMFQC9/jPfU1MeMK3KF+gPGqm7U= github.com/cloudquery/plugin-sdk/v2 v2.7.0/go.mod h1:pAX6ojIW99b/Vg4CkhnsGkRIzNaVEceYMR+Bdit73ug= github.com/coreos/go-systemd/v22 v22.5.0/go.mod h1:Y58oyj3AT4RCenI/lSvhwexgC+NSVTIJ3seZv2GcEnc= -github.com/cpuguy83/go-md2man/v2 v2.0.4/go.mod h1:tgQtvFlXSQOSOSIRvRPT7W67SCa46tRHOmNcaadrF8o= +github.com/cpuguy83/go-md2man/v2 v2.0.6/go.mod h1:oOW0eioCTA6cOiMLiUPZOpcVxMig6NIQQ7OS05n1F4g= github.com/davecgh/go-spew v1.1.0/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38= github.com/davecgh/go-spew v1.1.1 h1:vj9j/u1bqnvCEfJOwUhtlOARqs3+rkHYY13jYWTU97c= github.com/davecgh/go-spew v1.1.1/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38= @@ -144,10 +144,10 @@ github.com/samber/lo v1.47.0 h1:z7RynLwP5nbyRscyvcD043DWYoOcYRv3mV8lBeqOCLc= github.com/samber/lo v1.47.0/go.mod h1:RmDH9Ct32Qy3gduHQuKJ3gW1fMHAnE/fAzQuf6He5cU= github.com/santhosh-tekuri/jsonschema/v6 v6.0.1 h1:PKK9DyHxif4LZo+uQSgXNqs0jj5+xZwwfKHgph2lxBw= github.com/santhosh-tekuri/jsonschema/v6 v6.0.1/go.mod h1:JXeL+ps8p7/KNMjDQk3TCwPpBy0wYklyWTfbkIzdIFU= -github.com/spf13/cobra v1.8.1 h1:e5/vxKd/rZsfSJMUX1agtjeTDf+qv1/JdBF8gg5k9ZM= -github.com/spf13/cobra v1.8.1/go.mod h1:wHxEcudfqmLYa8iTfL+OuZPbBZkmvliBWKIezN3kD9Y= -github.com/spf13/pflag v1.0.5 h1:iy+VFUOCP1a+8yFto/drg2CJ5u0yRoB7fZw3DKv/JXA= -github.com/spf13/pflag v1.0.5/go.mod h1:McXfInJRrz4CZXVZOBLb0bTZqETkiAhM9Iw0y3An2Bg= +github.com/spf13/cobra v1.9.0 h1:Py5fIuq/lJsRYxcxfOtsJqpmwJWCMOUy2tMJYV8TNHE= +github.com/spf13/cobra v1.9.0/go.mod h1:nDyEzZ8ogv936Cinf6g1RU9MRY64Ir93oCnqb9wxYW0= +github.com/spf13/pflag v1.0.6 h1:jFzHGLGAlb3ruxLB8MhbI6A8+AQX/2eW4qeyNZXNp2o= +github.com/spf13/pflag v1.0.6/go.mod h1:McXfInJRrz4CZXVZOBLb0bTZqETkiAhM9Iw0y3An2Bg= github.com/spkg/bom v0.0.0-20160624110644-59b7046e48ad/go.mod h1:qLr4V1qq6nMqFKkMo8ZTx3f+BZEkzsRUY10Xsm2mwU0= github.com/stoewer/go-strcase v1.3.0 h1:g0eASXYtp+yvN9fK8sH94oCIk0fau9uV1/ZdJ0AVEzs= github.com/stoewer/go-strcase v1.3.0/go.mod h1:fAH5hQ5pehh+j3nZfvwdk2RgEgQjAoM8wodgtPmh1xo= From 8df628673311295e8b3f66cb74fff1a532d0906a Mon Sep 17 00:00:00 2001 From: bbernays Date: Thu, 24 Apr 2025 10:29:46 -0500 Subject: [PATCH 04/15] Update generator.go --- docs/generator.go | 15 +++++++++++++-- 1 file changed, 13 insertions(+), 2 deletions(-) diff --git a/docs/generator.go b/docs/generator.go index ab2820555a..bb4e762699 100644 --- a/docs/generator.go +++ b/docs/generator.go @@ -2,7 +2,6 @@ package docs import ( "embed" - "errors" "fmt" "os" "regexp" @@ -120,7 +119,19 @@ func (g *Generator) Generate(dir string, format Format) error { switch format { case FormatMarkdown: - return errors.New("markdown format is not supported directly via the plugin, use the `cloudquery tables` command instead") + return g.renderTablesAsMarkdown(dir) + case FormatJSON: + return g.renderTablesAsJSON(dir) + default: + return fmt.Errorf("unsupported format: %v", format) + } +} + +func (g *Generator) GenerateJSON(dir string, format Format) error { + if err := os.MkdirAll(dir, os.ModePerm); err != nil { + return err + } + switch format { case FormatJSON: return g.renderTablesAsJSON(dir) default: From b37410d1cf84c16759edf06ad8d8c05d6ddd9b7b Mon Sep 17 00:00:00 2001 From: bbernays Date: Thu, 24 Apr 2025 10:29:48 -0500 Subject: [PATCH 05/15] Update docs.go --- serve/docs.go | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/serve/docs.go b/serve/docs.go index 9cab2d3bcd..db5bb56a93 100644 --- a/serve/docs.go +++ b/serve/docs.go @@ -1,6 +1,7 @@ package serve import ( + "errors" "fmt" "strings" @@ -43,11 +44,11 @@ func (s *PluginServe) newCmdPluginDoc() *cobra.Command { return err } g := docs.NewGenerator(s.plugin.Name(), tables) - f := docs.FormatMarkdown - if format.Value == "json" { - f = docs.FormatJSON + if format.Value != "json" { + return errors.New("only json format is supported. If need to generate markdown, use the `cloudquery tables` command") } - return g.Generate(args[0], f) + + return g.GenerateJSON(args[0], docs.FormatJSON) }, } cmd.Flags().Var(format, "format", fmt.Sprintf("output format. one of: %s", strings.Join(format.Allowed, ","))) From 8764f70e989f9ea09d380545daf60a43f2929450 Mon Sep 17 00:00:00 2001 From: bbernays Date: Thu, 24 Apr 2025 15:09:25 -0500 Subject: [PATCH 06/15] Update docs_test.go --- serve/docs_test.go | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/serve/docs_test.go b/serve/docs_test.go index df463dcc8f..30a3e605f4 100644 --- a/serve/docs_test.go +++ b/serve/docs_test.go @@ -15,7 +15,7 @@ func TestPluginDocs(t *testing.T) { memdb.NewMemDBClient) srv := Plugin(p) cmd := srv.newCmdPluginRoot() - cmd.SetArgs([]string{"doc", tmpDir}) + cmd.SetArgs([]string{"doc", tmpDir, "--format", "json"}) if err := cmd.Execute(); err != nil { t.Fatal(err) } From 94ea0efb00b95ad0213f5dfc73b855ed06f4147e Mon Sep 17 00:00:00 2001 From: bbernays Date: Thu, 24 Apr 2025 15:15:03 -0500 Subject: [PATCH 07/15] Update go.mod --- examples/simple_plugin/go.mod | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/examples/simple_plugin/go.mod b/examples/simple_plugin/go.mod index 8a300963f3..55a8485314 100644 --- a/examples/simple_plugin/go.mod +++ b/examples/simple_plugin/go.mod @@ -58,8 +58,8 @@ require ( github.com/pmezard/go-difflib v1.0.0 // indirect github.com/samber/lo v1.47.0 // indirect github.com/santhosh-tekuri/jsonschema/v6 v6.0.1 // indirect - github.com/spf13/cobra v1.8.1 // indirect - github.com/spf13/pflag v1.0.5 // indirect + github.com/spf13/cobra v1.9.0 // indirect + github.com/spf13/pflag v1.0.6 // indirect github.com/stretchr/testify v1.10.0 // indirect github.com/thoas/go-funk v0.9.3 // indirect github.com/wk8/go-ordered-map/v2 v2.1.8 // indirect From 5bb3633eb54081518e9ccbb77dd4192d6a79ae05 Mon Sep 17 00:00:00 2001 From: bbernays Date: Thu, 24 Apr 2025 15:15:04 -0500 Subject: [PATCH 08/15] Update go.sum --- examples/simple_plugin/go.sum | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/examples/simple_plugin/go.sum b/examples/simple_plugin/go.sum index 540762d4a4..0e73ab65a6 100644 --- a/examples/simple_plugin/go.sum +++ b/examples/simple_plugin/go.sum @@ -57,7 +57,7 @@ github.com/cloudquery/plugin-pb-go v1.26.9/go.mod h1:euhtVJKRtmWzukBxOjJyCKHPU9O github.com/cloudquery/plugin-sdk/v2 v2.7.0 h1:hRXsdEiaOxJtsn/wZMFQC9/jPfU1MeMK3KF+gPGqm7U= github.com/cloudquery/plugin-sdk/v2 v2.7.0/go.mod h1:pAX6ojIW99b/Vg4CkhnsGkRIzNaVEceYMR+Bdit73ug= github.com/coreos/go-systemd/v22 v22.5.0/go.mod h1:Y58oyj3AT4RCenI/lSvhwexgC+NSVTIJ3seZv2GcEnc= -github.com/cpuguy83/go-md2man/v2 v2.0.4/go.mod h1:tgQtvFlXSQOSOSIRvRPT7W67SCa46tRHOmNcaadrF8o= +github.com/cpuguy83/go-md2man/v2 v2.0.6/go.mod h1:oOW0eioCTA6cOiMLiUPZOpcVxMig6NIQQ7OS05n1F4g= github.com/davecgh/go-spew v1.1.0/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38= github.com/davecgh/go-spew v1.1.1 h1:vj9j/u1bqnvCEfJOwUhtlOARqs3+rkHYY13jYWTU97c= github.com/davecgh/go-spew v1.1.1/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38= @@ -142,10 +142,10 @@ github.com/samber/lo v1.47.0 h1:z7RynLwP5nbyRscyvcD043DWYoOcYRv3mV8lBeqOCLc= github.com/samber/lo v1.47.0/go.mod h1:RmDH9Ct32Qy3gduHQuKJ3gW1fMHAnE/fAzQuf6He5cU= github.com/santhosh-tekuri/jsonschema/v6 v6.0.1 h1:PKK9DyHxif4LZo+uQSgXNqs0jj5+xZwwfKHgph2lxBw= github.com/santhosh-tekuri/jsonschema/v6 v6.0.1/go.mod h1:JXeL+ps8p7/KNMjDQk3TCwPpBy0wYklyWTfbkIzdIFU= -github.com/spf13/cobra v1.8.1 h1:e5/vxKd/rZsfSJMUX1agtjeTDf+qv1/JdBF8gg5k9ZM= -github.com/spf13/cobra v1.8.1/go.mod h1:wHxEcudfqmLYa8iTfL+OuZPbBZkmvliBWKIezN3kD9Y= -github.com/spf13/pflag v1.0.5 h1:iy+VFUOCP1a+8yFto/drg2CJ5u0yRoB7fZw3DKv/JXA= -github.com/spf13/pflag v1.0.5/go.mod h1:McXfInJRrz4CZXVZOBLb0bTZqETkiAhM9Iw0y3An2Bg= +github.com/spf13/cobra v1.9.0 h1:Py5fIuq/lJsRYxcxfOtsJqpmwJWCMOUy2tMJYV8TNHE= +github.com/spf13/cobra v1.9.0/go.mod h1:nDyEzZ8ogv936Cinf6g1RU9MRY64Ir93oCnqb9wxYW0= +github.com/spf13/pflag v1.0.6 h1:jFzHGLGAlb3ruxLB8MhbI6A8+AQX/2eW4qeyNZXNp2o= +github.com/spf13/pflag v1.0.6/go.mod h1:McXfInJRrz4CZXVZOBLb0bTZqETkiAhM9Iw0y3An2Bg= github.com/spkg/bom v0.0.0-20160624110644-59b7046e48ad/go.mod h1:qLr4V1qq6nMqFKkMo8ZTx3f+BZEkzsRUY10Xsm2mwU0= github.com/stoewer/go-strcase v1.3.0 h1:g0eASXYtp+yvN9fK8sH94oCIk0fau9uV1/ZdJ0AVEzs= github.com/stoewer/go-strcase v1.3.0/go.mod h1:fAH5hQ5pehh+j3nZfvwdk2RgEgQjAoM8wodgtPmh1xo= From a3d9808355602676c1f577457536d19cdff5950c Mon Sep 17 00:00:00 2001 From: bbernays Date: Thu, 24 Apr 2025 15:23:58 -0500 Subject: [PATCH 09/15] Update package.go --- serve/package.go | 1 + 1 file changed, 1 insertion(+) diff --git a/serve/package.go b/serve/package.go index 581b09c407..b2ed57a42b 100644 --- a/serve/package.go +++ b/serve/package.go @@ -132,6 +132,7 @@ func (s *PluginServe) build(pluginDirectory string, target plugin.BuildTarget, d args := []string{"build", "-o", pluginPath} args = append(args, "-buildmode=exe") args = append(args, "-ldflags", ldFlags) + args = append(args, "-tags", "grpcnotrace") cmd := exec.Command("go", args...) cmd.Dir = pluginDirectory cmd.Stdout = os.Stdout From 78c84ca8ab59e67c81dd032e0d867b03637b45d7 Mon Sep 17 00:00:00 2001 From: bbernays Date: Thu, 24 Apr 2025 15:27:17 -0500 Subject: [PATCH 10/15] Update package.go --- serve/package.go | 2 ++ 1 file changed, 2 insertions(+) diff --git a/serve/package.go b/serve/package.go index b2ed57a42b..824d8341de 100644 --- a/serve/package.go +++ b/serve/package.go @@ -132,6 +132,8 @@ func (s *PluginServe) build(pluginDirectory string, target plugin.BuildTarget, d args := []string{"build", "-o", pluginPath} args = append(args, "-buildmode=exe") args = append(args, "-ldflags", ldFlags) + // This disables gRPC tracing, which introduces a dependency that blocks dead code elimination\ + // https://github.com/grpc/grpc-go/blob/030938e543b4a721cd426d15611d50ecf097dcf3/trace_notrace.go#L23-L25 args = append(args, "-tags", "grpcnotrace") cmd := exec.Command("go", args...) cmd.Dir = pluginDirectory From 07a9db138b42d8579e910d2eb474602dc7a6aef1 Mon Sep 17 00:00:00 2001 From: bbernays Date: Mon, 28 Apr 2025 10:43:40 -0500 Subject: [PATCH 11/15] Update package.go --- serve/package.go | 11 ++++++++--- 1 file changed, 8 insertions(+), 3 deletions(-) diff --git a/serve/package.go b/serve/package.go index 824d8341de..788764a1ad 100644 --- a/serve/package.go +++ b/serve/package.go @@ -117,7 +117,7 @@ func (s *PluginServe) writeTablesJSON(ctx context.Context, dir string) error { return os.WriteFile(outputPath, buffer.Bytes(), 0644) } -func (s *PluginServe) build(pluginDirectory string, target plugin.BuildTarget, distPath, pluginVersion string) (*TargetBuild, error) { +func (s *PluginServe) build(pluginDirectory string, target plugin.BuildTarget, distPath, pluginVersion, buildTags string) (*TargetBuild, error) { pluginFileName := fmt.Sprintf("plugin-%s-%s-%s-%s", s.plugin.Name(), pluginVersion, target.OS, target.Arch) pluginPath := path.Join(distPath, pluginFileName) importPath, err := s.getModuleName(pluginDirectory) @@ -134,7 +134,7 @@ func (s *PluginServe) build(pluginDirectory string, target plugin.BuildTarget, d args = append(args, "-ldflags", ldFlags) // This disables gRPC tracing, which introduces a dependency that blocks dead code elimination\ // https://github.com/grpc/grpc-go/blob/030938e543b4a721cd426d15611d50ecf097dcf3/trace_notrace.go#L23-L25 - args = append(args, "-tags", "grpcnotrace") + args = append(args, "-tags", buildTags) cmd := exec.Command("go", args...) cmd.Dir = pluginDirectory cmd.Stdout = os.Stdout @@ -404,6 +404,10 @@ func (s *PluginServe) newCmdPluginPackage() *cobra.Command { message = string(messageBytes) } message = normalizeMessage(message) + buildTags := "grpcnotrace" + if cmd.Flag("build-tags").Changed { + buildTags = cmd.Flag("build-tags").Value.String() + } if err := os.MkdirAll(distPath, 0755); err != nil { return err @@ -437,7 +441,7 @@ func (s *PluginServe) newCmdPluginPackage() *cobra.Command { targets := []TargetBuild{} for _, target := range s.plugin.Targets() { fmt.Println("Building for OS: " + target.OS + ", ARCH: " + target.Arch) - targetBuild, err := s.build(pluginDirectory, target, distPath, pluginVersion) + targetBuild, err := s.build(pluginDirectory, target, distPath, pluginVersion, buildTags) if err != nil { return fmt.Errorf("failed to build plugin for %s/%s: %w", target.OS, target.Arch, err) } @@ -458,6 +462,7 @@ func (s *PluginServe) newCmdPluginPackage() *cobra.Command { cmd.Flags().StringP("dist-dir", "D", "", "dist directory to output the built plugin. (default: /dist)") cmd.Flags().StringP("docs-dir", "", "", "docs directory containing markdown files to copy to the dist directory. (default: /docs)") cmd.Flags().StringP("message", "m", "", "message that summarizes what is new or changed in this version. Use @ to read from file. Supports markdown.") + cmd.Flags().StringP("build-tags", "", "", "build tags to use when building the plugin. (default: grpcnotrace)") return cmd } From c83e36ab792d44f5b82b2ded0460d457b77318f6 Mon Sep 17 00:00:00 2001 From: bbernays Date: Thu, 15 May 2025 14:46:58 -0500 Subject: [PATCH 12/15] Update plugin_package.go --- plugin/plugin_package.go | 22 ++++++++++++++++------ 1 file changed, 16 insertions(+), 6 deletions(-) diff --git a/plugin/plugin_package.go b/plugin/plugin_package.go index 663481b990..7547c7d5f4 100644 --- a/plugin/plugin_package.go +++ b/plugin/plugin_package.go @@ -2,6 +2,7 @@ package plugin import ( "errors" + "strings" ) const ( @@ -41,14 +42,23 @@ type BuildTarget struct { Arch string `json:"arch"` CGO bool `json:"cgo"` Env []string `json:"env"` + Tags []string `json:"tags"` IncludeSymbols bool `json:"include_symbols"` } func (t BuildTarget) EnvVariables() []string { - variables := append(t.cgoEnvVariables(), "GOOS="+t.OS, "GOARCH="+t.Arch) + variables := append(t.cgoEnvVariables(), "GOOS="+t.OS, "GOARCH="+t.Arch, t.tags()) return append(variables, t.Env...) } +func (t BuildTarget) tags() string { + if len(t.Tags) == 0 { + return "" + } + tagString := strings.Join(t.Tags, ",") + return "GOFLAGS=-tags=" + tagString +} + func (t BuildTarget) cgoEnvVariables() []string { // default is to tool at the param. Can be overridden by adding `CGO_ENABLED=1` to BuildTarget.Env if !t.CGO { @@ -78,9 +88,9 @@ func (t BuildTarget) cgoEnvVariables() []string { } var DefaultBuildTargets = []BuildTarget{ - {OS: GoOSLinux, Arch: GoArchAmd64}, - {OS: GoOSLinux, Arch: GoArchArm64}, - {OS: GoOSWindows, Arch: GoArchAmd64}, - {OS: GoOSDarwin, Arch: GoArchAmd64}, - {OS: GoOSDarwin, Arch: GoArchArm64}, + {OS: GoOSLinux, Arch: GoArchAmd64, Tags: []string{"grpcnotrace"}}, + {OS: GoOSLinux, Arch: GoArchArm64, Tags: []string{"grpcnotrace"}}, + {OS: GoOSWindows, Arch: GoArchAmd64, Tags: []string{"grpcnotrace"}}, + {OS: GoOSDarwin, Arch: GoArchAmd64, Tags: []string{"grpcnotrace"}}, + {OS: GoOSDarwin, Arch: GoArchArm64, Tags: []string{"grpcnotrace"}}, } From 4e39bf1c71d0050f73f5f059c9d1ff29075f55ca Mon Sep 17 00:00:00 2001 From: bbernays Date: Thu, 15 May 2025 14:47:00 -0500 Subject: [PATCH 13/15] Update package.go --- serve/package.go | 14 +++++--------- 1 file changed, 5 insertions(+), 9 deletions(-) diff --git a/serve/package.go b/serve/package.go index 788764a1ad..8920441a77 100644 --- a/serve/package.go +++ b/serve/package.go @@ -117,7 +117,7 @@ func (s *PluginServe) writeTablesJSON(ctx context.Context, dir string) error { return os.WriteFile(outputPath, buffer.Bytes(), 0644) } -func (s *PluginServe) build(pluginDirectory string, target plugin.BuildTarget, distPath, pluginVersion, buildTags string) (*TargetBuild, error) { +func (s *PluginServe) build(pluginDirectory string, target plugin.BuildTarget, distPath, pluginVersion string) (*TargetBuild, error) { pluginFileName := fmt.Sprintf("plugin-%s-%s-%s-%s", s.plugin.Name(), pluginVersion, target.OS, target.Arch) pluginPath := path.Join(distPath, pluginFileName) importPath, err := s.getModuleName(pluginDirectory) @@ -132,9 +132,9 @@ func (s *PluginServe) build(pluginDirectory string, target plugin.BuildTarget, d args := []string{"build", "-o", pluginPath} args = append(args, "-buildmode=exe") args = append(args, "-ldflags", ldFlags) - // This disables gRPC tracing, which introduces a dependency that blocks dead code elimination\ - // https://github.com/grpc/grpc-go/blob/030938e543b4a721cd426d15611d50ecf097dcf3/trace_notrace.go#L23-L25 - args = append(args, "-tags", buildTags) + // // This disables gRPC tracing, which introduces a dependency that blocks dead code elimination\ + // // https://github.com/grpc/grpc-go/blob/030938e543b4a721cd426d15611d50ecf097dcf3/trace_notrace.go#L23-L25 + // args = append(args, "-tags", buildTags) cmd := exec.Command("go", args...) cmd.Dir = pluginDirectory cmd.Stdout = os.Stdout @@ -404,10 +404,6 @@ func (s *PluginServe) newCmdPluginPackage() *cobra.Command { message = string(messageBytes) } message = normalizeMessage(message) - buildTags := "grpcnotrace" - if cmd.Flag("build-tags").Changed { - buildTags = cmd.Flag("build-tags").Value.String() - } if err := os.MkdirAll(distPath, 0755); err != nil { return err @@ -441,7 +437,7 @@ func (s *PluginServe) newCmdPluginPackage() *cobra.Command { targets := []TargetBuild{} for _, target := range s.plugin.Targets() { fmt.Println("Building for OS: " + target.OS + ", ARCH: " + target.Arch) - targetBuild, err := s.build(pluginDirectory, target, distPath, pluginVersion, buildTags) + targetBuild, err := s.build(pluginDirectory, target, distPath, pluginVersion) if err != nil { return fmt.Errorf("failed to build plugin for %s/%s: %w", target.OS, target.Arch, err) } From 0a2bde3499020a0565399c5791f2ffaed126323a Mon Sep 17 00:00:00 2001 From: bbernays Date: Thu, 15 May 2025 14:58:01 -0500 Subject: [PATCH 14/15] Update package.go --- serve/package.go | 3 --- 1 file changed, 3 deletions(-) diff --git a/serve/package.go b/serve/package.go index 8920441a77..2349cdd28b 100644 --- a/serve/package.go +++ b/serve/package.go @@ -132,9 +132,6 @@ func (s *PluginServe) build(pluginDirectory string, target plugin.BuildTarget, d args := []string{"build", "-o", pluginPath} args = append(args, "-buildmode=exe") args = append(args, "-ldflags", ldFlags) - // // This disables gRPC tracing, which introduces a dependency that blocks dead code elimination\ - // // https://github.com/grpc/grpc-go/blob/030938e543b4a721cd426d15611d50ecf097dcf3/trace_notrace.go#L23-L25 - // args = append(args, "-tags", buildTags) cmd := exec.Command("go", args...) cmd.Dir = pluginDirectory cmd.Stdout = os.Stdout From 948fce1ea2c52dc81cf8ea921f37ac131f9ce000 Mon Sep 17 00:00:00 2001 From: bbernays Date: Thu, 15 May 2025 14:58:22 -0500 Subject: [PATCH 15/15] Update package.go --- serve/package.go | 1 - 1 file changed, 1 deletion(-) diff --git a/serve/package.go b/serve/package.go index 2349cdd28b..581b09c407 100644 --- a/serve/package.go +++ b/serve/package.go @@ -455,7 +455,6 @@ func (s *PluginServe) newCmdPluginPackage() *cobra.Command { cmd.Flags().StringP("dist-dir", "D", "", "dist directory to output the built plugin. (default: /dist)") cmd.Flags().StringP("docs-dir", "", "", "docs directory containing markdown files to copy to the dist directory. (default: /docs)") cmd.Flags().StringP("message", "m", "", "message that summarizes what is new or changed in this version. Use @ to read from file. Supports markdown.") - cmd.Flags().StringP("build-tags", "", "", "build tags to use when building the plugin. (default: grpcnotrace)") return cmd }