_id
stringlengths
86
170
text
stringlengths
54
39.3k
https://github.com/iron-io/functions_go/blob/91b84f5bbb17095bf1c7028ec6e70a3dc06a5893/client/tasks/tasks_client.go#L32-L55
func (a *Client) GetTasks(params *GetTasksParams) (*GetTasksOK, error) { // TODO: Validate the params before sending if params == nil { params = NewGetTasksParams() } result, err := a.transport.Submit(&runtime.ClientOperation{ ID: "GetTasks", Method: "GET", PathPattern: "/tasks", ProducesMediaTypes: []string{"application/json"}, ConsumesMediaTypes: []string{"application/json"}, Schemes: []string{"http", "https"}, Params: params, Reader: &GetTasksReader{formats: a.formats}, Context: params.Context, Client: params.HTTPClient, }) if err != nil { return nil, err } return result.(*GetTasksOK), nil }
https://github.com/pachyderm/pachyderm/blob/94fb2d536cb6852a77a49e8f777dc9c1bde2c723/src/server/pkg/obj/tracing.go#L58-L63
func (o *tracingObjClient) Exists(ctx context.Context, name string) bool { span, ctx := tracing.AddSpanToAnyExisting(ctx, o.provider+".Exists", "name", name) defer tracing.FinishAnySpan(span) return o.Client.Exists(ctx, name) }
https://github.com/golang/appengine/blob/54a98f90d1c46b7731eb8fb305d2a321c30ef610/memcache/memcache.go#L416-L418
func (cd Codec) Add(c context.Context, item *Item) error { return singleError(cd.set(c, []*Item{item}, pb.MemcacheSetRequest_ADD)) }
https://github.com/chromedp/cdproto/blob/d40c70bcdf242660a32f2eadf323662dd75378b5/animation/easyjson.go#L1000-L1004
func (v *GetPlaybackRateParams) UnmarshalJSON(data []byte) error { r := jlexer.Lexer{Data: data} easyjsonC5a4559bDecodeGithubComChromedpCdprotoAnimation10(&r, v) return r.Error() }
https://github.com/Diggs/go-backoff/blob/f7b9f7e6b83be485b2e1b3eebba36652c6c4cd8a/backoff.go#L67-L69
func NewExponential(start time.Duration, limit time.Duration) *Backoff { return NewBackoff(exponential{}, start, limit) }
https://github.com/jpillora/overseer/blob/ce9055846616cf7e1ab91bb8a0bcbb1d7fa3d11a/overseer.go#L113-L125
func sanityCheck() bool { //sanity check if token := os.Getenv(envBinCheck); token != "" { fmt.Fprint(os.Stdout, token) return true } //legacy sanity check using old env var if token := os.Getenv(envBinCheckLegacy); token != "" { fmt.Fprint(os.Stdout, token) return true } return false }
https://github.com/coryb/figtree/blob/e5fa026ccd54e0a6a99b6d81f73bfcc8e6fe6a6b/gen-rawoption.go#L2986-L2991
func (o *ListRuneOption) Set(value string) error { val := RuneOption{} val.Set(value) *o = append(*o, val) return nil }
https://github.com/pachyderm/pachyderm/blob/94fb2d536cb6852a77a49e8f777dc9c1bde2c723/src/server/pkg/hashtree/db.go#L464-L499
func (h *dbHashTree) Diff(oldHashTree HashTree, newPath string, oldPath string, recursiveDepth int64, f func(path string, node *NodeProto, new bool) error) (retErr error) { // Setup a txn for each hashtree, this is a bit complicated because we don't want to make 2 read tx to the same tree, if we did then should someone start a write tx inbetween them we would have a deadlock old := oldHashTree.(*dbHashTree) if old == nil { return fmt.Errorf("unrecognized HashTree type") } rollback := func(tx *bolt.Tx) { if err := tx.Rollback(); err != nil && retErr == nil { retErr = err } } var newTx *bolt.Tx var oldTx *bolt.Tx if h == oldHashTree { tx, err := h.Begin(false) if err != nil { return err } newTx = tx oldTx = tx defer rollback(tx) } else { var err error newTx, err = h.Begin(false) if err != nil { return err } defer rollback(newTx) oldTx, err = old.Begin(false) if err != nil { return err } defer rollback(oldTx) } return diff(newTx, oldTx, newPath, oldPath, recursiveDepth, f) }
https://github.com/malice-plugins/go-plugin-utils/blob/9ee76663c3b0a531b8c529f03f12a5a84ff9b61b/clitable/table.go#L84-L105
func (t *Table) AddRow(row map[string]interface{}) { newRow := make(map[string]string) for _, k := range t.Fields { v := row[k] // If is not nil format // else value is empty string var val string if v == nil { val = "" } else { val = fmt.Sprintf("%v", v) } newRow[k] = val } t.calculateSizes(newRow) if len(newRow) > 0 { t.Rows = append(t.Rows, newRow) } }
https://github.com/jmank88/nuts/blob/8b28145dffc87104e66d074f62ea8080edfad7c8/key.go#L5-L20
func KeyLen(x uint64) int { n := 1 if x >= 1<<32 { x >>= 32 n += 4 } if x >= 1<<16 { x >>= 16 n += 2 } if x >= 1<<8 { x >>= 8 n += 1 } return n }
https://github.com/rightscale/rsc/blob/96079a1ee7238dae9cbb7efa77dd94a479d217bd/rsapi/auth.go#L119-L155
func (s *cookieSigner) Sign(req *http.Request) error { if time.Now().After(s.refreshAt) { authReq, authErr := s.builder.BuildLoginRequest(s.host) if authErr != nil { return authErr } resp, err := s.client.DoHidden(authReq) if err != nil { return err } url, err := extractRedirectURL(resp) if err != nil { return err } if url != nil { authReq, authErr = s.builder.BuildLoginRequest(url.Host) if authErr != nil { return authErr } s.host = url.Host req.Host = url.Host req.URL.Host = url.Host resp, err = s.client.DoHidden(authReq) } if err != nil { return fmt.Errorf("Authentication failed: %s", err) } if err := s.refresh(resp); err != nil { return err } } for _, c := range s.cookies { req.AddCookie(c) } req.Header.Set("X-Account", strconv.Itoa(s.accountID)) return nil }
https://github.com/jpillora/velox/blob/42845d32322027cde41ba6b065a083ea4120238f/go/state.go#L157-L210
func (s *State) gopush() { s.push.mut.Lock() t0 := time.Now() //queue cleanup defer func() { //measure time passed, ensure we wait at least Throttle time tdelta := time.Now().Sub(t0) if t := s.Throttle - tdelta; t > 0 { time.Sleep(t) } //push complete s.push.mut.Unlock() atomic.StoreUint32(&s.push.ing, 0) //if queued, auto-push again if atomic.CompareAndSwapUint32(&s.push.queued, 1, 0) { s.Push() } }() //calculate new json state l, hasLock := s.gostruct.(sync.Locker) if hasLock { l.Lock() } newBytes, err := json.Marshal(s.gostruct) if hasLock { l.Unlock() } if err != nil { log.Printf("velox: marshal failed: %s", err) return } //if changed, then calculate change set if !bytes.Equal(s.data.bytes, newBytes) { //calculate change set from last version ops, _ := jsonpatch.CreatePatch(s.data.bytes, newBytes) if len(s.data.bytes) > 0 && len(ops) > 0 { //changes! bump version s.data.mut.Lock() s.data.delta, _ = json.Marshal(ops) s.data.bytes = newBytes s.data.version++ s.data.mut.Unlock() } } //send this new change to each subscriber s.connMut.Lock() for _, c := range s.conns { if c.version != s.data.version { go c.push() } } s.connMut.Unlock() //defered cleanup() }
https://github.com/pachyderm/pachyderm/blob/94fb2d536cb6852a77a49e8f777dc9c1bde2c723/src/client/pfs.go#L1068-L1084
func (c APIClient) GetFileReadSeeker(repoName string, commitID string, path string) (io.ReadSeeker, error) { fileInfo, err := c.InspectFile(repoName, commitID, path) if err != nil { return nil, err } reader, err := c.GetFileReader(repoName, commitID, path, 0, 0) if err != nil { return nil, err } return &getFileReadSeeker{ Reader: reader, file: NewFile(repoName, commitID, path), offset: 0, size: int64(fileInfo.SizeBytes), c: c, }, nil }
https://github.com/uber/tchannel-go/blob/3c9ced6d946fe2fec6c915703a533e966c09e07a/peer.go#L514-L531
func (p *Peer) connectionCloseStateChange(changed *Connection) { if changed.IsActive() { return } p.Lock() found := p.removeConnection(&p.inboundConnections, changed) if !found { found = p.removeConnection(&p.outboundConnections, changed) } p.Unlock() if found { p.onClosedConnRemoved(p) // Inform third parties that a peer lost a connection. p.onStatusChanged(p) } }
https://github.com/tsuru/tsuru/blob/2f7fd515c5dc25a58aec80f0e497c49e49581b3e/api/router.go#L85-L134
func addAppRouter(w http.ResponseWriter, r *http.Request, t auth.Token) (err error) { var appRouter appTypes.AppRouter err = ParseInput(r, &appRouter) if err != nil { return err } appName := r.URL.Query().Get(":app") a, err := getAppFromContext(appName, r) if err != nil { return err } _, err = router.Get(appRouter.Name) if err != nil { if _, isNotFound := err.(*router.ErrRouterNotFound); isNotFound { return &errors.HTTP{Code: http.StatusNotFound, Message: err.Error()} } return err } allowed := permission.Check(t, permission.PermAppUpdateRouterAdd, contextsForApp(&a)..., ) if !allowed { return permission.ErrUnauthorized } p, err := pool.GetPoolByName(a.Pool) if err != nil { return err } err = p.ValidateRouters([]appTypes.AppRouter{appRouter}) if err != nil { if err == pool.ErrPoolHasNoRouter { return &errors.HTTP{Code: http.StatusBadRequest, Message: err.Error()} } return err } evt, err := event.New(&event.Opts{ Target: appTarget(appName), Kind: permission.PermAppUpdateRouterAdd, Owner: t, CustomData: event.FormToCustomData(InputFields(r)), Allowed: event.Allowed(permission.PermAppReadEvents, contextsForApp(&a)...), }) if err != nil { return err } defer func() { evt.Done(err) }() return a.AddRouter(appRouter) }
https://github.com/janos/web/blob/0fb0203103deb84424510a8d5166ac00700f2b0e/servers/quic/quic.go#L61-L64
func (s *Server) ServeUDP(conn *net.UDPConn) (err error) { s.Server.Server.Addr = conn.LocalAddr().String() return s.Server.Serve(conn) }
https://github.com/gobuffalo/buffalo/blob/7f360181f4ccd79dcc9dcea2c904a4801f194f04/render/plain.go#L20-L27
func (e *Engine) Plain(names ...string) Renderer { hr := &templateRenderer{ Engine: e, contentType: "text/plain; charset=utf-8", names: names, } return hr }
https://github.com/pachyderm/pachyderm/blob/94fb2d536cb6852a77a49e8f777dc9c1bde2c723/src/client/pkg/require/require.go#L409-L414
func False(tb testing.TB, value bool, msgAndArgs ...interface{}) { tb.Helper() if value { fatal(tb, msgAndArgs, "Should be false.") } }
https://github.com/chromedp/cdproto/blob/d40c70bcdf242660a32f2eadf323662dd75378b5/network/easyjson.go#L4325-L4329
func (v GetResponseBodyForInterceptionParams) MarshalJSON() ([]byte, error) { w := jwriter.Writer{} easyjsonC5a4559bEncodeGithubComChromedpCdprotoNetwork31(&w, v) return w.Buffer.BuildBytes(), w.Error }
https://github.com/pachyderm/pachyderm/blob/94fb2d536cb6852a77a49e8f777dc9c1bde2c723/src/server/pkg/collection/collection.go#L612-L614
func (c *readonlyCollection) Watch(opts ...watch.OpOption) (watch.Watcher, error) { return watch.NewWatcher(c.ctx, c.etcdClient, c.prefix, c.prefix, c.template, opts...) }
https://github.com/chromedp/cdproto/blob/d40c70bcdf242660a32f2eadf323662dd75378b5/domstorage/easyjson.go#L428-L432
func (v *GetDOMStorageItemsReturns) UnmarshalJSON(data []byte) error { r := jlexer.Lexer{Data: data} easyjsonC5a4559bDecodeGithubComChromedpCdprotoDomstorage3(&r, v) return r.Error() }
https://github.com/uber/tchannel-go/blob/3c9ced6d946fe2fec6c915703a533e966c09e07a/connection.go#L739-L748
func (c *Connection) hasPendingCalls() bool { if c.inbound.count() > 0 || c.outbound.count() > 0 { return true } if !c.relay.canClose() { return true } return false }
https://github.com/pachyderm/pachyderm/blob/94fb2d536cb6852a77a49e8f777dc9c1bde2c723/src/server/pps/hash.go#L22-L24
func (s *Hasher) HashJob(jobID string) uint64 { return uint64(adler32.Checksum([]byte(jobID))) % s.JobModulus }
https://github.com/mrd0ll4r/tbotapi/blob/edc257282178bb5cebbfcc41260ec04c1ec7ac19/outgoing.go#L263-L270
func (om *OutgoingMessage) SetMarkdown(to bool) *OutgoingMessage { if to { om.ParseMode = ModeMarkdown } else { om.ParseMode = ModeDefault } return om }
https://github.com/HiLittleCat/core/blob/ae2101184ecd36354d3fcff0ea69d67d3fdbe156/context.go#L168-L170
func (ctx *Context) Param(key string) string { return ctx.Params.ByName(key) }
https://github.com/pivotal-pez/pezdispenser/blob/768e2777520868857916b66cfd4cfb7149383ca5/taskmanager/agent.go#L9-L18
func NewAgent(t TaskManagerInterface, callerName string) *Agent { return &Agent{ killTaskPoller: make(chan bool, 1), processComplete: make(chan bool, 1), taskPollEmitter: make(chan bool, 1), statusEmitter: make(chan string, 1), taskManager: t, task: t.NewTask(callerName, TaskAgentLongRunning, AgentTaskStatusInitializing), } }
https://github.com/lxc/lxd/blob/7a41d14e4c1a6bc25918aca91004d594774dcdd3/client/lxd_images.go#L276-L286
func (r *ProtocolLXD) GetImageAliases() ([]api.ImageAliasesEntry, error) { aliases := []api.ImageAliasesEntry{} // Fetch the raw value _, err := r.queryStruct("GET", "/images/aliases?recursion=1", nil, "", &aliases) if err != nil { return nil, err } return aliases, nil }
https://github.com/containers/image/blob/da9ab3561ad2031aeb5e036b7cf2755d4e246fec/copy/copy.go#L711-L739
func (ic *imageCopier) copyLayerFromStream(ctx context.Context, srcStream io.Reader, srcInfo types.BlobInfo, diffIDIsNeeded bool, bar *mpb.Bar) (types.BlobInfo, <-chan diffIDResult, error) { var getDiffIDRecorder func(compression.DecompressorFunc) io.Writer // = nil var diffIDChan chan diffIDResult err := errors.New("Internal error: unexpected panic in copyLayer") // For pipeWriter.CloseWithError below if diffIDIsNeeded { diffIDChan = make(chan diffIDResult, 1) // Buffered, so that sending a value after this or our caller has failed and exited does not block. pipeReader, pipeWriter := io.Pipe() defer func() { // Note that this is not the same as {defer pipeWriter.CloseWithError(err)}; we need err to be evaluated lazily. pipeWriter.CloseWithError(err) // CloseWithError(nil) is equivalent to Close() }() getDiffIDRecorder = func(decompressor compression.DecompressorFunc) io.Writer { // If this fails, e.g. because we have exited and due to pipeWriter.CloseWithError() above further // reading from the pipe has failed, we don’t really care. // We only read from diffIDChan if the rest of the flow has succeeded, and when we do read from it, // the return value includes an error indication, which we do check. // // If this gets never called, pipeReader will not be used anywhere, but pipeWriter will only be // closed above, so we are happy enough with both pipeReader and pipeWriter to just get collected by GC. go diffIDComputationGoroutine(diffIDChan, pipeReader, decompressor) // Closes pipeReader return pipeWriter } } blobInfo, err := ic.c.copyBlobFromStream(ctx, srcStream, srcInfo, getDiffIDRecorder, ic.canModifyManifest, false, bar) // Sets err to nil on success return blobInfo, diffIDChan, err // We need the defer … pipeWriter.CloseWithError() to happen HERE so that the caller can block on reading from diffIDChan }
https://github.com/sclevine/agouti/blob/96599c91888f1b1cf2dccc7f1776ba7f511909e5/selectable.go#L120-L122
func (s *selectable) FirstByLink(text string) *Selection { return newSelection(s.session, s.selectors.Append(target.Link, text).At(0)) }
https://github.com/kubernetes/test-infra/blob/8125fbda10178887be5dff9e901d6a0a519b67bc/prow/external-plugins/needs-rebase/plugin/plugin.go#L71-L96
func HandleEvent(log *logrus.Entry, ghc githubClient, pre *github.PullRequestEvent) error { if pre.Action != github.PullRequestActionOpened && pre.Action != github.PullRequestActionSynchronize && pre.Action != github.PullRequestActionReopened { return nil } // Before checking mergeability wait a few seconds to give github a chance to calculate it. // This initial delay prevents us from always wasting the first API token. sleep(time.Second * 5) org := pre.Repo.Owner.Login repo := pre.Repo.Name number := pre.Number sha := pre.PullRequest.Head.SHA mergeable, err := ghc.IsMergeable(org, repo, number, sha) if err != nil { return err } issueLabels, err := ghc.GetIssueLabels(org, repo, number) if err != nil { return err } hasLabel := github.HasLabel(labels.NeedsRebase, issueLabels) return takeAction(log, ghc, org, repo, number, pre.PullRequest.User.Login, hasLabel, mergeable) }
https://github.com/chromedp/cdproto/blob/d40c70bcdf242660a32f2eadf323662dd75378b5/css/easyjson.go#L5287-L5291
func (v *GetComputedStyleForNodeParams) UnmarshalJSON(data []byte) error { r := jlexer.Lexer{Data: data} easyjsonC5a4559bDecodeGithubComChromedpCdprotoCss46(&r, v) return r.Error() }
https://github.com/chromedp/cdproto/blob/d40c70bcdf242660a32f2eadf323662dd75378b5/cdp/types.go#L104-L106
func (t *NodeID) UnmarshalJSON(buf []byte) error { return easyjson.Unmarshal(buf, t) }
https://github.com/containers/image/blob/da9ab3561ad2031aeb5e036b7cf2755d4e246fec/docker/daemon/daemon_transport.go#L149-L173
func (ref daemonReference) PolicyConfigurationIdentity() string { // We must allow referring to images in the daemon by image ID, otherwise untagged images would not be accessible. // But the existence of image IDs means that we can’t truly well namespace the input: // a single image can be namespaced either using the name or the ID depending on how it is named. // // That’s fairly unexpected, but we have to cope somehow. // // So, use the ordinary docker/policyconfiguration namespacing for named images. // image IDs all fall into the root namespace. // Users can set up the root namespace to be either untrusted or rejected, // and to set up specific trust for named namespaces. This allows verifying image // identity when a name is known, and unnamed images would be untrusted or rejected. switch { case ref.id != "": return "" // This still allows using the default "" scope to define a global policy for ID-identified images. case ref.ref != nil: res, err := policyconfiguration.DockerReferenceIdentity(ref.ref) if res == "" || err != nil { // Coverage: Should never happen, NewReference above should refuse values which could cause a failure. panic(fmt.Sprintf("Internal inconsistency: policyconfiguration.DockerReferenceIdentity returned %#v, %v", res, err)) } return res default: // Coverage: Should never happen, NewReference above should refuse such values. panic("Internal inconsistency: daemonReference has empty id and nil ref") } }
https://github.com/uber/tchannel-go/blob/3c9ced6d946fe2fec6c915703a533e966c09e07a/thrift/client.go#L46-L56
func NewClient(ch *tchannel.Channel, serviceName string, opts *ClientOptions) TChanClient { client := &client{ ch: ch, sc: ch.GetSubChannel(serviceName), serviceName: serviceName, } if opts != nil { client.opts = *opts } return client }
https://github.com/chromedp/cdproto/blob/d40c70bcdf242660a32f2eadf323662dd75378b5/animation/easyjson.go#L106-L110
func (v *SetTimingParams) UnmarshalJSON(data []byte) error { r := jlexer.Lexer{Data: data} easyjsonC5a4559bDecodeGithubComChromedpCdprotoAnimation(&r, v) return r.Error() }
https://github.com/weaveworks/mesh/blob/512bdb7b3cb7b2c939fcd0ee434d48b6732ecc39/gossip_channel.go#L20-L28
func newGossipChannel(channelName string, ourself *localPeer, r *routes, g Gossiper, logger Logger) *gossipChannel { return &gossipChannel{ name: channelName, ourself: ourself, routes: r, gossiper: g, logger: logger, } }
https://github.com/armon/go-radix/blob/1a2de0c21c94309923825da3df33a4381872c795/radix.go#L349-L375
func (t *Tree) Get(s string) (interface{}, bool) { n := t.root search := s for { // Check for key exhaution if len(search) == 0 { if n.isLeaf() { return n.leaf.val, true } break } // Look for an edge n = n.getEdge(search[0]) if n == nil { break } // Consume the search prefix if strings.HasPrefix(search, n.prefix) { search = search[len(n.prefix):] } else { break } } return nil, false }
https://github.com/pachyderm/pachyderm/blob/94fb2d536cb6852a77a49e8f777dc9c1bde2c723/src/server/pps/pretty/pretty.go#L246-L252
func PrintDatumInfo(w io.Writer, datumInfo *ppsclient.DatumInfo) { totalTime := "-" if datumInfo.Stats != nil { totalTime = units.HumanDuration(client.GetDatumTotalTime(datumInfo.Stats)) } fmt.Fprintf(w, "%s\t%s\t%s\n", datumInfo.Datum.ID, datumState(datumInfo.State), totalTime) }
https://github.com/kubernetes/test-infra/blob/8125fbda10178887be5dff9e901d6a0a519b67bc/greenhouse/diskcache/cache.go#L191-L193
func (c *Cache) Delete(key string) error { return os.Remove(c.KeyToPath(key)) }
https://github.com/dgraph-io/badger/blob/6b796b3ebec3ff006fcb1b425836cd784651e9fd/skl/skl.go#L436-L439
func (s *Iterator) Prev() { y.AssertTrue(s.Valid()) s.n, _ = s.list.findNear(s.Key(), true, false) // find <. No equality allowed. }
https://github.com/kubernetes/test-infra/blob/8125fbda10178887be5dff9e901d6a0a519b67bc/prow/cmd/peribolos/main.go#L686-L697
func updateString(have, want *string) bool { switch { case have == nil: panic("have must be non-nil") case want == nil: return false // do not care what we have case *have == *want: return false // already have it } *have = *want // update value return true }
https://github.com/etcd-io/etcd/blob/616592d9ba993e3fe9798eef581316016df98906/etcdctl/ctlv3/command/make_mirror_command.go#L44-L61
func NewMakeMirrorCommand() *cobra.Command { c := &cobra.Command{ Use: "make-mirror [options] <destination>", Short: "Makes a mirror at the destination etcd cluster", Run: makeMirrorCommandFunc, } c.Flags().StringVar(&mmprefix, "prefix", "", "Key-value prefix to mirror") c.Flags().StringVar(&mmdestprefix, "dest-prefix", "", "destination prefix to mirror a prefix to a different prefix in the destination cluster") c.Flags().BoolVar(&mmnodestprefix, "no-dest-prefix", false, "mirror key-values to the root of the destination cluster") c.Flags().StringVar(&mmcert, "dest-cert", "", "Identify secure client using this TLS certificate file for the destination cluster") c.Flags().StringVar(&mmkey, "dest-key", "", "Identify secure client using this TLS key file") c.Flags().StringVar(&mmcacert, "dest-cacert", "", "Verify certificates of TLS enabled secure servers using this CA bundle") // TODO: secure by default when etcd enables secure gRPC by default. c.Flags().BoolVar(&mminsecureTr, "dest-insecure-transport", true, "Disable transport security for client connections") return c }
https://github.com/hashicorp/raft/blob/773bcaa2009bf059c5c06457b9fccd156d5e91e7/net_transport.go#L388-L411
func (n *NetworkTransport) genericRPC(id ServerID, target ServerAddress, rpcType uint8, args interface{}, resp interface{}) error { // Get a conn conn, err := n.getConnFromAddressProvider(id, target) if err != nil { return err } // Set a deadline if n.timeout > 0 { conn.conn.SetDeadline(time.Now().Add(n.timeout)) } // Send the RPC if err = sendRPC(conn, rpcType, args); err != nil { return err } // Decode the response canReturn, err := decodeResponse(conn, resp) if canReturn { n.returnConn(conn) } return err }
https://github.com/chromedp/cdproto/blob/d40c70bcdf242660a32f2eadf323662dd75378b5/debugger/debugger.go#L973-L976
func (p StepIntoParams) WithBreakOnAsyncCall(breakOnAsyncCall bool) *StepIntoParams { p.BreakOnAsyncCall = breakOnAsyncCall return &p }
https://github.com/lxc/lxd/blob/7a41d14e4c1a6bc25918aca91004d594774dcdd3/shared/generate/db/stmt.go#L541-L547
func (s *Stmt) register(buf *file.Buffer, sql string, filters ...string) { kind := strings.Replace(s.kind, "-", "_", -1) if kind == "id" { kind = "ID" // silence go lints } buf.L("var %s = %s.RegisterStmt(`\n%s\n`)", stmtCodeVar(s.entity, kind, filters...), s.db, sql) }
https://github.com/pachyderm/pachyderm/blob/94fb2d536cb6852a77a49e8f777dc9c1bde2c723/src/server/pkg/collection/collection.go#L482-L487
func (c *readonlyCollection) get(key string, opts ...etcd.OpOption) (*etcd.GetResponse, error) { span, ctx := tracing.AddSpanToAnyExisting(c.ctx, "etcd.Get") defer tracing.FinishAnySpan(span) resp, err := c.etcdClient.Get(ctx, key, opts...) return resp, err }
https://github.com/tendermint/go-amino/blob/dc14acf9ef15f85828bfbc561ed9dd9d2a284885/amino.go#L321-L352
func (cdc *Codec) UnmarshalBinaryBare(bz []byte, ptr interface{}) error { rv := reflect.ValueOf(ptr) if rv.Kind() != reflect.Ptr { panic("Unmarshal expects a pointer") } rv = rv.Elem() rt := rv.Type() info, err := cdc.getTypeInfo_wlock(rt) if err != nil { return err } // If registered concrete, consume and verify prefix bytes. if info.Registered { pb := info.Prefix.Bytes() if len(bz) < 4 { return fmt.Errorf("UnmarshalBinaryBare expected to read prefix bytes %X (since it is registered concrete) but got %X", pb, bz) } else if !bytes.Equal(bz[:4], pb) { return fmt.Errorf("UnmarshalBinaryBare expected to read prefix bytes %X (since it is registered concrete) but got %X...", pb, bz[:4]) } bz = bz[4:] } // Decode contents into rv. n, err := cdc.decodeReflectBinary(bz, info, rv, FieldOptions{BinFieldNum: 1}, true) if err != nil { return fmt.Errorf("unmarshal to %v failed after %d bytes (%v): %X", info.Type, n, err, bz) } if n != len(bz) { return fmt.Errorf("unmarshal to %v didn't read all bytes. Expected to read %v, only read %v: %X", info.Type, len(bz), n, bz) } return nil }
https://github.com/chromedp/cdproto/blob/d40c70bcdf242660a32f2eadf323662dd75378b5/fetch/easyjson.go#L154-L158
func (v *TakeResponseBodyAsStreamParams) UnmarshalJSON(data []byte) error { r := jlexer.Lexer{Data: data} easyjsonC5a4559bDecodeGithubComChromedpCdprotoFetch1(&r, v) return r.Error() }
https://github.com/gobuffalo/buffalo/blob/7f360181f4ccd79dcc9dcea2c904a4801f194f04/genny/build/options.go#L49-L70
func (opts *Options) Validate() error { pwd, _ := os.Getwd() if opts.App.IsZero() { opts.App = meta.New(pwd) } if len(opts.Environment) == 0 { opts.Environment = "development" } if opts.BuildTime.IsZero() { opts.BuildTime = time.Now() } if len(opts.BuildVersion) == 0 { opts.BuildVersion = opts.BuildTime.Format(time.RFC3339) } if opts.rollback == nil { opts.rollback = &sync.Map{} } if len(opts.GoCommand) == 0 { opts.GoCommand = "build" } return nil }
https://github.com/TheThingsNetwork/go-utils/blob/aa2a11bd59104d2a8609328c2b2b55da61826470/errors/http.go#L15-L50
func (t Type) HTTPStatusCode() int { switch t { case Canceled: return http.StatusRequestTimeout case InvalidArgument: return http.StatusBadRequest case OutOfRange: return http.StatusBadRequest case NotFound: return http.StatusNotFound case Conflict: return http.StatusConflict case AlreadyExists: return http.StatusConflict case Unauthorized: return http.StatusUnauthorized case PermissionDenied: return http.StatusForbidden case Timeout: return http.StatusRequestTimeout case NotImplemented: return http.StatusNotImplemented case TemporarilyUnavailable: return http.StatusBadGateway case PermanentlyUnavailable: return http.StatusGone case ResourceExhausted: return http.StatusForbidden case Internal: return http.StatusInternalServerError case Unknown: return http.StatusInternalServerError } return http.StatusInternalServerError }
https://github.com/lxc/lxd/blob/7a41d14e4c1a6bc25918aca91004d594774dcdd3/lxd/storage_ceph_utils.go#L2028-L2043
func (s *storageCeph) cephRBDGenerateUUID(volumeName string, volumeType string) error { // Map the RBD volume RBDDevPath, err := cephRBDVolumeMap(s.ClusterName, s.OSDPoolName, volumeName, volumeType, s.UserName) if err != nil { return err } defer cephRBDVolumeUnmap(s.ClusterName, s.OSDPoolName, volumeName, volumeType, s.UserName, true) // Update the UUID msg, err := fsGenerateNewUUID(s.getRBDFilesystem(), RBDDevPath) if err != nil { return fmt.Errorf("Failed to regenerate UUID for '%v': %v: %v", volumeName, err, msg) } return nil }
https://github.com/lxc/lxd/blob/7a41d14e4c1a6bc25918aca91004d594774dcdd3/lxd/storage_ceph_utils.go#L398-L418
func cephRBDVolumeMarkDeleted(clusterName string, poolName string, volumeType string, oldVolumeName string, newVolumeName string, userName string, suffix string) error { deletedName := fmt.Sprintf("%s/zombie_%s_%s", poolName, volumeType, newVolumeName) if suffix != "" { deletedName = fmt.Sprintf("%s_%s", deletedName, suffix) } _, err := shared.RunCommand( "rbd", "--id", userName, "--cluster", clusterName, "mv", fmt.Sprintf("%s/%s_%s", poolName, volumeType, oldVolumeName), deletedName) if err != nil { return err } return nil }
https://github.com/uber/tchannel-go/blob/3c9ced6d946fe2fec6c915703a533e966c09e07a/examples/keyvalue/gen-go/keyvalue/keyvalue.go#L43-L48
func (p *KeyValueClient) Get(key string) (r string, err error) { if err = p.sendGet(key); err != nil { return } return p.recvGet() }
https://github.com/mrd0ll4r/tbotapi/blob/edc257282178bb5cebbfcc41260ec04c1ec7ac19/ctors.go#L241-L252
func (api *TelegramBotAPI) NewOutgoingForward(recipient Recipient, origin Chat, messageID int) *OutgoingForward { return &OutgoingForward{ outgoingMessageBase: outgoingMessageBase{ outgoingBase: outgoingBase{ api: api, Recipient: recipient, }, }, FromChatID: NewRecipientFromChat(origin), MessageID: messageID, } }
https://github.com/DamienFontaine/lunarc/blob/2e7332a51f554794a549a313430eaa7dec8d13cc/security/controller.go#L39-L42
func NewAuthController(um UserManager, cnf web.Config) *AuthController { authController := AuthController{UserManager: um, cnf: cnf} return &authController }
https://github.com/kpango/glg/blob/68d2670cb2dbff047331daad841149a82ac37796/glg.go#L944-L946
func Print(val ...interface{}) error { return glg.out(PRINT, blankFormat(len(val)), val...) }
https://github.com/bazelbuild/bazel-gazelle/blob/e3805aaca69a9deb949b47bfc45b9b1870712f4f/pathtools/path.go#L32-L34
func HasPrefix(p, prefix string) bool { return prefix == "" || p == prefix || strings.HasPrefix(p, prefix+"/") }
https://github.com/lxc/lxd/blob/7a41d14e4c1a6bc25918aca91004d594774dcdd3/shared/logger/log.go#L41-L45
func Info(msg string, ctx ...interface{}) { if Log != nil { Log.Info(msg, ctx...) } }
https://github.com/tendermint/go-amino/blob/dc14acf9ef15f85828bfbc561ed9dd9d2a284885/codec.go#L629-L649
func (cdc *Codec) checkConflictsInPrio_nolock(iinfo *TypeInfo) error { for _, cinfos := range iinfo.Implementers { if len(cinfos) < 2 { continue } for _, cinfo := range cinfos { var inPrio = false for _, disfix := range iinfo.InterfaceInfo.Priority { if cinfo.GetDisfix() == disfix { inPrio = true } } if !inPrio { return fmt.Errorf("%v conflicts with %v other(s). Add it to the priority list for %v.", cinfo.Type, len(cinfos), iinfo.Type) } } } return nil }
https://github.com/uber/tchannel-go/blob/3c9ced6d946fe2fec6c915703a533e966c09e07a/stats/tally.go#L117-L134
func (kt knownTags) tallyTags() map[string]string { tallyTags := make(map[string]string, 5) if kt.dest != "" { tallyTags["dest"] = kt.dest } if kt.source != "" { tallyTags["source"] = kt.source } if kt.procedure != "" { tallyTags["procedure"] = kt.procedure } if kt.retryCount != "" { tallyTags["retry-count"] = kt.retryCount } return tallyTags }
https://github.com/olorin/nagiosplugin/blob/893f9702af4ea1e2dc4cd6528cbdcdb3dc7ca064/check.go#L68-L77
func (c *Check) AddResult(status Status, message string) { var result Result result.status = status result.message = message c.results = append(c.results, result) if (*c.statusPolicy)[result.status] > (*c.statusPolicy)[c.status] { c.status = result.status } }
https://github.com/fhs/go-netrc/blob/4ffed54ee5c32ebfb1b8c7c72fc90bb08dc3ff43/netrc/netrc.go#L228-L236
func ParseFile(filename string) ([]*Machine, Macros, error) { // TODO(fhs): Check if file is readable by anyone besides the user if there is password in it. fd, err := os.Open(filename) if err != nil { return nil, nil, err } defer fd.Close() return parse(fd, &filePos{filename, 1}) }
https://github.com/siddontang/go-log/blob/1e957dd83bed18c84716181da7b80d4af48eaefe/log/log.go#L51-L55
func Panicf(format string, args ...interface{}) { msg := fmt.Sprintf(format, args...) logger.Output(2, LevelError, msg) panic(msg) }
https://github.com/chromedp/cdproto/blob/d40c70bcdf242660a32f2eadf323662dd75378b5/domsnapshot/easyjson.go#L2921-L2925
func (v *ComputedStyle) UnmarshalJSON(data []byte) error { r := jlexer.Lexer{Data: data} easyjsonC5a4559bDecodeGithubComChromedpCdprotoDomsnapshot13(&r, v) return r.Error() }
https://github.com/chromedp/cdproto/blob/d40c70bcdf242660a32f2eadf323662dd75378b5/debugger/debugger.go#L85-L88
func (p EnableParams) WithMaxScriptsCacheSize(maxScriptsCacheSize float64) *EnableParams { p.MaxScriptsCacheSize = maxScriptsCacheSize return &p }
https://github.com/kubernetes/test-infra/blob/8125fbda10178887be5dff9e901d6a0a519b67bc/prow/cmd/mkbuild-cluster/main.go#L113-L117
func currentContext(o options) (string, error) { _, cmd := command("kubectl", "config", "current-context") b, err := cmd.Output() return strings.TrimSpace(string(b)), err }
https://github.com/chromedp/cdproto/blob/d40c70bcdf242660a32f2eadf323662dd75378b5/page/page.go#L1138-L1141
func (p StartScreencastParams) WithFormat(format ScreencastFormat) *StartScreencastParams { p.Format = format return &p }
https://github.com/pachyderm/pachyderm/blob/94fb2d536cb6852a77a49e8f777dc9c1bde2c723/src/server/pfs/pretty/pretty.go#L66-L83
func PrintDetailedRepoInfo(repoInfo *PrintableRepoInfo) error { template, err := template.New("RepoInfo").Funcs(funcMap).Parse( `Name: {{.Repo.Name}}{{if .Description}} Description: {{.Description}}{{end}}{{if .FullTimestamps}} Created: {{.Created}}{{else}} Created: {{prettyAgo .Created}}{{end}} Size of HEAD on master: {{prettySize .SizeBytes}}{{if .AuthInfo}} Access level: {{ .AuthInfo.AccessLevel.String }}{{end}} `) if err != nil { return err } err = template.Execute(os.Stdout, repoInfo) if err != nil { return err } return nil }
https://github.com/chromedp/cdproto/blob/d40c70bcdf242660a32f2eadf323662dd75378b5/indexeddb/easyjson.go#L1727-L1731
func (v *DeleteObjectStoreEntriesParams) UnmarshalJSON(data []byte) error { r := jlexer.Lexer{Data: data} easyjsonC5a4559bDecodeGithubComChromedpCdprotoIndexeddb15(&r, v) return r.Error() }
https://github.com/chromedp/cdproto/blob/d40c70bcdf242660a32f2eadf323662dd75378b5/log/easyjson.go#L581-L585
func (v Entry) MarshalJSON() ([]byte, error) { w := jwriter.Writer{} easyjsonC5a4559bEncodeGithubComChromedpCdprotoLog4(&w, v) return w.Buffer.BuildBytes(), w.Error }
https://github.com/hashicorp/raft/blob/773bcaa2009bf059c5c06457b9fccd156d5e91e7/net_transport.go#L286-L300
func (n *NetworkTransport) getPooledConn(target ServerAddress) *netConn { n.connPoolLock.Lock() defer n.connPoolLock.Unlock() conns, ok := n.connPool[target] if !ok || len(conns) == 0 { return nil } var conn *netConn num := len(conns) conn, conns[num-1] = conns[num-1], nil n.connPool[target] = conns[:num-1] return conn }
https://github.com/tendermint/go-amino/blob/dc14acf9ef15f85828bfbc561ed9dd9d2a284885/amino.go#L177-L183
func (cdc *Codec) MustMarshalBinaryLengthPrefixed(o interface{}) []byte { bz, err := cdc.MarshalBinaryLengthPrefixed(o) if err != nil { panic(err) } return bz }
https://github.com/siddontang/go-log/blob/1e957dd83bed18c84716181da7b80d4af48eaefe/log/logger.go#L42-L59
func (l Level) String() string { switch l { case LevelTrace: return "trace" case LevelDebug: return "debug" case LevelInfo: return "info" case LevelWarn: return "warn" case LevelError: return "error" case LevelFatal: return "fatal" } // return default info return "info" }
https://github.com/chromedp/cdproto/blob/d40c70bcdf242660a32f2eadf323662dd75378b5/target/easyjson.go#L1829-L1833
func (v *DisposeBrowserContextParams) UnmarshalJSON(data []byte) error { r := jlexer.Lexer{Data: data} easyjsonC5a4559bDecodeGithubComChromedpCdprotoTarget20(&r, v) return r.Error() }
https://github.com/taskcluster/taskcluster-client-go/blob/ef6acd428ae5844a933792ed6479d0e7dca61ef8/tcsecrets/tcsecrets.go#L141-L145
func (secrets *Secrets) Get(name string) (*Secret, error) { cd := tcclient.Client(*secrets) responseObject, _, err := (&cd).APICall(nil, "GET", "/secret/"+url.QueryEscape(name), new(Secret), nil) return responseObject.(*Secret), err }
https://github.com/tendermint/go-amino/blob/dc14acf9ef15f85828bfbc561ed9dd9d2a284885/binary-decode.go#L915-L921
func checkTyp3(rt reflect.Type, typ Typ3, fopts FieldOptions) (err error) { typWanted := typeToTyp3(rt, fopts) if typ != typWanted { err = fmt.Errorf("unexpected Typ3. want %v, got %v", typWanted, typ) } return }
https://github.com/kubernetes/test-infra/blob/8125fbda10178887be5dff9e901d6a0a519b67bc/prow/client/listers/prowjobs/v1/prowjob.go#L48-L53
func (s *prowJobLister) List(selector labels.Selector) (ret []*v1.ProwJob, err error) { err = cache.ListAll(s.indexer, selector, func(m interface{}) { ret = append(ret, m.(*v1.ProwJob)) }) return ret, err }
https://github.com/mrd0ll4r/tbotapi/blob/edc257282178bb5cebbfcc41260ec04c1ec7ac19/outgoing.go#L592-L601
func NewInlineQueryResultArticle(id, title, text string) *InlineQueryResultArticle { return &InlineQueryResultArticle{ InlineQueryResultBase: InlineQueryResultBase{ Type: ArticleResult, ID: id, }, Title: title, Text: text, } }
https://github.com/chromedp/cdproto/blob/d40c70bcdf242660a32f2eadf323662dd75378b5/css/easyjson.go#L4476-L4480
func (v GetMediaQueriesReturns) MarshalJSON() ([]byte, error) { w := jwriter.Writer{} easyjsonC5a4559bEncodeGithubComChromedpCdprotoCss39(&w, v) return w.Buffer.BuildBytes(), w.Error }
https://github.com/mrd0ll4r/tbotapi/blob/edc257282178bb5cebbfcc41260ec04c1ec7ac19/outgoing.go#L399-L402
func (ov *OutgoingVideo) SetDuration(to int) *OutgoingVideo { ov.Duration = to return ov }
https://github.com/lxc/lxd/blob/7a41d14e4c1a6bc25918aca91004d594774dcdd3/lxd/db/storage_pools.go#L1037-L1039
func (c *Cluster) StoragePoolNodeVolumeGetTypeID(volumeName string, volumeType int, poolID int64) (int64, error) { return c.StoragePoolVolumeGetTypeID("default", volumeName, volumeType, poolID, c.nodeID) }
https://github.com/chromedp/cdproto/blob/d40c70bcdf242660a32f2eadf323662dd75378b5/network/types.go#L725-L727
func (t *InterceptionStage) UnmarshalJSON(buf []byte) error { return easyjson.Unmarshal(buf, t) }
https://github.com/bsm/sarama-cluster/blob/d5779253526cc8a3129a0e5d7cc429f4b4473ab4/consumer.go#L184-L189
func (c *Consumer) ResetPartitionOffset(topic string, partition int32, offset int64, metadata string) { sub := c.subs.Fetch(topic, partition) if sub != nil { sub.ResetOffset(offset, metadata) } }
https://github.com/piotrkowalczuk/mnemosyne/blob/66d59c3c5b886e8e869915bb76257bcba4a47250/internal/cluster/cluster.go#L44-L78
func New(opts Opts) (csr *Cluster, err error) { var ( nodes []string exists bool ) for _, seed := range opts.Seeds { if seed == opts.Listen { exists = true } } if !exists { nodes = append(nodes, opts.Listen) } nodes = append(nodes, opts.Seeds...) sort.Strings(nodes) csr = &Cluster{ nodes: make([]*Node, 0), listen: opts.Listen, logger: opts.Logger, } for i, addr := range nodes { if addr == "" { continue } csr.buckets++ csr.nodes = append(csr.nodes, &Node{ ID: i, Addr: addr, }) } return csr, nil }
https://github.com/jayeshsolanki93/devgorant/blob/69fb03e5c3b1da904aacf77240e04d85dd8e1c3c/devrant.go#L50-L62
func (c *Client) Rant(rantId int) (RantModel, []CommentModel, error) { url := fmt.Sprintf(RANT_PATH, API, rantId, APP_VERSION) res, err := http.Get(url) if err != nil { return RantModel{}, nil, err } var data RantResponse json.NewDecoder(res.Body).Decode(&data) if !data.Success && data.Error != "" { return RantModel{}, nil, errors.New(data.Error) } return data.Rant, data.Comments, nil }
https://github.com/profitbricks/profitbricks-sdk-go/blob/1d2db5f00bf5dd0b6c29273541c71c60cdf4d4d4/firewallrule.go#L53-L58
func (c *Client) GetFirewallRule(dcID string, serverID string, nicID string, fwID string) (*FirewallRule, error) { url := fwrulePath(dcID, serverID, nicID, fwID) + `?depth=` + c.client.depth + `&pretty=` + strconv.FormatBool(c.client.pretty) ret := &FirewallRule{} err := c.client.Get(url, ret, http.StatusOK) return ret, err }
https://github.com/lxc/lxd/blob/7a41d14e4c1a6bc25918aca91004d594774dcdd3/lxd/storage_lvm_utils.go#L444-L480
func (s *storageLvm) copyContainer(target container, source container, refresh bool) error { targetPool, err := target.StoragePool() if err != nil { return err } targetContainerMntPoint := getContainerMountPoint(target.Project(), targetPool, target.Name()) err = createContainerMountpoint(targetContainerMntPoint, target.Path(), target.IsPrivileged()) if err != nil { return err } sourcePool, err := source.StoragePool() if err != nil { return err } if s.useThinpool && targetPool == sourcePool && !refresh { // If the storage pool uses a thinpool we can have snapshots of // snapshots. err = s.copyContainerThinpool(target, source, false) } else { // If the storage pools does not use a thinpool we need to // perform full copies. err = s.copyContainerLv(target, source, false, refresh) } if err != nil { return err } err = target.TemplateApply("copy") if err != nil { return err } return nil }
https://github.com/golang/appengine/blob/54a98f90d1c46b7731eb8fb305d2a321c30ef610/cmd/aefix/fix.go#L466-L477
func newPkgDot(pos token.Pos, pkg, name string) ast.Expr { return &ast.SelectorExpr{ X: &ast.Ident{ NamePos: pos, Name: pkg, }, Sel: &ast.Ident{ NamePos: pos, Name: name, }, } }
https://github.com/tsuru/tsuru/blob/2f7fd515c5dc25a58aec80f0e497c49e49581b3e/builder/builder.go#L77-L83
func Registry() ([]Builder, error) { registry := make([]Builder, 0, len(builders)) for _, b := range builders { registry = append(registry, b) } return registry, nil }
https://github.com/etcd-io/etcd/blob/616592d9ba993e3fe9798eef581316016df98906/proxy/grpcproxy/cache/store.go#L113-L128
func (c *cache) Get(req *pb.RangeRequest) (*pb.RangeResponse, error) { key := keyFunc(req) c.mu.Lock() defer c.mu.Unlock() if req.Revision > 0 && req.Revision < c.compactedRev { c.lru.Remove(key) return nil, ErrCompacted } if resp, ok := c.lru.Get(key); ok { return resp.(*pb.RangeResponse), nil } return nil, errors.New("not exist") }
https://github.com/malice-plugins/go-plugin-utils/blob/9ee76663c3b0a531b8c529f03f12a5a84ff9b61b/clitable/table.go#L258-L264
func (t *Table) printMarkdownDash() { r := make(map[string]string) for _, name := range t.Fields { r[name] = strings.Repeat("-", t.fieldSizes[name]-2) } fmt.Println(t.rowString(r)) }
https://github.com/taskcluster/taskcluster-client-go/blob/ef6acd428ae5844a933792ed6479d0e7dca61ef8/tcauth/tcauth.go#L716-L720
func (auth *Auth) WebsocktunnelToken(wstAudience, wstClient string) (*WebsocktunnelTokenResponse, error) { cd := tcclient.Client(*auth) responseObject, _, err := (&cd).APICall(nil, "GET", "/websocktunnel/"+url.QueryEscape(wstAudience)+"/"+url.QueryEscape(wstClient), new(WebsocktunnelTokenResponse), nil) return responseObject.(*WebsocktunnelTokenResponse), err }
https://github.com/stellar/go-stellar-base/blob/79c570612c0b461db178aa8949d9f13cafc2a7c9/build/allow_trust.go#L78-L80
func (m Trustor) MutateAllowTrust(o *xdr.AllowTrustOp) error { return setAccountId(m.Address, &o.Trustor) }
https://github.com/kubernetes/test-infra/blob/8125fbda10178887be5dff9e901d6a0a519b67bc/prow/spyglass/podlogartifact.go#L50-L66
func NewPodLogArtifact(jobName string, buildID string, sizeLimit int64, ja jobAgent) (*PodLogArtifact, error) { if jobName == "" { return nil, errInsufficientJobInfo } if buildID == "" { return nil, errInsufficientJobInfo } if sizeLimit < 0 { return nil, errInvalidSizeLimit } return &PodLogArtifact{ name: jobName, buildID: buildID, sizeLimit: sizeLimit, jobAgent: ja, }, nil }
https://github.com/jhillyerd/enmime/blob/874cc30e023f36bd1df525716196887b0f04851b/builder.go#L137-L144
func (p MailBuilder) AddAttachment(b []byte, contentType string, fileName string) MailBuilder { part := NewPart(contentType) part.Content = b part.FileName = fileName part.Disposition = cdAttachment p.attachments = append(p.attachments, part) return p }
https://github.com/chromedp/cdproto/blob/d40c70bcdf242660a32f2eadf323662dd75378b5/memory/memory.go#L60-L62
func (p *PrepareForLeakDetectionParams) Do(ctx context.Context) (err error) { return cdp.Execute(ctx, CommandPrepareForLeakDetection, nil, nil) }
https://github.com/pachyderm/pachyderm/blob/94fb2d536cb6852a77a49e8f777dc9c1bde2c723/src/server/pkg/exec/exec.go#L612-L627
func (c *Cmd) StdoutPipe() (io.ReadCloser, error) { if c.Stdout != nil { return nil, errors.New("exec: Stdout already set") } if c.Process != nil { return nil, errors.New("exec: StdoutPipe after process started") } pr, pw, err := os.Pipe() if err != nil { return nil, err } c.Stdout = pw c.closeAfterStart = append(c.closeAfterStart, pw) c.closeAfterWait = append(c.closeAfterWait, pr) return pr, nil }
https://github.com/chromedp/cdproto/blob/d40c70bcdf242660a32f2eadf323662dd75378b5/emulation/easyjson.go#L447-L451
func (v SetScrollbarsHiddenParams) MarshalJSON() ([]byte, error) { w := jwriter.Writer{} easyjsonC5a4559bEncodeGithubComChromedpCdprotoEmulation4(&w, v) return w.Buffer.BuildBytes(), w.Error }
https://github.com/rightscale/rsc/blob/96079a1ee7238dae9cbb7efa77dd94a479d217bd/cm15/examples/auditail/main.go#L112-L124
func extractUnique(oldEntries, newEntries []*cm15.AuditEntry) []*cm15.AuditEntry { var uniqueEntries = make([]*cm15.AuditEntry, 0) var oldHrefs = make([]string, len(oldEntries)) for i, e := range oldEntries { oldHrefs[i] = getHref(e) } for _, newEntry := range newEntries { if !stringInSlice(getHref(newEntry), oldHrefs) { uniqueEntries = append(uniqueEntries, newEntry) } } return uniqueEntries }
https://github.com/naoina/genmai/blob/78583835e1e41e3938e1ddfffd7101f8ad27fae0/genmai.go#L162-L164
func (db *DB) Join(table interface{}) *JoinCondition { return (&JoinCondition{db: db}).Join(table) }