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

Commit

Permalink
Fix --version flag
Browse files Browse the repository at this point in the history
Signed-off-by: Ashmita Bohara <[email protected]>
  • Loading branch information
Ashmita152 committed Mar 22, 2021
1 parent 7c67d1e commit 954d8a8
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 1 deletion.
3 changes: 3 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,9 @@
!.vscode/extensions.json
*.code-workspace

### goland ###
.idea

# End of https://www.toptal.com/developers/gitignore/api/go,vscode

/dist/
Expand Down
3 changes: 2 additions & 1 deletion cmd/root.go
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,7 @@ func Execute() {
cmd := &cobra.Command{
Use: "opentelemetry-collector-builder",
Long: fmt.Sprintf("OpenTelemetry Collector distribution builder (%s)", version),
Version: version,
RunE: func(cmd *cobra.Command, args []string) error {

if err := cfg.Validate(); err != nil {
Expand All @@ -61,12 +62,12 @@ func Execute() {
// the distribution parameters, which we accept as CLI flags as well
cmd.Flags().StringVar(&cfg.Distribution.ExeName, "name", "otelcol-custom", "The executable name for the OpenTelemetry Collector distribution")
cmd.Flags().StringVar(&cfg.Distribution.LongName, "description", "Custom OpenTelemetry Collector distribution", "A descriptive name for the OpenTelemetry Collector distribution")
cmd.Flags().StringVar(&cfg.Distribution.Version, "version", "1.0.0", "The version for the OpenTelemetry Collector distribution")
cmd.Flags().BoolVar(&cfg.Distribution.IncludeCore, "include-core", true, "Whether the core components should be included in the distribution")
cmd.Flags().StringVar(&cfg.Distribution.OtelColVersion, "otelcol-version", cfg.Distribution.OtelColVersion, "Which version of OpenTelemetry Collector to use as base")
cmd.Flags().StringVar(&cfg.Distribution.OutputPath, "output-path", cfg.Distribution.OutputPath, "Where to write the resulting files")
cmd.Flags().StringVar(&cfg.Distribution.Go, "go", "/usr/bin/go", "The Go binary to use during the compilation phase")
cmd.Flags().StringVar(&cfg.Distribution.Module, "module", "github.com/jpkroehling/opentelemetry-collector-builder", "The Go module for the new distribution")
cmd.SetVersionTemplate(version)

// tie Viper to flags
if err := viper.BindPFlags(cmd.Flags()); err != nil {
Expand Down

0 comments on commit 954d8a8

Please sign in to comment.