-
Notifications
You must be signed in to change notification settings - Fork 642
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
add fmt and vet make target #53
add fmt and vet make target #53
Conversation
@Random-Liu PTAL. |
@andyxning Seems like something wrong with the rebase. :) |
8e03f63
to
51609be
Compare
@andyxning There are still 2 duplicated commits. :) |
51609be
to
0e2e5c0
Compare
@Random-Liu Done Again. :) |
@@ -9,7 +9,13 @@ PROJ = google_containers | |||
|
|||
PKG_SOURCES := $(shell find pkg -name '*.go') | |||
|
|||
node-problem-detector: $(PKG_SOURCES) node_problem_detector.go | |||
vet: | |||
go list ./... | grep -v "./vendor*" | xargs go vet |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This seems a little weird to me although it works for now.
go list is listing packages, while grep -v "./vendor*"
seems to assume that it is listing files.
In the future, if there is a package called "abc/vendorefg", it will also be excluded.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@Random-Liu Just like next comment, we can change grep -v "./vendor*"
to grep -v "./vendor/*"
to minimize the impact.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Just to make sure, do you expect .
to match a dot or matching anything?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
What .
means is that it means anything prefixing vendor directory. Because we run go list ./...
in the root directory, it output something like this
k8s.io/node-problem-detector
k8s.io/node-problem-detector/pkg/condition
k8s.io/node-problem-detector/pkg/kernelmonitor
k8s.io/node-problem-detector/pkg/kernelmonitor/translator
k8s.io/node-problem-detector/pkg/kernelmonitor/types
k8s.io/node-problem-detector/pkg/kernelmonitor/util
k8s.io/node-problem-detector/pkg/problemclient
k8s.io/node-problem-detector/pkg/problemdetector
k8s.io/node-problem-detector/pkg/types
k8s.io/node-problem-detector/pkg/util
k8s.io/node-problem-detector/pkg/util/nethealth
k8s.io/node-problem-detector/vendor/code.cloudfoundry.org/clock
k8s.io/node-problem-detector/vendor/code.cloudfoundry.org/clock/fakeclock
k8s.io/node-problem-detector/vendor/github.com/blang/semver
k8s.io/node-problem-detector/vendor/github.com/coreos/go-oidc/http
What i mean is to match.*/vendor/.*
in Golang regexp expression.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@andyxning Yeah, I think you should be assuming to match everything.
go list ./... | grep -v "./vendor*" | xargs go vet | ||
|
||
fmt: | ||
find . -type f -name "*.go" | grep -v "./vendor*" | xargs gofmt -s -w |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
How about `grep -v "./vendor/*" to make it less ambiguous.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
How about -l
to also list bad files?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@Random-Liu Agree to add -l
to list bad files. Done.
0e2e5c0
to
bb48848
Compare
LGTM. And could you help me review this #56? |
Add
fmt
andvet
make target. And, addfmt
andvet
dependencies fornode-problem-detector
target.This change is![Reviewable](https://camo.githubusercontent.com/bdad2d5a4be7a00dc3b2426ea57eabd73ef84d8ed5ee05653b2f1501b6ea93ab/68747470733a2f2f72657669657761626c652e6b756265726e657465732e696f2f7265766965775f627574746f6e2e737667)