diff --git a/.github/workflows/audit.yaml b/.github/workflows/audit.yaml new file mode 100644 index 0000000..3b23b40 --- /dev/null +++ b/.github/workflows/audit.yaml @@ -0,0 +1,8 @@ +--- +name: Audit + +on: [push] + +jobs: + audit: + uses: rddl-network/github-actions/.github/workflows/audit.yaml@main diff --git a/.github/workflows/release.yaml b/.github/workflows/release.yaml new file mode 100644 index 0000000..c75e3b5 --- /dev/null +++ b/.github/workflows/release.yaml @@ -0,0 +1,30 @@ +--- +name: Release + +on: + workflow_dispatch: + inputs: + tag: + description: "Tag" + required: true + default: "" + prerelease: + type: choice + description: "Pre-Release?" + required: true + options: + - true + - false + default: true + files: + description: "Files" + required: true + default: "rddl-prometheus-exporter" + +jobs: + release: + uses: rddl-network/github-actions/.github/workflows/release.yaml@main + with: + tag: ${{ github.event.inputs.tag }} + prerelease: ${{ fromJSON(github.event.inputs.prerelease) }} + files: ${{ github.event.inputs.files }} diff --git a/.golangci.yaml b/.golangci.yaml new file mode 100644 index 0000000..17c5c68 --- /dev/null +++ b/.golangci.yaml @@ -0,0 +1,87 @@ +--- +run: + timeout: 5m +linters: + enable: + - asasalint + - asciicheck + - bidichk + - bodyclose + - containedctx + - contextcheck + - decorder + - dogsled + - dupl + - dupword + - durationcheck + - errcheck + - errchkjson + - errname + - errorlint + - execinquery + - exhaustive + - exportloopref + - forcetypeassert + - ginkgolinter + - gocheckcompilerdirectives + - gochecksumtype + - gocognit + - goconst + - gocritic + - gocyclo + - gofmt + - goheader + - gomodguard + - goprintffuncname + - gosimple + - gosmopolitan + - govet + - grouper + - importas + - ineffassign + - interfacebloat + - loggercheck + - makezero + - mirror + - misspell + - musttag + - nakedret + - nestif + - nilnil + - noctx + - nolintlint + - nosprintfhostport + - perfsprint + - prealloc + - predeclared + - promlinter + - protogetter + - reassign + - revive + - rowserrcheck + - sloglint + - sqlclosecheck + - staticcheck + - stylecheck + - tagalign + - tagliatelle + - tenv + - testableexamples + - tparallel + - unconvert + - unparam + - unused + - usestdlibvars + - wastedassign + - whitespace + - zerologlint +linters-settings: + nakedret: + max-func-lines: 100 + tagalign: + strict: true + tagliatelle: + case: + use-field-name: true + rules: + json: kebab diff --git a/cmd/rddl-prometheus-exporter/main.go b/cmd/rddl-prometheus-exporter/main.go index 562c167..07c55d5 100644 --- a/cmd/rddl-prometheus-exporter/main.go +++ b/cmd/rddl-prometheus-exporter/main.go @@ -32,7 +32,7 @@ func main() { for _, wallet := range strings.Split(cfg.Wallets, ",") { wallet = strings.TrimSpace(wallet) - sanitizedWallet := strings.Replace(wallet, "-", "_", -1) + sanitizedWallet := strings.ReplaceAll(wallet, "-", "_") logger.Printf("registering gauge for wallet: " + wallet) setGauge("balance_"+sanitizedWallet, "Bitcoin balance for network relevant wallet: "+wallet, "elementsd", "wallets", func() float64 { res, err := elements.GetBalance(cfg.GetElementsURL(wallet), []string{})