Skip to content

Commit

Permalink
feat: add versioning (#14)
Browse files Browse the repository at this point in the history
  • Loading branch information
freak12techno authored Feb 19, 2023
1 parent b47db9d commit 2ec6cd1
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 5 deletions.
9 changes: 6 additions & 3 deletions Makefile
Original file line number Diff line number Diff line change
@@ -1,8 +1,11 @@
VERSION := $(shell echo $(shell git describe --tags) | sed 's/^v//')
LDFLAGS = -X main.version=${VERSION}

build:
go build cmd/cosmos-node-exporter.go
go build -ldflags '$(LDFLAGS)' cmd/cosmos-node-exporter.go

install:
go install cmd/cosmos-node-exporter.go
go install -ldflags '$(LDFLAGS)' cmd/cosmos-node-exporter.go

lint:
golangci-lint run --fix ./...
golangci-lint run --fix ./...
9 changes: 7 additions & 2 deletions cmd/cosmos-node-exporter.go
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,10 @@ import (
"github.com/spf13/cobra"
)

var (
version = "unknown"
)

func Execute(configPath string) {
appConfig, err := config.GetConfig(configPath)
if err != nil {
Expand Down Expand Up @@ -37,8 +41,9 @@ func main() {
var ConfigPath string

rootCmd := &cobra.Command{
Use: "cosmos-node-exporter",
Long: "Scrapes validators info on multiple chains.",
Use: "cosmos-node-exporter",
Long: "A Prometheus scraper to return data about fullnode sync status and present upgrades.",
Version: version,
Run: func(cmd *cobra.Command, args []string) {
Execute(ConfigPath)
},
Expand Down

0 comments on commit 2ec6cd1

Please sign in to comment.