_id
stringlengths
86
170
text
stringlengths
54
39.3k
https://github.com/guregu/null/blob/80515d440932108546bcade467bb7d6968e812e2/float.go#L85-L95
func (f *Float) UnmarshalText(text []byte) error { str := string(text) if str == "" || str == "null" { f.Valid = false return nil } var err error f.Float64, err = strconv.ParseFloat(string(text), 64) f.Valid = err == nil return err }
https://github.com/kubernetes/test-infra/blob/8125fbda10178887be5dff9e901d6a0a519b67bc/prow/apis/prowjobs/v1/zz_generated.deepcopy.go#L291-L298
func (in *Refs) DeepCopy() *Refs { if in == nil { return nil } out := new(Refs) in.DeepCopyInto(out) return out }
https://github.com/kubicorn/kubicorn/blob/c4a4b80994b4333709c0f8164faabd801866b986/pkg/version/version.go#L60-L66
func GetVersionJSON() string { verBytes, err := json.Marshal(GetVersion()) if err != nil { logger.Critical("Unable to marshal version struct: %v", err) } return string(verBytes) }
https://github.com/bazelbuild/bazel-gazelle/blob/e3805aaca69a9deb949b47bfc45b9b1870712f4f/merger/fix.go#L127-L140
func newLoadIndex(f *rule.File, after []string) int { if len(after) == 0 { return 0 } index := 0 for _, r := range f.Rules { for _, a := range after { if r.Kind() == a && r.Index() >= index { index = r.Index() + 1 } } } return index }
https://github.com/chromedp/cdproto/blob/d40c70bcdf242660a32f2eadf323662dd75378b5/page/page.go#L362-L371
func (p *GetFrameTreeParams) Do(ctx context.Context) (frameTree *FrameTree, err error) { // execute var res GetFrameTreeReturns err = cdp.Execute(ctx, CommandGetFrameTree, nil, &res) if err != nil { return nil, err } return res.FrameTree, nil }
https://github.com/etcd-io/etcd/blob/616592d9ba993e3fe9798eef581316016df98906/functional/rpcpb/member.go#L37-L39
func (m *Member) ElectionTimeout() time.Duration { return time.Duration(m.Etcd.ElectionTimeoutMs) * time.Millisecond }
https://github.com/mgutz/str/blob/968bf66e3da857419e4f6e71b2d5c9ae95682dc4/funcsPZ.go#L232-L236
func SubstrF(index, n int) func(string) string { return func(s string) string { return Substr(s, index, n) } }
https://github.com/apparentlymart/go-rundeck-api/blob/2c962acae81080a937c350a5bea054c239f27a81/rundeck/system_info.go#L110-L116
func (ts *SystemTimestamp) DateTime() time.Time { // Assume the server will always give us a valid timestamp, // so we don't need to handle the error case. // (Famous last words?) t, _ := time.Parse(time.RFC3339, ts.DateTimeStr) return t }
https://github.com/containers/image/blob/da9ab3561ad2031aeb5e036b7cf2755d4e246fec/storage/storage_image.go#L269-L291
func buildLayerInfosForCopy(manifestInfos []manifest.LayerInfo, physicalInfos []types.BlobInfo) ([]types.BlobInfo, error) { nextPhysical := 0 res := make([]types.BlobInfo, len(manifestInfos)) for i, mi := range manifestInfos { if mi.EmptyLayer { res[i] = types.BlobInfo{ Digest: image.GzippedEmptyLayerDigest, Size: int64(len(image.GzippedEmptyLayer)), MediaType: mi.MediaType, } } else { if nextPhysical >= len(physicalInfos) { return nil, fmt.Errorf("expected more than %d physical layers to exist", len(physicalInfos)) } res[i] = physicalInfos[nextPhysical] nextPhysical++ } } if nextPhysical != len(physicalInfos) { return nil, fmt.Errorf("used only %d out of %d physical layers", nextPhysical, len(physicalInfos)) } return res, nil }
https://github.com/etcd-io/etcd/blob/616592d9ba993e3fe9798eef581316016df98906/pkg/logutil/zap.go#L57-L97
func AddOutputPaths(cfg zap.Config, outputPaths, errorOutputPaths []string) zap.Config { outputs := make(map[string]struct{}) for _, v := range cfg.OutputPaths { outputs[v] = struct{}{} } for _, v := range outputPaths { outputs[v] = struct{}{} } outputSlice := make([]string, 0) if _, ok := outputs["/dev/null"]; ok { // "/dev/null" to discard all outputSlice = []string{"/dev/null"} } else { for k := range outputs { outputSlice = append(outputSlice, k) } } cfg.OutputPaths = outputSlice sort.Strings(cfg.OutputPaths) errOutputs := make(map[string]struct{}) for _, v := range cfg.ErrorOutputPaths { errOutputs[v] = struct{}{} } for _, v := range errorOutputPaths { errOutputs[v] = struct{}{} } errOutputSlice := make([]string, 0) if _, ok := errOutputs["/dev/null"]; ok { // "/dev/null" to discard all errOutputSlice = []string{"/dev/null"} } else { for k := range errOutputs { errOutputSlice = append(errOutputSlice, k) } } cfg.ErrorOutputPaths = errOutputSlice sort.Strings(cfg.ErrorOutputPaths) return cfg }
https://github.com/rightscale/rsc/blob/96079a1ee7238dae9cbb7efa77dd94a479d217bd/rsapi/commands.go#L474-L485
func buildPayload(values []APIParams) (APIParams, error) { payload := APIParams{} for _, value := range values { // Only one iteration below, flatten params only have one element each for name, param := range value { if _, err := Normalize(payload, name, param); err != nil { return nil, err } } } return payload, nil }
https://github.com/chromedp/cdproto/blob/d40c70bcdf242660a32f2eadf323662dd75378b5/heapprofiler/easyjson.go#L220-L224
func (v StopSamplingReturns) MarshalJSON() ([]byte, error) { w := jwriter.Writer{} easyjsonC5a4559bEncodeGithubComChromedpCdprotoHeapprofiler2(&w, v) return w.Buffer.BuildBytes(), w.Error }
https://github.com/enaml-ops/enaml/blob/4f847ee10b41afca41fe09fa839cb2f6ade06fb5/deploymentmanifest.go#L62-L70
func (s *DeploymentManifest) AddRemoteRelease(releaseName, ver, url, sha1 string) (err error) { s.Releases = append(s.Releases, Release{ Name: releaseName, URL: url, SHA1: sha1, Version: ver, }) return }
https://github.com/llgcode/draw2d/blob/f52c8a71aff06ab8df41843d33ab167b36c971cd/draw2dgl/gc.go#L208-L227
func (gc *GraphicContext) FillStringAt(text string, x, y float64) (width float64) { f, err := gc.loadCurrentFont() if err != nil { log.Println(err) return 0.0 } startx := x prev, hasPrev := truetype.Index(0), false fontName := gc.GetFontName() for _, r := range text { index := f.Index(r) if hasPrev { x += fUnitsToFloat64(f.Kern(fixed.Int26_6(gc.Current.Scale), prev, index)) } glyph := gc.glyphCache.Fetch(gc, fontName, r) x += glyph.Fill(gc, x, y) prev, hasPrev = index, true } return x - startx }
https://github.com/mattn/go-xmpp/blob/6093f50721ed2204a87a81109ca5a466a5bec6c1/xmpp.go#L687-L692
func (c *Client) SendHtml(chat Chat) (n int, err error) { return fmt.Fprintf(c.conn, "<message to='%s' type='%s' xml:lang='en'>"+ "<body>%s</body>"+ "<html xmlns='http://jabber.org/protocol/xhtml-im'><body xmlns='http://www.w3.org/1999/xhtml'>%s</body></html></message>", xmlEscape(chat.Remote), xmlEscape(chat.Type), xmlEscape(chat.Text), chat.Text) }
https://github.com/kubernetes/test-infra/blob/8125fbda10178887be5dff9e901d6a0a519b67bc/prow/github/client.go#L187-L224
func (c *Client) Throttle(hourlyTokens, burst int) { c.log("Throttle", hourlyTokens, burst) c.throttle.lock.Lock() defer c.throttle.lock.Unlock() previouslyThrottled := c.throttle.ticker != nil if hourlyTokens <= 0 || burst <= 0 { // Disable throttle if previouslyThrottled { // Unwrap clients if necessary c.client = c.throttle.http c.gqlc = c.throttle.graph c.throttle.ticker.Stop() c.throttle.ticker = nil } return } rate := time.Hour / time.Duration(hourlyTokens) ticker := time.NewTicker(rate) throttle := make(chan time.Time, burst) for i := 0; i < burst; i++ { // Fill up the channel throttle <- time.Now() } go func() { // Refill the channel for t := range ticker.C { select { case throttle <- t: default: } } }() if !previouslyThrottled { // Wrap clients if we haven't already c.throttle.http = c.client c.throttle.graph = c.gqlc c.client = &c.throttle c.gqlc = &c.throttle } c.throttle.ticker = ticker c.throttle.throttle = throttle }
https://github.com/anmitsu/go-shlex/blob/648efa622239a2f6ff949fed78ee37b48d499ba4/shlex.go#L62-L69
func NewLexer(r io.Reader, posix, whitespacesplit bool) *Lexer { return &Lexer{ reader: bufio.NewReader(r), tokenizer: &DefaultTokenizer{}, posix: posix, whitespacesplit: whitespacesplit, } }
https://github.com/pachyderm/pachyderm/blob/94fb2d536cb6852a77a49e8f777dc9c1bde2c723/src/client/pfs.go#L503-L519
func (c APIClient) SubscribeCommit(repo string, branch string, from string, state pfs.CommitState) (CommitInfoIterator, error) { ctx, cancel := context.WithCancel(c.Ctx()) req := &pfs.SubscribeCommitRequest{ Repo: NewRepo(repo), Branch: branch, State: state, } if from != "" { req.From = NewCommit(repo, from) } stream, err := c.PfsAPIClient.SubscribeCommit(ctx, req) if err != nil { cancel() return nil, grpcutil.ScrubGRPC(err) } return &commitInfoIterator{stream, cancel}, nil }
https://github.com/bluekeyes/hatpear/blob/ffb42d5bb417aa8e12b3b7ff73d028b915dafa10/hatpear.go#L54-L66
func Catch(h func(w http.ResponseWriter, r *http.Request, err error)) Middleware { return func(next http.Handler) http.Handler { return http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) { var err error ctx := context.WithValue(r.Context(), errorKey, &err) next.ServeHTTP(w, r.WithContext(ctx)) if err != nil { h(w, r, err) } }) } }
https://github.com/kubernetes/test-infra/blob/8125fbda10178887be5dff9e901d6a0a519b67bc/prow/github/client.go#L2079-L2088
func (c *Client) DeleteTeam(id int) error { c.log("DeleteTeam", id) path := fmt.Sprintf("/teams/%d", id) _, err := c.request(&request{ method: http.MethodDelete, path: path, exitCodes: []int{204}, }, nil) return err }
https://github.com/coryb/figtree/blob/e5fa026ccd54e0a6a99b6d81f73bfcc8e6fe6a6b/gen-rawoption.go#L3452-L3457
func (o *ListUintOption) Set(value string) error { val := UintOption{} val.Set(value) *o = append(*o, val) return nil }
https://github.com/chromedp/cdproto/blob/d40c70bcdf242660a32f2eadf323662dd75378b5/tracing/easyjson.go#L533-L537
func (v *RequestMemoryDumpParams) UnmarshalJSON(data []byte) error { r := jlexer.Lexer{Data: data} easyjsonC5a4559bDecodeGithubComChromedpCdprotoTracing3(&r, v) return r.Error() }
https://github.com/rightscale/rsc/blob/96079a1ee7238dae9cbb7efa77dd94a479d217bd/gen/praxisgen/api_analyzer.go#L83-L88
func NewTypeRegistry() *TypeRegistry { return &TypeRegistry{ NamedTypes: make(map[string]*gen.ObjectDataType), InlineTypes: make(map[string][]*gen.ObjectDataType), } }
https://github.com/kubernetes/test-infra/blob/8125fbda10178887be5dff9e901d6a0a519b67bc/prow/apis/prowjobs/v1/types.go#L323-L344
func (u *UtilityImages) ApplyDefault(def *UtilityImages) *UtilityImages { if u == nil { return def } else if def == nil { return u } merged := *u if merged.CloneRefs == "" { merged.CloneRefs = def.CloneRefs } if merged.InitUpload == "" { merged.InitUpload = def.InitUpload } if merged.Entrypoint == "" { merged.Entrypoint = def.Entrypoint } if merged.Sidecar == "" { merged.Sidecar = def.Sidecar } return &merged }
https://github.com/taskcluster/taskcluster-client-go/blob/ef6acd428ae5844a933792ed6479d0e7dca61ef8/tcec2manager/tcec2manager.go#L78-L85
func NewFromEnv() *EC2Manager { c := tcclient.CredentialsFromEnvVars() return &EC2Manager{ Credentials: c, BaseURL: DefaultBaseURL, Authenticate: c.ClientID != "", } }
https://github.com/containers/image/blob/da9ab3561ad2031aeb5e036b7cf2755d4e246fec/storage/storage_image.go#L371-L433
func (s *storageImageDestination) PutBlob(ctx context.Context, stream io.Reader, blobinfo types.BlobInfo, cache types.BlobInfoCache, isConfig bool) (types.BlobInfo, error) { // Stores a layer or data blob in our temporary directory, checking that any information // in the blobinfo matches the incoming data. errorBlobInfo := types.BlobInfo{ Digest: "", Size: -1, } // Set up to digest the blob and count its size while saving it to a file. hasher := digest.Canonical.Digester() if blobinfo.Digest.Validate() == nil { if a := blobinfo.Digest.Algorithm(); a.Available() { hasher = a.Digester() } } diffID := digest.Canonical.Digester() filename := s.computeNextBlobCacheFile() file, err := os.OpenFile(filename, os.O_CREATE|os.O_TRUNC|os.O_WRONLY|os.O_EXCL, 0600) if err != nil { return errorBlobInfo, errors.Wrapf(err, "error creating temporary file %q", filename) } defer file.Close() counter := ioutils.NewWriteCounter(hasher.Hash()) reader := io.TeeReader(io.TeeReader(stream, counter), file) decompressed, err := archive.DecompressStream(reader) if err != nil { return errorBlobInfo, errors.Wrap(err, "error setting up to decompress blob") } // Copy the data to the file. // TODO: This can take quite some time, and should ideally be cancellable using ctx.Done(). _, err = io.Copy(diffID.Hash(), decompressed) decompressed.Close() if err != nil { return errorBlobInfo, errors.Wrapf(err, "error storing blob to file %q", filename) } // Ensure that any information that we were given about the blob is correct. if blobinfo.Digest.Validate() == nil && blobinfo.Digest != hasher.Digest() { return errorBlobInfo, ErrBlobDigestMismatch } if blobinfo.Size >= 0 && blobinfo.Size != counter.Count { return errorBlobInfo, ErrBlobSizeMismatch } // Record information about the blob. s.putBlobMutex.Lock() s.blobDiffIDs[hasher.Digest()] = diffID.Digest() s.fileSizes[hasher.Digest()] = counter.Count s.filenames[hasher.Digest()] = filename s.putBlobMutex.Unlock() blobDigest := blobinfo.Digest if blobDigest.Validate() != nil { blobDigest = hasher.Digest() } blobSize := blobinfo.Size if blobSize < 0 { blobSize = counter.Count } // This is safe because we have just computed both values ourselves. cache.RecordDigestUncompressedPair(blobDigest, diffID.Digest()) return types.BlobInfo{ Digest: blobDigest, Size: blobSize, MediaType: blobinfo.MediaType, }, nil }
https://github.com/pachyderm/pachyderm/blob/94fb2d536cb6852a77a49e8f777dc9c1bde2c723/src/server/pkg/backoff/exponential.go#L194-L201
func (b *ExponentialBackOff) incrementCurrentInterval() { // Check for overflow, if overflow is detected set the current interval to the max interval. if float64(b.currentInterval) >= float64(b.MaxInterval)/b.Multiplier { b.currentInterval = b.MaxInterval } else { b.currentInterval = time.Duration(float64(b.currentInterval) * b.Multiplier) } }
https://github.com/hashicorp/raft/blob/773bcaa2009bf059c5c06457b9fccd156d5e91e7/fuzzy/transport.go#L227-L229
func (t *transport) DecodePeer(p []byte) raft.ServerAddress { return raft.ServerAddress(p) }
https://github.com/kubernetes/test-infra/blob/8125fbda10178887be5dff9e901d6a0a519b67bc/prow/spyglass/gcsartifact.go#L93-L136
func (a *GCSArtifact) ReadAt(p []byte, off int64) (n int, err error) { gzipped, err := a.gzipped() if err != nil { return 0, fmt.Errorf("error checking artifact for gzip compression: %v", err) } if gzipped { return 0, lenses.ErrGzipOffsetRead } artifactSize, err := a.Size() if err != nil { return 0, fmt.Errorf("error getting artifact size: %v", err) } if off >= artifactSize { return 0, fmt.Errorf("offset must be less than artifact size") } var gotEOF bool toRead := int64(len(p)) if toRead+off > artifactSize { return 0, fmt.Errorf("read range exceeds artifact contents") } else if toRead+off == artifactSize { gotEOF = true } reader, err := a.handle.NewRangeReader(a.ctx, off, toRead) defer reader.Close() if err != nil { return 0, fmt.Errorf("error getting artifact reader: %v", err) } // We need to keep reading until we fill the buffer or hit EOF. offset := 0 for offset < len(p) { n, err = reader.Read(p[offset:]) offset += n if err != nil { if err == io.EOF && gotEOF { break } return 0, fmt.Errorf("error reading from artifact: %v", err) } } if gotEOF { return offset, io.EOF } return offset, nil }
https://github.com/ctripcorp/ghost/blob/9dce30d85194129b9c0ba6702c612f3b5c41d02f/pool/wrappedConn.go#L24-L33
func (c *WrappedConn) Write(b []byte) (n int, err error) { //c.Conn is certainly not nil n, err = c.Conn.Write(b) if err != nil { c.unusable = true } else { c.start = time.Now() } return }
https://github.com/bazelbuild/bazel-gazelle/blob/e3805aaca69a9deb949b47bfc45b9b1870712f4f/rule/rule.go#L426-L437
func NewLoad(name string) *Load { return &Load{ stmt: stmt{ expr: &bzl.LoadStmt{ Module: &bzl.StringExpr{Value: name}, ForceCompact: true, }, }, name: name, symbols: make(map[string]identPair), } }
https://github.com/containers/image/blob/da9ab3561ad2031aeb5e036b7cf2755d4e246fec/openshift/openshift-copies.go#L373-L421
func validateAuthInfo(authInfoName string, authInfo clientcmdAuthInfo) []error { var validationErrors []error usingAuthPath := false methods := make([]string, 0, 3) if len(authInfo.Token) != 0 { methods = append(methods, "token") } if len(authInfo.Username) != 0 || len(authInfo.Password) != 0 { methods = append(methods, "basicAuth") } if len(authInfo.ClientCertificate) != 0 || len(authInfo.ClientCertificateData) != 0 { // Make sure cert data and file aren't both specified if len(authInfo.ClientCertificate) != 0 && len(authInfo.ClientCertificateData) != 0 { validationErrors = append(validationErrors, errors.Errorf("client-cert-data and client-cert are both specified for %v. client-cert-data will override", authInfoName)) } // Make sure key data and file aren't both specified if len(authInfo.ClientKey) != 0 && len(authInfo.ClientKeyData) != 0 { validationErrors = append(validationErrors, errors.Errorf("client-key-data and client-key are both specified for %v; client-key-data will override", authInfoName)) } // Make sure a key is specified if len(authInfo.ClientKey) == 0 && len(authInfo.ClientKeyData) == 0 { validationErrors = append(validationErrors, errors.Errorf("client-key-data or client-key must be specified for %v to use the clientCert authentication method", authInfoName)) } if len(authInfo.ClientCertificate) != 0 { clientCertFile, err := os.Open(authInfo.ClientCertificate) defer clientCertFile.Close() if err != nil { validationErrors = append(validationErrors, errors.Errorf("unable to read client-cert %v for %v due to %v", authInfo.ClientCertificate, authInfoName, err)) } } if len(authInfo.ClientKey) != 0 { clientKeyFile, err := os.Open(authInfo.ClientKey) defer clientKeyFile.Close() if err != nil { validationErrors = append(validationErrors, errors.Errorf("unable to read client-key %v for %v due to %v", authInfo.ClientKey, authInfoName, err)) } } } // authPath also provides information for the client to identify the server, so allow multiple auth methods in that case if (len(methods) > 1) && (!usingAuthPath) { validationErrors = append(validationErrors, errors.Errorf("more than one authentication method found for %v; found %v, only one is allowed", authInfoName, methods)) } return validationErrors }
https://github.com/stellar/go-stellar-base/blob/79c570612c0b461db178aa8949d9f13cafc2a7c9/xdr/xdr_generated.go#L3589-L3592
func (e InflationResultCode) ValidEnum(v int32) bool { _, ok := inflationResultCodeMap[v] return ok }
https://github.com/segmentio/nsq-go/blob/ff4eef968f46eb580d9dba4f637c5dfb1e5b2208/nsqlookup/engine.go#L34-L39
func (info NodeInfo) String() string { if len(info.Hostname) != 0 { return info.Hostname } return httpBroadcastAddress(info) }
https://github.com/apparentlymart/go-rundeck-api/blob/2c962acae81080a937c350a5bea054c239f27a81/rundeck/job.go#L327-L334
func (c *Client) GetJob(id string) (*JobDetail, error) { jobList := &jobDetailList{} err := c.get([]string{"job", id}, nil, jobList) if err != nil { return nil, err } return &jobList.Jobs[0], nil }
https://github.com/TheThingsNetwork/go-utils/blob/aa2a11bd59104d2a8609328c2b2b55da61826470/grpc/ttnctx/context.go#L42-L45
func TokenFromIncomingContext(ctx context.Context) (string, error) { md := MetadataFromIncomingContext(ctx) return TokenFromMetadata(md) }
https://github.com/containers/image/blob/da9ab3561ad2031aeb5e036b7cf2755d4e246fec/openshift/openshift.go#L207-L212
func (s *openshiftImageSource) GetManifest(ctx context.Context, instanceDigest *digest.Digest) ([]byte, string, error) { if err := s.ensureImageIsResolved(ctx); err != nil { return nil, "", err } return s.docker.GetManifest(ctx, instanceDigest) }
https://github.com/lxc/lxd/blob/7a41d14e4c1a6bc25918aca91004d594774dcdd3/lxd/endpoints/socket.go#L87-L107
func socketUnixSetOwnership(path string, group string) error { var gid int var err error if group != "" { gid, err = shared.GroupId(group) if err != nil { return fmt.Errorf("cannot get group ID of '%s': %v", group, err) } } else { gid = os.Getgid() } err = os.Chown(path, os.Getuid(), gid) if err != nil { return fmt.Errorf("cannot change ownership on local socket: %v", err) } return nil }
https://github.com/etcd-io/etcd/blob/616592d9ba993e3fe9798eef581316016df98906/pkg/osutil/signal_linux.go#L25-L30
func dflSignal(sig syscall.Signal) { // clearing out the sigact sets the signal to SIG_DFL var sigactBuf [32]uint64 ptr := unsafe.Pointer(&sigactBuf) syscall.Syscall6(uintptr(syscall.SYS_RT_SIGACTION), uintptr(sig), uintptr(ptr), 0, 8, 0, 0) }
https://github.com/hooklift/govix/blob/063702285520a992b920fc1575e305dc9ffd6ffe/vm.go#L162-L183
func (v *VM) InVMTeam() (bool, error) { var err C.VixError = C.VIX_OK inTeam := C.VIX_PROPERTY_NONE err = C.get_property(v.handle, C.VIX_PROPERTY_VM_IN_VMTEAM, unsafe.Pointer(&inTeam)) if C.VIX_OK != err { return false, &Error{ Operation: "vm.InVmTeam", Code: int(err & 0xFFFF), Text: C.GoString(C.Vix_GetErrorText(err, nil)), } } if inTeam == 0 { return false, nil } return true, nil }
https://github.com/chromedp/cdproto/blob/d40c70bcdf242660a32f2eadf323662dd75378b5/page/types.go#L446-L458
func (t *SetDownloadBehaviorBehavior) UnmarshalEasyJSON(in *jlexer.Lexer) { switch SetDownloadBehaviorBehavior(in.String()) { case SetDownloadBehaviorBehaviorDeny: *t = SetDownloadBehaviorBehaviorDeny case SetDownloadBehaviorBehaviorAllow: *t = SetDownloadBehaviorBehaviorAllow case SetDownloadBehaviorBehaviorDefault: *t = SetDownloadBehaviorBehaviorDefault default: in.AddError(errors.New("unknown SetDownloadBehaviorBehavior value")) } }
https://github.com/mrd0ll4r/tbotapi/blob/edc257282178bb5cebbfcc41260ec04c1ec7ac19/outgoing.go#L406-L418
func (ov *OutgoingVideo) querystring() querystring { toReturn := map[string]string(ov.getBaseQueryString()) if ov.Caption != "" { toReturn["caption"] = ov.Caption } if ov.Duration != 0 { toReturn["duration"] = fmt.Sprint(ov.Duration) } return querystring(toReturn) }
https://github.com/stellar/go-stellar-base/blob/79c570612c0b461db178aa8949d9f13cafc2a7c9/xdr/xdr_generated.go#L6523-L6531
func (u StellarMessage) MustAuth() Auth { val, ok := u.GetAuth() if !ok { panic("arm Auth is not set") } return val }
https://github.com/hashicorp/raft/blob/773bcaa2009bf059c5c06457b9fccd156d5e91e7/inmem_store.go#L46-L55
func (i *InmemStore) GetLog(index uint64, log *Log) error { i.l.RLock() defer i.l.RUnlock() l, ok := i.logs[index] if !ok { return ErrLogNotFound } *log = *l return nil }
https://github.com/chromedp/cdproto/blob/d40c70bcdf242660a32f2eadf323662dd75378b5/page/easyjson.go#L5631-L5635
func (v EventInterstitialShown) MarshalJSON() ([]byte, error) { w := jwriter.Writer{} easyjsonC5a4559bEncodeGithubComChromedpCdprotoPage58(&w, v) return w.Buffer.BuildBytes(), w.Error }
https://github.com/jhillyerd/enmime/blob/874cc30e023f36bd1df525716196887b0f04851b/internal/coding/charsets.go#L293-L302
func NewCharsetReader(charset string, input io.Reader) (io.Reader, error) { if strings.ToLower(charset) == utf8 { return input, nil } csentry, ok := encodings[strings.ToLower(charset)] if !ok { return nil, fmt.Errorf("Unsupported charset %q", charset) } return transform.NewReader(input, csentry.e.NewDecoder()), nil }
https://github.com/chromedp/cdproto/blob/d40c70bcdf242660a32f2eadf323662dd75378b5/tracing/easyjson.go#L811-L815
func (v GetCategoriesParams) MarshalJSON() ([]byte, error) { w := jwriter.Writer{} easyjsonC5a4559bEncodeGithubComChromedpCdprotoTracing7(&w, v) return w.Buffer.BuildBytes(), w.Error }
https://github.com/uber/tchannel-go/blob/3c9ced6d946fe2fec6c915703a533e966c09e07a/peer.go#L612-L614
func isEphemeralHostPort(hostPort string) bool { return hostPort == "" || hostPort == ephemeralHostPort || strings.HasSuffix(hostPort, ":0") }
https://github.com/uber/tchannel-go/blob/3c9ced6d946fe2fec6c915703a533e966c09e07a/outbound.go#L38-L138
func (c *Connection) beginCall(ctx context.Context, serviceName, methodName string, callOptions *CallOptions) (*OutboundCall, error) { now := c.timeNow() switch state := c.readState(); state { case connectionActive: break case connectionStartClose, connectionInboundClosed, connectionClosed: return nil, ErrConnectionClosed default: return nil, errConnectionUnknownState{"beginCall", state} } deadline, ok := ctx.Deadline() if !ok { // This case is handled by validateCall, so we should // never get here. return nil, ErrTimeoutRequired } // If the timeToLive is less than a millisecond, it will be encoded as 0 on // the wire, hence we return a timeout immediately. timeToLive := deadline.Sub(now) if timeToLive < time.Millisecond { return nil, ErrTimeout } if err := ctx.Err(); err != nil { return nil, GetContextError(err) } requestID := c.NextMessageID() mex, err := c.outbound.newExchange(ctx, c.opts.FramePool, messageTypeCallReq, requestID, mexChannelBufferSize) if err != nil { return nil, err } // Close may have been called between the time we checked the state and us creating the exchange. if state := c.readState(); state != connectionActive { mex.shutdown() return nil, ErrConnectionClosed } // Note: We don't verify number of transport headers as the library doesn't // allow adding arbitrary headers. Ensure we never add >= 256 headers here. headers := transportHeaders{ CallerName: c.localPeerInfo.ServiceName, } callOptions.setHeaders(headers) if opts := currentCallOptions(ctx); opts != nil { opts.overrideHeaders(headers) } call := new(OutboundCall) call.mex = mex call.conn = c call.callReq = callReq{ id: requestID, Headers: headers, Service: serviceName, TimeToLive: timeToLive, } call.statsReporter = c.statsReporter call.createStatsTags(c.commonStatsTags, callOptions, methodName) call.log = c.log.WithFields(LogField{"Out-Call", requestID}) // TODO(mmihic): It'd be nice to do this without an fptr call.messageForFragment = func(initial bool) message { if initial { return &call.callReq } return new(callReqContinue) } call.contents = newFragmentingWriter(call.log, call, c.opts.ChecksumType.New()) response := new(OutboundCallResponse) response.startedAt = now response.timeNow = c.timeNow response.requestState = callOptions.RequestState response.mex = mex response.log = c.log.WithFields(LogField{"Out-Response", requestID}) response.span = c.startOutboundSpan(ctx, serviceName, methodName, call, now) response.messageForFragment = func(initial bool) message { if initial { return &response.callRes } return new(callResContinue) } response.contents = newFragmentingReader(response.log, response) response.statsReporter = call.statsReporter response.commonStatsTags = call.commonStatsTags call.response = response if err := call.writeMethod([]byte(methodName)); err != nil { return nil, err } return call, nil }
https://github.com/chromedp/cdproto/blob/d40c70bcdf242660a32f2eadf323662dd75378b5/debugger/debugger.go#L153-L156
func (p EvaluateOnCallFrameParams) WithSilent(silent bool) *EvaluateOnCallFrameParams { p.Silent = silent return &p }
https://github.com/libp2p/go-libp2p-crypto/blob/9d2fed53443f745e6dc4d02bdcc94d9742a0ca84/secp256k1.go#L107-L114
func (k *Secp256k1PublicKey) Equals(o Key) bool { sk, ok := o.(*Secp256k1PublicKey) if !ok { return false } return (*btcec.PublicKey)(k).IsEqual((*btcec.PublicKey)(sk)) }
https://github.com/chromedp/cdproto/blob/d40c70bcdf242660a32f2eadf323662dd75378b5/page/page.go#L109-L112
func (p CaptureScreenshotParams) WithQuality(quality int64) *CaptureScreenshotParams { p.Quality = quality return &p }
https://github.com/lxc/lxd/blob/7a41d14e4c1a6bc25918aca91004d594774dcdd3/client/lxd.go#L76-L82
func (r *ProtocolLXD) GetHTTPClient() (*http.Client, error) { if r.http == nil { return nil, fmt.Errorf("HTTP client isn't set, bad connection") } return r.http, nil }
https://github.com/libp2p/go-libp2p-pubsub/blob/9db3dbdde90f44d1c420192c5cefd60682fbdbb9/randomsub.go#L22-L27
func NewRandomSub(ctx context.Context, h host.Host, opts ...Option) (*PubSub, error) { rt := &RandomSubRouter{ peers: make(map[peer.ID]protocol.ID), } return NewPubSub(ctx, h, rt, opts...) }
https://github.com/pact-foundation/pact-go/blob/467dea56d27e154363e1975f6e9f4dbf66148e79/dsl/pact.go#L237-L275
func (p *Pact) Verify(integrationTest func() error) error { p.Setup(true) log.Println("[DEBUG] pact verify") // Check if we are verifying messages or if we actually have interactions if len(p.Interactions) == 0 { return errors.New("there are no interactions to be verified") } mockServer := &MockService{ BaseURL: fmt.Sprintf("http://%s:%d", p.Host, p.Server.Port), Consumer: p.Consumer, Provider: p.Provider, } for _, interaction := range p.Interactions { err := mockServer.AddInteraction(interaction) if err != nil { return err } } // Run the integration test err := integrationTest() if err != nil { return err } // Run Verification Process err = mockServer.Verify() if err != nil { return err } // Clear out interations p.Interactions = make([]*Interaction, 0) return mockServer.DeleteInteractions() }
https://github.com/chromedp/cdproto/blob/d40c70bcdf242660a32f2eadf323662dd75378b5/emulation/easyjson.go#L376-L380
func (v SetTouchEmulationEnabledParams) MarshalJSON() ([]byte, error) { w := jwriter.Writer{} easyjsonC5a4559bEncodeGithubComChromedpCdprotoEmulation3(&w, v) return w.Buffer.BuildBytes(), w.Error }
https://github.com/chromedp/cdproto/blob/d40c70bcdf242660a32f2eadf323662dd75378b5/target/easyjson.go#L1758-L1762
func (v *EventAttachedToTarget) UnmarshalJSON(data []byte) error { r := jlexer.Lexer{Data: data} easyjsonC5a4559bDecodeGithubComChromedpCdprotoTarget19(&r, v) return r.Error() }
https://github.com/kubernetes/test-infra/blob/8125fbda10178887be5dff9e901d6a0a519b67bc/config/jobs/kubernetes-security/genjobs.go#L107-L114
func undoPresubmitPresets(presets []config.Preset, presubmit *config.Presubmit) { if presubmit.Spec == nil { return } for _, preset := range presets { undoPreset(&preset, presubmit.Labels, presubmit.Spec) } }
https://github.com/t3rm1n4l/nitro/blob/937fe99f63a01a8bea7661c49e2f3f8af6541d7c/nitro.go#L220-L223
func (w *Writer) Delete(bs []byte) (success bool) { _, success = w.Delete2(bs) return }
https://github.com/llgcode/draw2d/blob/f52c8a71aff06ab8df41843d33ab167b36c971cd/draw2dbase/stack_gc.go#L45-L48
func (cs *ContextStack) GetFontName() string { fontData := cs.FontData return fmt.Sprintf("%s:%d:%d:%9.2f", fontData.Name, fontData.Family, fontData.Style, cs.FontSize) }
https://github.com/rightscale/rsc/blob/96079a1ee7238dae9cbb7efa77dd94a479d217bd/displayer.go#L40-L66
func (d *Displayer) ApplySingleExtract(extract string) error { if err := d.ApplyExtract(extract, true); err != nil { return err } outputs := d.RawOutput.([]interface{}) if len(outputs) != 1 { d.RawOutput = nil return fmt.Errorf("JSON selector '%s' returned %d instead of one value", extract, len(outputs)) } if len(outputs) == 0 { d.RawOutput = "" } else { switch v := outputs[0].(type) { case nil: d.RawOutput = "" case float64, bool: d.RawOutput = fmt.Sprint(v) case string: d.RawOutput = v default: d.RawOutput = v } d.RawOutput = outputs[0] } return nil }
https://github.com/chromedp/cdproto/blob/d40c70bcdf242660a32f2eadf323662dd75378b5/heapprofiler/easyjson.go#L516-L520
func (v SamplingHeapProfileSample) MarshalJSON() ([]byte, error) { w := jwriter.Writer{} easyjsonC5a4559bEncodeGithubComChromedpCdprotoHeapprofiler6(&w, v) return w.Buffer.BuildBytes(), w.Error }
https://github.com/chromedp/cdproto/blob/d40c70bcdf242660a32f2eadf323662dd75378b5/target/target.go#L340-L343
func (p DetachFromTargetParams) WithSessionID(sessionID SessionID) *DetachFromTargetParams { p.SessionID = sessionID return &p }
https://github.com/ianschenck/envflag/blob/9111d830d133f952887a936367fb0211c3134f0d/envflag.go#L109-L111
func Uint64Var(p *uint64, name string, value uint64, usage string) { EnvironmentFlags.Uint64Var(p, name, value, usage) }
https://github.com/chromedp/cdproto/blob/d40c70bcdf242660a32f2eadf323662dd75378b5/input/easyjson.go#L1058-L1062
func (v DispatchTouchEventParams) MarshalJSON() ([]byte, error) { w := jwriter.Writer{} easyjsonC5a4559bEncodeGithubComChromedpCdprotoInput7(&w, v) return w.Buffer.BuildBytes(), w.Error }
https://github.com/etcd-io/etcd/blob/616592d9ba993e3fe9798eef581316016df98906/raft/log.go#L306-L344
func (l *raftLog) slice(lo, hi, maxSize uint64) ([]pb.Entry, error) { err := l.mustCheckOutOfBounds(lo, hi) if err != nil { return nil, err } if lo == hi { return nil, nil } var ents []pb.Entry if lo < l.unstable.offset { storedEnts, err := l.storage.Entries(lo, min(hi, l.unstable.offset), maxSize) if err == ErrCompacted { return nil, err } else if err == ErrUnavailable { l.logger.Panicf("entries[%d:%d) is unavailable from storage", lo, min(hi, l.unstable.offset)) } else if err != nil { panic(err) // TODO(bdarnell) } // check if ents has reached the size limitation if uint64(len(storedEnts)) < min(hi, l.unstable.offset)-lo { return storedEnts, nil } ents = storedEnts } if hi > l.unstable.offset { unstable := l.unstable.slice(max(lo, l.unstable.offset), hi) if len(ents) > 0 { combined := make([]pb.Entry, len(ents)+len(unstable)) n := copy(combined, ents) copy(combined[n:], unstable) ents = combined } else { ents = unstable } } return limitSize(ents, maxSize), nil }
https://github.com/kubernetes/test-infra/blob/8125fbda10178887be5dff9e901d6a0a519b67bc/prow/statusreconciler/controller.go#L293-L339
func addedBlockingPresubmits(old, new map[string][]config.Presubmit) map[string][]config.Presubmit { added := map[string][]config.Presubmit{} for repo, oldPresubmits := range old { added[repo] = []config.Presubmit{} for _, newPresubmit := range new[repo] { if !newPresubmit.ContextRequired() || newPresubmit.NeedsExplicitTrigger() { continue } var found bool for _, oldPresubmit := range oldPresubmits { if oldPresubmit.Name == newPresubmit.Name { if oldPresubmit.SkipReport && !newPresubmit.SkipReport { added[repo] = append(added[repo], newPresubmit) logrus.WithFields(logrus.Fields{ "repo": repo, "name": oldPresubmit.Name, }).Debug("Identified a newly-reporting blocking presubmit.") } if oldPresubmit.RunIfChanged != newPresubmit.RunIfChanged { added[repo] = append(added[repo], newPresubmit) logrus.WithFields(logrus.Fields{ "repo": repo, "name": oldPresubmit.Name, }).Debug("Identified a blocking presubmit running over a different set of files.") } found = true break } } if !found { added[repo] = append(added[repo], newPresubmit) logrus.WithFields(logrus.Fields{ "repo": repo, "name": newPresubmit.Name, }).Debug("Identified an added blocking presubmit.") } } } var numAdded int for _, presubmits := range added { numAdded += len(presubmits) } logrus.Infof("Identified %d added blocking presubmits.", numAdded) return added }
https://github.com/kubernetes/test-infra/blob/8125fbda10178887be5dff9e901d6a0a519b67bc/robots/issue-creator/sources/triage-filer.go#L285-L322
func parseTriageData(jsonIn []byte) (*triageData, error) { var data triageData if err := json.Unmarshal(jsonIn, &data); err != nil { return nil, err } if data.Builds.Cols.Started == nil { return nil, fmt.Errorf("triage data json is missing the builds.cols.started key") } if data.Builds.JobsRaw == nil { return nil, fmt.Errorf("triage data is missing the builds.jobs key") } if data.Builds.JobPaths == nil { return nil, fmt.Errorf("triage data is missing the builds.job_paths key") } if data.Clustered == nil { return nil, fmt.Errorf("triage data is missing the clustered key") } // Populate 'Jobs' with the BuildIndexer for each job. data.Builds.Jobs = make(map[string]BuildIndexer) for jobID, mapper := range data.Builds.JobsRaw { switch mapper := mapper.(type) { case []interface{}: // In this case mapper is a 3 member array. 0:first buildnum, 1:number of builds, 2:start index. data.Builds.Jobs[jobID] = ContigIndexer{ startBuild: int(mapper[0].(float64)), count: int(mapper[1].(float64)), startRow: int(mapper[2].(float64)), } case map[string]interface{}: // In this case mapper is a dictionary. data.Builds.Jobs[jobID] = DictIndexer(mapper) default: return nil, fmt.Errorf("the build number to row index mapping for job '%s' is not an accepted type. Type is: %v", jobID, reflect.TypeOf(mapper)) } } return &data, nil }
https://github.com/lxc/lxd/blob/7a41d14e4c1a6bc25918aca91004d594774dcdd3/lxd/api.go#L123-L140
func queryParam(request *http.Request, key string) string { var values url.Values var err error if request.URL != nil { values, err = url.ParseQuery(request.URL.RawQuery) if err != nil { logger.Warnf("Failed to parse query string %q: %v", request.URL.RawQuery, err) return "" } } if values == nil { values = make(url.Values) } return values.Get(key) }
https://github.com/etcd-io/etcd/blob/616592d9ba993e3fe9798eef581316016df98906/etcdserver/api/rafthttp/stream.go#L132-L149
func startStreamWriter(lg *zap.Logger, local, id types.ID, status *peerStatus, fs *stats.FollowerStats, r Raft) *streamWriter { w := &streamWriter{ lg: lg, localID: local, peerID: id, status: status, fs: fs, r: r, msgc: make(chan raftpb.Message, streamBufSize), connc: make(chan *outgoingConn), stopc: make(chan struct{}), done: make(chan struct{}), } go w.run() return w }
https://github.com/kubernetes/test-infra/blob/8125fbda10178887be5dff9e901d6a0a519b67bc/robots/coverage/diff/diff.go#L44-L50
func toMap(g *calculation.CoverageList) map[string]calculation.Coverage { m := make(map[string]calculation.Coverage) for _, cov := range g.Group { m[cov.Name] = cov } return m }
https://github.com/chromedp/cdproto/blob/d40c70bcdf242660a32f2eadf323662dd75378b5/input/input.go#L469-L472
func (p SynthesizeScrollGestureParams) WithYDistance(yDistance float64) *SynthesizeScrollGestureParams { p.YDistance = yDistance return &p }
https://github.com/pachyderm/pachyderm/blob/94fb2d536cb6852a77a49e8f777dc9c1bde2c723/src/server/pkg/cmdutil/cobra.go#L45-L51
func Run(run func(args []string) error) func(*cobra.Command, []string) { return func(_ *cobra.Command, args []string) { if err := run(args); err != nil { ErrorAndExit(err.Error()) } } }
https://github.com/chromedp/cdproto/blob/d40c70bcdf242660a32f2eadf323662dd75378b5/css/easyjson.go#L2183-L2187
func (v *SetKeyframeKeyParams) UnmarshalJSON(data []byte) error { r := jlexer.Lexer{Data: data} easyjsonC5a4559bDecodeGithubComChromedpCdprotoCss20(&r, v) return r.Error() }
https://github.com/pantheon-systems/go-certauth/blob/8764720d23a5034dd9fab090815b7859463c68f6/certauth.go#L63-L78
func NewAuth(opts ...Options) *Auth { o := Options{} if len(opts) != 0 { o = opts[0] } h := defaultAuthErrorHandler if o.AuthErrorHandler != nil { h = o.AuthErrorHandler } return &Auth{ opt: o, authErrHandler: http.HandlerFunc(h), } }
https://github.com/chromedp/cdproto/blob/d40c70bcdf242660a32f2eadf323662dd75378b5/debugger/easyjson.go#L1988-L1992
func (v *SearchInContentReturns) UnmarshalJSON(data []byte) error { r := jlexer.Lexer{Data: data} easyjsonC5a4559bDecodeGithubComChromedpCdprotoDebugger20(&r, v) return r.Error() }
https://github.com/kubernetes/test-infra/blob/8125fbda10178887be5dff9e901d6a0a519b67bc/prow/github/client.go#L233-L248
func NewClientWithFields(fields logrus.Fields, getToken func() []byte, graphqlEndpoint string, bases ...string) *Client { return &Client{ logger: logrus.WithFields(fields).WithField("client", "github"), time: &standardTime{}, gqlc: githubql.NewEnterpriseClient( graphqlEndpoint, &http.Client{ Timeout: maxRequestTime, Transport: &oauth2.Transport{Source: newReloadingTokenSource(getToken)}, }), client: &http.Client{Timeout: maxRequestTime}, bases: bases, getToken: getToken, dry: false, } }
https://github.com/omniscale/go-mapnik/blob/710dfcc5e486e5760d0a5c46be909d91968e1ffb/mapnik.go#L171-L175
func (m *Map) ZoomTo(minx, miny, maxx, maxy float64) { bbox := C.mapnik_bbox(C.double(minx), C.double(miny), C.double(maxx), C.double(maxy)) defer C.mapnik_bbox_free(bbox) C.mapnik_map_zoom_to_box(m.m, bbox) }
https://github.com/lxc/lxd/blob/7a41d14e4c1a6bc25918aca91004d594774dcdd3/lxd/storage_zfs_utils.go#L20-L27
func zfsIsEnabled() bool { out, err := exec.LookPath("zfs") if err != nil || len(out) == 0 { return false } return true }
https://github.com/HiLittleCat/core/blob/ae2101184ecd36354d3fcff0ea69d67d3fdbe156/context.go#L342-L345
func (w contextWriter) WriteHeader(code int) { w.context.written = true w.ResponseWriter.WriteHeader(code) }
https://github.com/kubernetes/test-infra/blob/8125fbda10178887be5dff9e901d6a0a519b67bc/boskos/mason/mason.go#L513-L520
func (m *Mason) UpdateConfigs(storagePath string) error { configs, err := ParseConfig(storagePath) if err != nil { logrus.WithError(err).Error("unable to parse config") return err } return m.storage.SyncConfigs(configs) }
https://github.com/chromedp/cdproto/blob/d40c70bcdf242660a32f2eadf323662dd75378b5/serviceworker/serviceworker.go#L144-L146
func (p *SetForceUpdateOnPageLoadParams) Do(ctx context.Context) (err error) { return cdp.Execute(ctx, CommandSetForceUpdateOnPageLoad, p, nil) }
https://github.com/containers/image/blob/da9ab3561ad2031aeb5e036b7cf2755d4e246fec/openshift/openshift-copies.go#L236-L247
func getServerIdentificationPartialConfig(configAuthInfo clientcmdAuthInfo, configClusterInfo clientcmdCluster) (*restConfig, error) { mergedConfig := &restConfig{} // configClusterInfo holds the information identify the server provided by .kubeconfig configClientConfig := &restConfig{} configClientConfig.CAFile = configClusterInfo.CertificateAuthority configClientConfig.CAData = configClusterInfo.CertificateAuthorityData configClientConfig.Insecure = configClusterInfo.InsecureSkipTLSVerify mergo.Merge(mergedConfig, configClientConfig) return mergedConfig, nil }
https://github.com/xwb1989/sqlparser/blob/120387863bf27d04bc07db8015110a6e96d0146c/dependency/sqltypes/value.go#L204-L212
func (v Value) String() string { if v.typ == Null { return "NULL" } if v.IsQuoted() { return fmt.Sprintf("%v(%q)", v.typ, v.val) } return fmt.Sprintf("%v(%s)", v.typ, v.val) }
https://github.com/kubernetes/test-infra/blob/8125fbda10178887be5dff9e901d6a0a519b67bc/prow/github/fakegithub/fakegithub.go#L218-L220
func (f *FakeClient) GetRef(owner, repo, ref string) (string, error) { return TestRef, nil }
https://github.com/onsi/gomega/blob/f0e010e04c08c48a875f83d17df37b04eb3a985b/ghttp/handlers.go#L147-L155
func VerifyForm(values url.Values) http.HandlerFunc { return func(w http.ResponseWriter, r *http.Request) { err := r.ParseForm() Expect(err).ShouldNot(HaveOccurred()) for key, vals := range values { Expect(r.Form[key]).Should(Equal(vals), "Form mismatch for key: %s", key) } } }
https://github.com/lxc/lxd/blob/7a41d14e4c1a6bc25918aca91004d594774dcdd3/lxd/util/http.go#L229-L264
func GetListeners(start int) []net.Listener { defer func() { os.Unsetenv("LISTEN_PID") os.Unsetenv("LISTEN_FDS") }() pid, err := strconv.Atoi(os.Getenv("LISTEN_PID")) if err != nil { return nil } if pid != os.Getpid() { return nil } fds, err := strconv.Atoi(os.Getenv("LISTEN_FDS")) if err != nil { return nil } listeners := []net.Listener{} for i := start; i < start+fds; i++ { syscall.CloseOnExec(i) file := os.NewFile(uintptr(i), fmt.Sprintf("inherited-fd%d", i)) listener, err := net.FileListener(file) if err != nil { continue } listeners = append(listeners, listener) } return listeners }
https://github.com/chromedp/cdproto/blob/d40c70bcdf242660a32f2eadf323662dd75378b5/animation/animation.go#L133-L135
func (p *ReleaseAnimationsParams) Do(ctx context.Context) (err error) { return cdp.Execute(ctx, CommandReleaseAnimations, p, nil) }
https://github.com/dgraph-io/badger/blob/6b796b3ebec3ff006fcb1b425836cd784651e9fd/y/watermark.go#L107-L109
func (w *WaterMark) SetDoneUntil(val uint64) { atomic.StoreUint64(&w.doneUntil, val) }
https://github.com/pachyderm/pachyderm/blob/94fb2d536cb6852a77a49e8f777dc9c1bde2c723/src/client/pfs.go#L757-L763
func (c APIClient) ReadTag(tag string) ([]byte, error) { var buffer bytes.Buffer if err := c.GetTag(tag, &buffer); err != nil { return nil, err } return buffer.Bytes(), nil }
https://github.com/pachyderm/pachyderm/blob/94fb2d536cb6852a77a49e8f777dc9c1bde2c723/src/server/pkg/deploy/assets/assets.go#L876-L893
func EtcdVolumeClaim(size int, opts *AssetOpts) *v1.PersistentVolumeClaim { return &v1.PersistentVolumeClaim{ TypeMeta: metav1.TypeMeta{ Kind: "PersistentVolumeClaim", APIVersion: "v1", }, ObjectMeta: objectMeta(etcdVolumeClaimName, labels(etcdName), nil, opts.Namespace), Spec: v1.PersistentVolumeClaimSpec{ Resources: v1.ResourceRequirements{ Requests: map[v1.ResourceName]resource.Quantity{ "storage": resource.MustParse(fmt.Sprintf("%vGi", size)), }, }, AccessModes: []v1.PersistentVolumeAccessMode{v1.ReadWriteOnce}, VolumeName: etcdVolumeName, }, } }
https://github.com/gobuffalo/buffalo/blob/7f360181f4ccd79dcc9dcea2c904a4801f194f04/binding/binding.go#L59-L62
func RegisterCustomDecoder(fn CustomTypeDecoder, types []interface{}, fields []interface{}) { rawFunc := (func([]string) (interface{}, error))(fn) decoder.RegisterCustomType(rawFunc, types, fields) }
https://github.com/chromedp/cdproto/blob/d40c70bcdf242660a32f2eadf323662dd75378b5/page/easyjson.go#L3318-L3322
func (v *GetNavigationHistoryParams) UnmarshalJSON(data []byte) error { r := jlexer.Lexer{Data: data} easyjsonC5a4559bDecodeGithubComChromedpCdprotoPage35(&r, v) return r.Error() }
https://github.com/chromedp/cdproto/blob/d40c70bcdf242660a32f2eadf323662dd75378b5/applicationcache/easyjson.go#L105-L109
func (v *Resource) UnmarshalJSON(data []byte) error { r := jlexer.Lexer{Data: data} easyjsonC5a4559bDecodeGithubComChromedpCdprotoApplicationcache(&r, v) return r.Error() }
https://github.com/lxc/lxd/blob/7a41d14e4c1a6bc25918aca91004d594774dcdd3/lxd/storage_ceph_utils.go#L772-L848
func (s *storageCeph) copyWithoutSnapshotsSparse(target container, source container) error { logger.Debugf(`Creating sparse copy of RBD storage volume for container "%s" to "%s" without snapshots`, source.Name(), target.Name()) sourceIsSnapshot := source.IsSnapshot() sourceContainerName := projectPrefix(source.Project(), source.Name()) targetContainerName := projectPrefix(target.Project(), target.Name()) sourceContainerOnlyName := sourceContainerName sourceSnapshotOnlyName := "" snapshotName := fmt.Sprintf("zombie_snapshot_%s", uuid.NewRandom().String()) if sourceIsSnapshot { sourceContainerOnlyName, sourceSnapshotOnlyName, _ = containerGetParentAndSnapshotName(sourceContainerName) snapshotName = fmt.Sprintf("snapshot_%s", sourceSnapshotOnlyName) } else { // create snapshot err := cephRBDSnapshotCreate(s.ClusterName, s.OSDPoolName, sourceContainerName, storagePoolVolumeTypeNameContainer, snapshotName, s.UserName) if err != nil { logger.Errorf(`Failed to create snapshot for RBD storage volume for image "%s" on storage pool "%s": %s`, targetContainerName, s.pool.Name, err) return err } } // protect volume so we can create clones of it err := cephRBDSnapshotProtect(s.ClusterName, s.OSDPoolName, sourceContainerOnlyName, storagePoolVolumeTypeNameContainer, snapshotName, s.UserName) if err != nil { logger.Errorf(`Failed to protect snapshot for RBD storage volume for image "%s" on storage pool "%s": %s`, snapshotName, s.pool.Name, err) return err } err = cephRBDCloneCreate(s.ClusterName, s.OSDPoolName, sourceContainerOnlyName, storagePoolVolumeTypeNameContainer, snapshotName, s.OSDPoolName, targetContainerName, storagePoolVolumeTypeNameContainer, s.UserName) if err != nil { logger.Errorf(`Failed to clone new RBD storage volume for container "%s": %s`, targetContainerName, err) return err } // Re-generate the UUID err = s.cephRBDGenerateUUID(projectPrefix(target.Project(), target.Name()), storagePoolVolumeTypeNameContainer) if err != nil { return err } // Create mountpoint targetContainerMountPoint := getContainerMountPoint(target.Project(), s.pool.Name, target.Name()) err = createContainerMountpoint(targetContainerMountPoint, target.Path(), target.IsPrivileged()) if err != nil { return err } ourMount, err := target.StorageStart() if err != nil { return err } if ourMount { defer target.StorageStop() } err = target.TemplateApply("copy") if err != nil { logger.Errorf(`Failed to apply copy template for container "%s": %s`, target.Name(), err) return err } logger.Debugf(`Applied copy template for container "%s"`, target.Name()) logger.Debugf(`Created sparse copy of RBD storage volume for container "%s" to "%s" without snapshots`, source.Name(), target.Name()) return nil }
https://github.com/xwb1989/sqlparser/blob/120387863bf27d04bc07db8015110a6e96d0146c/ast.go#L2777-L2784
func (node *SubstrExpr) Format(buf *TrackedBuffer) { if node.To == nil { buf.Myprintf("substr(%v, %v)", node.Name, node.From) } else { buf.Myprintf("substr(%v, %v, %v)", node.Name, node.From, node.To) } }
https://github.com/chromedp/cdproto/blob/d40c70bcdf242660a32f2eadf323662dd75378b5/runtime/runtime.go#L607-L610
func (p QueryObjectsParams) WithObjectGroup(objectGroup string) *QueryObjectsParams { p.ObjectGroup = objectGroup return &p }
https://github.com/containers/image/blob/da9ab3561ad2031aeb5e036b7cf2755d4e246fec/signature/signature.go#L216-L240
func verifyAndExtractSignature(mech SigningMechanism, unverifiedSignature []byte, rules signatureAcceptanceRules) (*Signature, error) { signed, keyIdentity, err := mech.Verify(unverifiedSignature) if err != nil { return nil, err } if err := rules.validateKeyIdentity(keyIdentity); err != nil { return nil, err } var unmatchedSignature untrustedSignature if err := json.Unmarshal(signed, &unmatchedSignature); err != nil { return nil, InvalidSignatureError{msg: err.Error()} } if err := rules.validateSignedDockerManifestDigest(unmatchedSignature.UntrustedDockerManifestDigest); err != nil { return nil, err } if err := rules.validateSignedDockerReference(unmatchedSignature.UntrustedDockerReference); err != nil { return nil, err } // signatureAcceptanceRules have accepted this value. return &Signature{ DockerManifestDigest: unmatchedSignature.UntrustedDockerManifestDigest, DockerReference: unmatchedSignature.UntrustedDockerReference, }, nil }
https://github.com/antlinker/go-dirtyfilter/blob/533f538ffaa112776b1258c3db63e6f55648e18b/store/memory.go#L76-L85
func (ms *MemoryStore) Read() <-chan string { chResult := make(chan string) go func() { for ele := range ms.dataStore.Elements() { chResult <- ele.Key.(string) } close(chResult) }() return chResult }
https://github.com/naoina/genmai/blob/78583835e1e41e3938e1ddfffd7101f8ad27fae0/genmai.go#L258-L260
func (db *DB) CreateUniqueIndex(table interface{}, name string, names ...string) error { return db.createIndex(table, true, name, names...) }