177 Type: "some-resource-type",
178 },
179 }
180 bytes, err := json.Marshal(publicPlan) 181 jr := json.RawMessage(bytes)
182 resourceConfigScope.UpdateLastCheckStartTime(99, &jr)
183 resourceConfigScope.UpdateLastCheckEndTime(false)
463 ts := httptest.NewUnstartedServer(http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) {
464 fmt.Fprintln(w, "Hello, client")
465 }))
466 l, err := net.Listen("tcp", hostIp.String()+":0") 467 ts.Listener = l
468 ts.Start()
469 defer ts.Close()
371 ts := httptest.NewUnstartedServer(http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) {
372 fmt.Fprintln(w, "Hello, client")
373 }))
374 l, err := net.Listen("tcp", hostIp.String()+":0") 375 ts.Listener = l
376 ts.Start()
377 defer ts.Close()
90
91 updateFilePath := filepath.Join(childLive.DataPath(), "updated-file")
92
93 content, err := os.ReadFile(updateFilePath) 94 Expect(string(content)).To(Equal(fmt.Sprintf("depth-%d", depth-1)))
95
96 err = os.WriteFile(updateFilePath, []byte(fmt.Sprintf("depth-%d", depth)), 0644)
530func (vs *VolumeServer) StreamOut(w http.ResponseWriter, req *http.Request) {
531 handle := rata.Param(req, "handle")
532
533 ctx := tracing.Extract(req.Context(), propagation.HeaderCarrier(req.Header))534 hLog := vs.logger.Session("stream-out", lager.Data{
535 "volume": handle,
536 })
Value has been assigned to a variable, but it is being overwritten before being read. In most cases, this could be a forgotten error check or dead code.
err := Op1()
// error value assigned to "err" by "Op1" is replaced with
// error value assigned by "Op2" before even being read even
// once
err = Op2()
if err != nil {
return err
}
// Ignore the error value returned by "Op1"
Op1()
err := Op2()
if err != nil {
return err
}
err := Op1()
// Read the error value assigned to "err" by "Op1"
if err != nil {
return err
}
err = Op2()
if err != nil {
return err
}