Thanks to visit codestin.com
Credit goes to github.com

Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 2 additions & 1 deletion Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -64,7 +64,8 @@ lint: .gopathok
@./.tool/lint

gofmt:
@./hack/verify-gofmt.sh
find . -name '*.go' ! -path './vendor/*' -exec gofmt -s -w {} \+
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Isn't this actually running gofmt on the code? If so, it won't display any issues in the code in a PR.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Isn't this actually running gofmt on the code?

Yes.

If so, it won't display any issues in the code in a PR.

Right. But the next line's git diff ... will show them (and return non-zero) if anything changed.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Doesn't quite work for me locally:

[mrunalp@localhost cri-o]$ git diff
diff --git a/server/container_create.go b/server/container_create.go
index 506bcf79..492d8eea 100644
--- a/server/container_create.go
+++ b/server/container_create.go
@@ -295,7 +295,7 @@ func addDevices(sb *sandbox.Sandbox, containerConfig *pb.ContainerConfig, specge
                                UID:   &hostDevice.Uid,
                                GID:   &hostDevice.Gid,
                        }
-                       if hostDevice.Major == 0 && hostDevice.Minor == 0 {
+                               if hostDevice.Major == 0 && hostDevice.Minor == 0 {
                                // Invalid device, most likely a symbolic link, skip it.
                                continue
                        }
[mrunalp@localhost cri-o]$ make gofmt
find . -name '*.go' ! -path './vendor/*' -exec gofmt -s -w {} \+
git diff --exit-code
[mrunalp@localhost cri-o]$ echo $?
0
[mrunalp@localhost cri-o]$ git diff
[mrunalp@localhost cri-o]$

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

nvm, I see the point. It would have shown the bad changes if present in the bad commit.

git diff --exit-code

conmon:
$(MAKE) -C $@
Expand Down
21 changes: 0 additions & 21 deletions hack/verify-gofmt.sh

This file was deleted.