mirror of
https://github.com/weaveworks/scope.git
synced 2026-03-03 02:00:43 +00:00
Fix errcheck errors in probe
This commit is contained in:
@@ -53,7 +53,7 @@ func main() {
|
||||
log.Printf("exposing Prometheus endpoint at %s%s", *httpListen, *prometheusEndpoint)
|
||||
http.Handle(*prometheusEndpoint, makePrometheusHandler())
|
||||
}
|
||||
go http.ListenAndServe(*httpListen, nil)
|
||||
go func(err error) { log.Print(err) }(http.ListenAndServe(*httpListen, nil))
|
||||
}
|
||||
|
||||
if *spyProcs && os.Getegid() != 0 {
|
||||
|
||||
@@ -17,7 +17,7 @@ func TestCgroupMapper(t *testing.T) {
|
||||
"/netscape/notify_on_release": "0\n",
|
||||
"/weirdfile": "",
|
||||
})
|
||||
defer os.RemoveAll(tmp)
|
||||
defer removeAll(t, tmp)
|
||||
|
||||
m := newCgroupMapper(tmp, 1*time.Second)
|
||||
for pid, want := range map[uint]string{
|
||||
@@ -44,14 +44,20 @@ func setupTmpFS(t *testing.T, fs map[string]string) string {
|
||||
for file, content := range fs {
|
||||
dir := path.Dir(file)
|
||||
if err := os.MkdirAll(filepath.Join(tmp, dir), 0777); err != nil {
|
||||
os.RemoveAll(tmp)
|
||||
removeAll(t, tmp)
|
||||
t.Fatalf("MkdirAll: %v", err)
|
||||
}
|
||||
|
||||
if err := ioutil.WriteFile(filepath.Join(tmp, file), []byte(content), 0655); err != nil {
|
||||
os.RemoveAll(tmp)
|
||||
removeAll(t, tmp)
|
||||
t.Fatalf("WriteFile: %v", err)
|
||||
}
|
||||
}
|
||||
return tmp
|
||||
}
|
||||
|
||||
func removeAll(t *testing.T, path string) {
|
||||
if err := os.RemoveAll(path); err != nil {
|
||||
t.Error(err)
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user