{"action":"created","issue":{"url":"https://api.github.com/repos/shirou/gopsutil/issues/56","labels_url":"https://api.github.com/repos/shirou/gopsutil/issues/56/labels{/name}","comments_url":"https://api.github.com/repos/shirou/gopsutil/issues/56/comments","events_url":"https://api.github.com/repos/shirou/gopsutil/issues/56/events","html_url":"https://github.com/shirou/gopsutil/issues/56","id":95792703,"number":56,"title":"common.StringContains() is exactly equal compare, but used for \"contains\".","user":{"login":"gwind","id":98713,"avatar_url":"https://avatars.githubusercontent.com/u/98713?v=3","gravatar_id":"","url":"https://api.github.com/users/gwind","html_url":"https://github.com/gwind","followers_url":"https://api.github.com/users/gwind/followers","following_url":"https://api.github.com/users/gwind/following{/other_user}","gists_url":"https://api.github.com/users/gwind/gists{/gist_id}","starred_url":"https://api.github.com/users/gwind/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/gwind/subscriptions","organizations_url":"https://api.github.com/users/gwind/orgs","repos_url":"https://api.github.com/users/gwind/repos","events_url":"https://api.github.com/users/gwind/events{/privacy}","received_events_url":"https://api.github.com/users/gwind/received_events","type":"User","site_admin":false},"labels":[],"state":"open","locked":false,"assignee":null,"milestone":null,"comments":3,"created_at":"2015-07-18T06:01:41Z","updated_at":"2015-07-21T02:31:01Z","closed_at":null,"body":"For example: https://github.com/shirou/gopsutil/blob/master/host/host_linux.go#L340\r\n\r\nIn Linux:\r\n\r\n    $ grep kvm /proc/modules\r\n    kvm_intel 143109 6 - Live 0x0000000000000000\r\n    kvm 451552 1 kvm_intel, Live 0x0000000000000000\r\n\r\nin the following code to test contains would be fail:\r\n\r\n    contents, err := common.ReadLines(\"/proc/modules\")\r\n    common.StringContains(contents, \"kvm\")\r\n\r\nThe common.StringContains() is : \r\n\r\n    // Check the target string slice containes src or not\r\n    func StringContains(target []string, src string) bool {\r\n    \tfor _, t := range target {\r\n    \t\tif strings.TrimSpace(t) == src {\r\n    \t\t\treturn true\r\n    \t\t}\r\n    \t}\r\n    \treturn false\r\n    }\r\n\r\nThis is a common func in gopsutil, but it has a confused name. \"String\" can not display a \"string list\" mean, and \"Contains\" can not display a \"contain this sub str\" mean."},"comment":{"url":"https://api.github.com/repos/shirou/gopsutil/issues/comments/123131853","html_url":"https://github.com/shirou/gopsutil/issues/56#issuecomment-123131853","issue_url":"https://api.github.com/repos/shirou/gopsutil/issues/56","id":123131853,"user":{"login":"shirou","id":177213,"avatar_url":"https://avatars.githubusercontent.com/u/177213?v=3","gravatar_id":"","url":"https://api.github.com/users/shirou","html_url":"https://github.com/shirou","followers_url":"https://api.github.com/users/shirou/followers","following_url":"https://api.github.com/users/shirou/following{/other_user}","gists_url":"https://api.github.com/users/shirou/gists{/gist_id}","starred_url":"https://api.github.com/users/shirou/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/shirou/subscriptions","organizations_url":"https://api.github.com/users/shirou/orgs","repos_url":"https://api.github.com/users/shirou/repos","events_url":"https://api.github.com/users/shirou/events{/privacy}","received_events_url":"https://api.github.com/users/shirou/received_events","type":"User","site_admin":false},"created_at":"2015-07-21T02:31:01Z","updated_at":"2015-07-21T02:31:01Z","body":"Thank you for the suggestion!\r\n\r\ngolang has the method called [strings.Contains](http://golang.org/pkg/strings/#Contains) to check strings has the substr or not.\r\n\r\nIf I change your `StringsFind` to use `strings.Contains`,  changing the name to `StringsContains`  is acceptable? \r\n\r\nSorry for annoying you. But I can not understand well such a nuances. Really."}}