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

Remove the package name check #4

Closed
yeya24 opened this issue Jul 22, 2020 · 1 comment
Closed

Remove the package name check #4

yeya24 opened this issue Jul 22, 2020 · 1 comment

Comments

@yeya24
Copy link
Owner

yeya24 commented Jul 22, 2020

Current we are checking the package name of prometheus or promauto, actually this is not very necessary. We can just check the Method being called.

	for _, pkg := range file.Imports {
		switch pkg.Path.Value {
		case `"github.com/prometheus/client_golang/prometheus"`:
			if pkg.Name != nil {
				name = pkg.Name.Name
			} else {
				name = "prometheus"
			}

		case `"github.com/prometheus/client_golang/prometheus/promauto"`:
			if pkg.Name != nil {
				promautoName = pkg.Name.Name
			} else {
				promautoName = "promauto"
			}
		}
	}
@yeya24
Copy link
Owner Author

yeya24 commented Jul 22, 2020

This is done, close.

@yeya24 yeya24 closed this as completed Jul 22, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant