Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Do not use prometheusx to include git commit in software #144

Open
SaiedKazemi opened this issue Mar 22, 2022 · 1 comment
Open

Do not use prometheusx to include git commit in software #144

SaiedKazemi opened this issue Mar 22, 2022 · 1 comment

Comments

@SaiedKazemi
Copy link
Member

SaiedKazemi commented Mar 22, 2022

Many of M-Lab's Dockerfiles have a line like the following to include the git commit of the repo in the software they build:

RUN go get -v -ldflags "-X github.com/m-lab/go/prometheusx.GitShortCommit=$(git log -1 --format=%h)"  .

This has the undesired side-effect of pulling in the prometheusx package for software that has nothing to do with Prometheus. Moreover, creating an application that uses any package that includes prometheusx results in polluting the flags when printing its help message. Below is an example:

$ cat main.go
package main

import (
	"flag"
	"fmt"
	"github.com/m-lab/traceroute-caller/parser"
)

var someFlag = flag.Bool("f", false, "Some flag")

func main() {
	flag.Parse()
	fmt.Printf("%+v\n", parser.Scamper1{})
}
$ go build -o main .
$ ./main -h
Usage of ./main:
  -f	Some flag
  -prometheusx.listen-address string
    	 (default ":9990")
$
@SaiedKazemi
Copy link
Member Author

@stephen-soltesz FYI.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

1 participant