Skip to content

Commit

Permalink
fallback to ldflags Version for goreleaser (#79)
Browse files Browse the repository at this point in the history
versioninfo package will only set the version for go install, meaning
we need to fallback to the previous method for goreleaser.
  • Loading branch information
RoryQ authored May 7, 2024
1 parent 28401d0 commit 85b5449
Show file tree
Hide file tree
Showing 2 changed files with 17 additions and 14 deletions.
2 changes: 1 addition & 1 deletion .goreleaser.yml
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ builds:
- linux
# - windows
- darwin
ldflags: -X github.com/roryq/wrench/cmd.Version=${{ .Version }}
ldflags: -X github.com/roryq/wrench/cmd.Version=v{{ .Version }}
tags:
- netgo
archives:
Expand Down
29 changes: 16 additions & 13 deletions cmd/root.go
Original file line number Diff line number Diff line change
Expand Up @@ -38,18 +38,18 @@ var (
)

var (
project string
instance string
database string
directory string
schemaFile string
credentialsFile string
staticDataTablesFile string
lockIdentifier string
sequenceInterval uint16
stmtTimeout time.Duration
verbose bool
detectPartitionedDML bool
project string
instance string
database string
directory string
schemaFile string
credentialsFile string
staticDataTablesFile string
lockIdentifier string
sequenceInterval uint16
stmtTimeout time.Duration
verbose bool
detectPartitionedDML bool
partitionedDMLConcurrency uint16
)

Expand Down Expand Up @@ -94,7 +94,10 @@ func init() {
rootCmd.PersistentFlags().BoolVar(&detectPartitionedDML, flagDetectPartitionedDML, getDetectPartitionedDML(), "Automatically detect when a migration contains only Partitioned DML statements, and apply the statements in partition-level transactions via the PartitionedDML API. (optional. if not set, will use $WRENCH_DETECT_PARTITIONED_DML or default to false)")
rootCmd.PersistentFlags().Uint16Var(&partitionedDMLConcurrency, flagPartitionedDMLConcurrency, getPartitionedDMLConcurrency(), "Set the concurrency for Partitioned-DML statements. (optional. if not set, will use $WRENCH_PARTITIONED_DML_CONCURRENCY or default to 1)")

rootCmd.Version = versioninfo.Version
rootCmd.Version = Version
if versioninfo.Version != "unknown" && versioninfo.Version != "(devel)" {
rootCmd.Version = versioninfo.Version
}
rootCmd.SetVersionTemplate(versionTemplate)
}

Expand Down

0 comments on commit 85b5449

Please sign in to comment.