Skip to content

Commit

Permalink
fix flag parsing bug
Browse files Browse the repository at this point in the history
  • Loading branch information
asiyani committed Dec 27, 2024
1 parent 949dd1b commit 1570a3c
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 4 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/build.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ env:
IMAGE_NAME: ${{ github.repository }}

jobs:
docker:
build:
runs-on: ubuntu-latest
if: github.actor != 'dependabot[bot]'
steps:
Expand Down
3 changes: 1 addition & 2 deletions Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -14,8 +14,7 @@ RUN go mod download
# Copy the go source
COPY . .

RUN \
go test -v -cover ./... && \
RUN go test -v -cover ./... && \
CGO_ENABLED=0 go build -a -o metrics-aggregator

FROM alpine:3.20
Expand Down
7 changes: 6 additions & 1 deletion main.go
Original file line number Diff line number Diff line change
Expand Up @@ -197,8 +197,13 @@ func main() {
}

for _, pair := range strings.Split(*addLabels, ",") {
if pair == "" {
continue
}
kv := strings.Split(pair, "=")
collector.addLabels[kv[0]] = kv[1]
if len(kv) == 2 {
collector.addLabels[kv[0]] = kv[1]
}
}

reg := prometheus.NewPedanticRegistry()
Expand Down

0 comments on commit 1570a3c

Please sign in to comment.