id
stringlengths
2
7
text
stringlengths
17
51.2k
title
stringclasses
1 value
c13800
c.ErrorWithExtras(level, err, noExtras) }
c13801
c.ErrorWithStackSkipWithExtras(level, fmt.Errorf(format, args...), 1, noExtras) }
c13802
map[string]interface{}) { c.ErrorWithStackSkipWithExtras(level, err, 1, extras) }
c13803
{ c.ErrorWithStackSkipWithExtrasAndContext(ctx, level, err, 1, extras) }
c13804
c.RequestErrorWithExtras(level, r, err, noExtras) }
c13805
c.RequestErrorWithStackSkipWithExtras(level, r, err, 1, extras) }
c13806
{ c.RequestErrorWithStackSkipWithExtrasAndContext(ctx, level, r, err, 1, extras) }
c13807
c.ErrorWithStackSkipWithExtras(level, err, skip, noExtras) }
c13808
c.ErrorWithStackSkipWithExtrasAndContext(context.TODO(), level, err, skip, extras) }
c13809
} body := c.buildBody(ctx, level, err.Error(), extras) addErrorToBody(c.configuration, body, err, skip) c.push(body) }
c13810
{ c.RequestErrorWithStackSkipWithExtras(level, r, err, skip, noExtras) }
c13811
{ c.RequestErrorWithStackSkipWithExtrasAndContext(context.TODO(), level, r, err, skip, extras) }
c13812
if !c.configuration.enabled { return } body := c.buildBody(ctx, level, err.Error(), extras) data := addErrorToBody(c.configuration, body, err, skip) data["request"] = c.requestDetails(r) c.push(body) }
c13813
map[string]interface{}) { c.MessageWithExtrasAndContext(context.TODO(), level, msg, extras) }
c13814
if !c.configuration.enabled { return } body := c.buildBody(ctx, level, msg, extras) data := body["data"].(map[string]interface{}) data["body"] = messageBody(msg) c.push(body) }
c13815
c.RequestMessageWithExtras(level, r, msg, noExtras) }
c13816
c.RequestMessageWithExtrasAndContext(context.TODO(), level, r, msg, extras) }
c13817
:= body["data"].(map[string]interface{}) data["body"] = messageBody(msg) data["request"] = c.requestDetails(r) c.push(body) }
c13818
context.WithValue(ctx, personKey, p) }
c13819
ok := ctx.Value(personKey).(*Person) return p, ok }
c13820
200 { rollbarError(logger, "received response: %s", resp.Status) // http.StatusTooManyRequests is only defined in Go 1.6+ so we use 429 directly isRateLimit := resp.StatusCode == 429 return ErrHTTPError(resp.StatusCode), isRateLimit } return nil, false }
c13821
// to send the payload back to the channel without this select statement we // could deadlock. Instead we consider this a retry failure. if transport.PrintPayloadOnError { writePayloadToStderr(transport.Logger, p.body) } transport.waitGroup.Done() } } else { if transport.Pr...
c13822
err := ErrBufferFull{} rollbarError(t.Logger, err.Error()) if t.PrintPayloadOnError { writePayloadToStderr(t.Logger, body) } return err } return nil }
c13823
close(t.bodyChannel) t.Wait() return nil }
c13824
} ref, err := i.solveVersion(repo) if err != nil { return err } if ref != "" { if err := i.setVersion(repo, ref); err != nil { return err } } if !isRig(repo.LocalPath()) { return rig.ErrDoesNotExist } return nil }
c13825
return repo.UpdateVersion(ref) }
c13826
{ return repo.Get() } return repo.Update() }
c13827
{ ver = fmt.Sprintf("%s+%s", ver, BuildMetadata) } return ver }
c13828
} } if _, pathErr := os.Stat(i.Path()); !os.IsNotExist(pathErr) { return i.Update() } return i.Install() }
c13829
return rig.ErrDoesNotExist } return i.Update() }
c13830
NewLocalInstaller(source, name, home) } return NewVCSInstaller(source, name, version, home) }
c13831
os.Stat(filepath.Join(dirname, "Food")) return err == nil }
c13832
fmt.Printf(fmt.Sprintf("==> %s", format), a...) }
c13833
fmt.Printf(emoji.Sprintf("!!! %s", format), a...) }
c13834
:= json.NewDecoder(r).Decode(&receipt) return &receipt, err }
c13835
err = w.Write(data) w.Write([]byte("\n")) return err }
c13836
} rigCmd, _, err := rootCmd.Find([]string{"rig", "add"}) if err != nil { return err } return rigCmd.RunE(rigCmd, addArgs) }
c13837
} if i.Name == "" { i.Name = filepath.Base(i.Source) } return i, nil }
c13838
} src, err := filepath.Abs(i.Source) if err != nil { return err } return i.link(src) }
c13839
!= nil { return err } dest, err := filepath.Abs(i.Path()) if err != nil { return err } return os.Symlink(origin, dest) }
c13840
f.Name, f.Version) os.Remove(filepath.Join(home.Home(home.HomePath).Barrel(), f.Name, receipt.ReceiptFilename)) return os.RemoveAll(barrelDir) }
c13841
if err := os.MkdirAll(filepath.Dir(destPath), 0755); err != nil && !os.IsExist(err) { return err } if r.Executable { if err := os.Chmod(filepath.Join(barrelDir, r.Path), 0755); err != nil { return err } } if err := os.Symlink(filepath.Join(barrelDir, r.Path), destPath); err != nil { return err ...
c13842
are about to remove is really owned by us if err := os.RemoveAll(filepath.Join(home.HomePrefix, r.InstallPath)); err != nil { return err } } return nil }
c13843
if err := f.DownloadTo(pkg, cachedFilePath); err != nil { errs = append(errs, err) } if err := checksumVerifyPath(cachedFilePath, pkg.SHA256); err != nil { errs = append(errs, fmt.Errorf("shasum verify check failed: %v", err)) } }(pkg) } wg.Wait() return }
c13844
log.Errorln(err) } } } if !success { return fmt.Errorf("failed to download package for OS/arch %s/%s with URL %s to filepath %s", pkg.OS, pkg.Arch, pkg.URL, filePath) } return nil }
c13845
err != nil { return err } defer resp.Body.Close() out, err := os.Create(filePath) if err != nil { return err } defer out.Close() _, err = io.Copy(out, resp.Body) return err }
c13846
return false, err } return boolFromInterface(val) }
c13847
return 0.0, err } return floatFromInterface(val) }
c13848
return 0, err } return intFromInterface(val) }
c13849
return "", err } return stringFromInterface(val) }
c13850
return map[string]interface{}{}, err } return objectFromInterface(val) }
c13851
toReturn[index], err = stringFromInterface(val) if err != nil { return toReturn, err } } return toReturn, nil }
c13852
err = intFromInterface(val) if err != nil { return toReturn, err } } return toReturn, nil }
c13853
toReturn[index], err = floatFromInterface(val) if err != nil { return toReturn, err } } return toReturn, nil }
c13854
err = boolFromInterface(val) if err != nil { return toReturn, err } } return toReturn, nil }
c13855
return nil, err } } switch val.(type) { case nil: return nil, fmt.Errorf("Nil value found at %s\n", s[len(s)-1]) } return val, nil }
c13856
&Error{} if err != nil { e.Store(err) } return e }
c13857
if v == nil { return nil } eh := v.(errorHolder) return eh.err }
c13858
:= &String{} if str != "" { s.Store(str) } return s }
c13859
if v == nil { return "" } return v.(string) }
c13860
atomic.AddInt32(&i.v, n) }
c13861
atomic.AddInt32(&i.v, -n) }
c13862
atomic.SwapInt32(&i.v, n) }
c13863
atomic.AddInt64(&i.v, n) }
c13864
atomic.AddInt64(&i.v, -n) }
c13865
atomic.SwapInt64(&i.v, n) }
c13866
atomic.AddUint32(&i.v, n) }
c13867
{ return atomic.AddUint32(&i.v, ^(n - 1)) }
c13868
atomic.SwapUint32(&i.v, n) }
c13869
atomic.AddUint64(&i.v, n) }
c13870
{ return atomic.AddUint64(&i.v, ^(n - 1)) }
c13871
atomic.SwapUint64(&i.v, n) }
c13872
return truthy(atomic.SwapUint32(&b.v, boolToInt(new))) }
c13873
if f.CAS(old, new) { return new } } }
c13874
{ return &Duration{v: *NewInt64(int64(d))} }
c13875
time.Duration(d.v.Add(int64(n))) }
c13876
time.Duration(d.v.Sub(int64(n))) }
c13877
time.Duration(d.v.Swap(int64(n))) }
c13878
make(map[string]*PoolClient, poolSize), SelectionHandler: SelectWithRate, } }
c13879
*Client client, err = New(net, addr) if err == nil { item = &PoolClient{Client: client, Rate: rate} pool.Clients[addr] = item } } return }
c13880
pool.mutex.Unlock() delete(pool.Clients, addr) }
c13881
status, err = client.Status(handle) } else { err = ErrNotFound } return }
c13882
err = ErrNotFound return } } client.Lock() defer client.Unlock() echo, err = client.Echo(data) return }
c13883
req.DataType) binary.BigEndian.PutUint32(data[8:12], uint32(l)) copy(data[minPacketLength:], req.Data) return }
c13884
{ return } client.rw = bufio.NewReadWriter(bufio.NewReader(client.conn), bufio.NewWriter(client.conn)) go client.readLoop() go client.processLoop() return }
c13885
if err != nil { client.err(err) } }) req := getRequest() req.DataType = dtGetStatus req.Data = []byte(handle) client.write(req) mutex.Lock() return }
c13886
worker, in: make(chan []byte, queueSize), } return }
c13887
return } dl := int(binary.BigEndian.Uint32(tmp[8:12])) // write what we read so far buf.Write(tmp[:n]) // read until we receive all the data for buf.Len() < dl+minPacketLength { if n, err = a.rw.Read(tmp); err != nil { return buf.Bytes(), err } buf.Write(tmp[:n]) } return buf.Bytes(), err }
c13888
for i := 0; i < len(buf); i += n { n, err = a.rw.Write(buf[i:]) if err != nil { return err } } return a.rw.Flush() }
c13889
defer a.Unlock() return a.write(outpack) }
c13890
hi := len(outpack.handle) + i copy(data[i:hi], []byte(outpack.handle)) if outpack.dataType != dtWorkFail { data[hi] = '\x00' } i = hi + 1 } if outpack.dataType != dtWorkFail { copy(data[i:], outpack.data) } return }
c13891
a error data: %v", data) return } err = fmt.Errorf("%s: %s", rel[0], rel[1]) return }
c13892
worker.ErrorHandler(e) } }
c13893
{ for _, v := range worker.agents { v.write(outpack) } }
c13894
{ return fmt.Errorf("The function does not exist: %s", funcname) } delete(worker.funcs, funcname) if worker.running { worker.removeFunc(funcname) } return }
c13895
true } inpack.a.Grab() case dtError: worker.err(inpack.Err()) fallthrough case dtEchoRes: fallthrough default: worker.customeHandler(inpack) } }
c13896
for _, a := range worker.agents { if err = a.Connect(); err != nil { return } } for funcname, f := range worker.funcs { worker.addFunc(funcname, f.timeout) } worker.ready = true return }
c13897
worker.running = true for _, a := range worker.agents { a.Grab() } var inpack *inPack for inpack = range worker.in { worker.handleInPack(inpack) } }
c13898
!= nil { if err := worker.JobHandler(inpack); err != nil { worker.err(err) } } }
c13899
true { for _, a := range worker.agents { a.Close() } worker.running = false close(worker.in) } }