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

Add implements assertion for cache #17131

Merged
merged 1 commit into from
Nov 13, 2015
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
2 changes: 2 additions & 0 deletions pkg/client/cache/store.go
Original file line number Diff line number Diff line change
Expand Up @@ -116,6 +116,8 @@ type cache struct {
keyFunc KeyFunc
}

var _ Store = &cache{}
Copy link
Member

Choose a reason for hiding this comment

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

I have an extremely minor preference for var _ = Store(&cache{})-- I think that's more common in our code base?

Copy link
Member Author

Choose a reason for hiding this comment

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

Hrm, I will do a quick, highly unscientific analysis

Copy link
Member Author

Choose a reason for hiding this comment

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

@lavalamp looks like your style is in the minority from this:

$ grep -nr 'var _ ' pkg/ | grep '(' | wc -l
36

★ pmorie:~/code/kubernetes (master) 
$ grep -nr 'var _ ' pkg/ | grep -v '(' | wc -l
113

Copy link
Member

Choose a reason for hiding this comment

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

hm, that leaves out var ( ... ) blocks, but it probably doesn't matter if
the difference is that big. Never mind, then.

On Wed, Nov 11, 2015 at 3:50 PM, Paul Morie notifications@github.com
wrote:

In pkg/client/cache/store.go
#17131 (comment)
:

@@ -116,6 +116,8 @@ type cache struct {
keyFunc KeyFunc
}

+var _ Store = &cache{}

@lavalamp https://github.com/lavalamp looks like your style is in the
minority from this:

$ grep -nr 'var _ ' pkg/ | grep '(' | wc -l
36

★ pmorie:~/code/kubernetes (master)
$ grep -nr 'var _ ' pkg/ | grep -v '(' | wc -l
113


Reply to this email directly or view it on GitHub
https://github.com/kubernetes/kubernetes/pull/17131/files#r44604621.


// Add inserts an item into the cache.
func (c *cache) Add(obj interface{}) error {
key, err := c.keyFunc(obj)
Expand Down