repo_name
stringlengths
2
55
dataset
stringclasses
1 value
owner
stringlengths
3
31
lang
stringclasses
10 values
func_name
stringlengths
1
104
code
stringlengths
20
96.7k
docstring
stringlengths
1
4.92k
url
stringlengths
94
241
sha
stringlengths
40
40
beyla
github_2023
grafana
go
ExtractReplicaSet
func ExtractReplicaSet(replicaSet *extensionsv1beta1.ReplicaSet, fieldManager string) (*ReplicaSetApplyConfiguration, error) { return extractReplicaSet(replicaSet, fieldManager, "") }
// ExtractReplicaSet extracts the applied configuration owned by fieldManager from // replicaSet. If no managedFields are found in replicaSet for fieldManager, a // ReplicaSetApplyConfiguration is returned with only the Name, Namespace (if applicable), // APIVersion and Kind populated. It is possible that no managed fields were found for because other // field managers have taken ownership of all the fields previously owned by fieldManager, or because // the fieldManager never owned fields any fields. // replicaSet must be a unmodified ReplicaSet API object that was retrieved from the Kubernetes API. // ExtractReplicaSet provides a way to perform a extract/modify-in-place/apply workflow. // Note that an extracted apply configuration will contain fewer fields than what the fieldManager previously // applied if another fieldManager has updated or force applied any of the previously applied fields. // Experimental!
https://github.com/grafana/beyla/blob/2f2517bd9e5824bcd315292e62102f361a216434/vendor/k8s.io/client-go/applyconfigurations/extensions/v1beta1/replicaset.go#L61-L63
2f2517bd9e5824bcd315292e62102f361a216434
beyla
github_2023
grafana
go
IsValidURI
func (r *Ref) IsValidURI(basepaths ...string) bool { if r.String() == "" { return true } v := r.RemoteURI() if v == "" { return true } if r.HasFullURL { rr, err := http.Get(v) if err != nil { return false } return rr.StatusCode/100 == 2 } if !(r.HasFileScheme || r.HasFullFilePath || r.HasURLPathOnly) { return false } // check for local file pth := v if r.HasURLPathOnly { base := "." if len(basepaths) > 0 { base = filepath.Dir(filepath.Join(basepaths...)) } p, e := filepath.Abs(filepath.ToSlash(filepath.Join(base, pth))) if e != nil { return false } pth = p } fi, err := os.Stat(filepath.ToSlash(pth)) if err != nil { return false } return !fi.IsDir() }
// IsValidURI returns true when the url the ref points to can be found
https://github.com/grafana/beyla/blob/2f2517bd9e5824bcd315292e62102f361a216434/vendor/k8s.io/kube-openapi/pkg/validation/spec/ref.go#L60-L103
2f2517bd9e5824bcd315292e62102f361a216434
beyla
github_2023
grafana
go
MultiMutatingHandler
func MultiMutatingHandler(handlers ...Handler) Handler { return multiMutating(handlers) }
// MultiMutatingHandler combines multiple mutating webhook handlers into a single // mutating webhook handler. Handlers are called in sequential order, and the first // `allowed: false` response may short-circuit the rest. Users must take care to // ensure patches are disjoint.
https://github.com/grafana/beyla/blob/2f2517bd9e5824bcd315292e62102f361a216434/vendor/sigs.k8s.io/controller-runtime/pkg/webhook/admission/multi.go#L67-L69
2f2517bd9e5824bcd315292e62102f361a216434
beyla
github_2023
grafana
go
fileExists
func fileExists(filePath string) bool { if _, err := os.Stat(filePath); err != nil { if os.IsNotExist(err) { return false } } return true }
// fileExists reports whether the named file or directory exists.
https://github.com/grafana/beyla/blob/2f2517bd9e5824bcd315292e62102f361a216434/vendor/sigs.k8s.io/e2e-framework/klient/conf/config.go#L144-L152
2f2517bd9e5824bcd315292e62102f361a216434
digger
github_2023
diggerhq
go
Save
func (u userPrivateInfoDo) Save(values ...*model.UserPrivateInfo) error { if len(values) == 0 { return nil } return u.DO.Save(values) }
// Save : !!! underlying implementation is different with GORM // The method is equivalent to executing the statement: db.Clauses(clause.OnConflict{UpdateAll: true}).Create(values)
https://github.com/diggerhq/digger/blob/aa90fe3a96c897be124388d4e47642a7b2aa765b/next/models_generated/user_private_info.gen.go#L265-L270
aa90fe3a96c897be124388d4e47642a7b2aa765b
junodb
github_2023
paypal
go
NewDBPathsFromData
func NewDBPathsFromData(paths []string, target_sizes []uint64) []*DBPath { dbpaths := make([]*DBPath, len(paths)) for i, path := range paths { targetSize := target_sizes[i] dbpaths[i] = NewDBPath(path, targetSize) } return dbpaths }
// NewDBPathsFromData creates a slice with allocated DBPath objects // from paths and target_sizes.
https://github.com/paypal/junodb/blob/9750751a5335111b7a536326df5925e78cad245d/third_party/patches/forked/tecbot/gorocksdb/dbpath.go#L33-L41
9750751a5335111b7a536326df5925e78cad245d
keep-sorted
github_2023
google
go
isNewline
func isNewline(lg lineGroup) bool { return len(lg.comment) == 0 && len(lg.lines) == 1 && strings.TrimSpace(lg.lines[0]) == "" }
// isNewline determines if lg is just an empty line.
https://github.com/google/keep-sorted/blob/8d641518728d604fd965ca442704d0356912e76b/keepsorted/block.go#L328-L330
8d641518728d604fd965ca442704d0356912e76b
gkit
github_2023
ml444
go
Validate
func (m *Fixed32NotIn) Validate() error { return m.validate(false) }
// Validate checks the field values on Fixed32NotIn with the rules defined in // the proto definition for this message. If any rules are violated, the first // error encountered is returned, or nil if there are no violations.
https://github.com/ml444/gkit/blob/6ce63f4114065d74e1eecc6d3ab578c60d8a1681/cmd/protoc-gen-go-validate/tests/cases/numbers_validate.pb.go#L4160-L4162
6ce63f4114065d74e1eecc6d3ab578c60d8a1681
cloud-provider-kind
github_2023
kubernetes-sigs
go
TimeValueMap
func TimeValueMap(src map[string]*time.Time) map[string]time.Time { dst := make(map[string]time.Time) for k, val := range src { if val != nil { dst[k] = *val } } return dst }
// TimeValueMap converts a string map of time.Time pointers into a string // map of time.Time values
https://github.com/kubernetes-sigs/cloud-provider-kind/blob/4b1de87e50fa9cab5d8ab80af7108cc233223620/vendor/github.com/go-openapi/swag/convert_types.go#L722-L730
4b1de87e50fa9cab5d8ab80af7108cc233223620
cloud-provider-kind
github_2023
kubernetes-sigs
go
RegisterFieldEncoder
func RegisterFieldEncoder(typ string, field string, encoder ValEncoder) { fieldEncoders[fmt.Sprintf("%s/%s", typ, field)] = encoder }
// RegisterFieldEncoder register TypeEncoder for a struct field
https://github.com/kubernetes-sigs/cloud-provider-kind/blob/4b1de87e50fa9cab5d8ab80af7108cc233223620/vendor/github.com/json-iterator/go/reflect_extension.go#L234-L236
4b1de87e50fa9cab5d8ab80af7108cc233223620
cloud-provider-kind
github_2023
kubernetes-sigs
go
Size
func (b *Buffer) Size() int { size := len(b.Buf) for _, buf := range b.bufs { size += len(buf) } return size }
// Size computes the size of a buffer by adding sizes of every chunk.
https://github.com/kubernetes-sigs/cloud-provider-kind/blob/4b1de87e50fa9cab5d8ab80af7108cc233223620/vendor/github.com/mailru/easyjson/buffer/pool.go#L161-L167
4b1de87e50fa9cab5d8ab80af7108cc233223620
cloud-provider-kind
github_2023
kubernetes-sigs
go
socket
func socket(domain int, typ int, proto int) (fd int, err error) { r0, er := C.socket(C.int(domain), C.int(typ), C.int(proto)) fd = int(r0) if r0 == -1 && er != nil { err = er } return }
// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT
https://github.com/kubernetes-sigs/cloud-provider-kind/blob/4b1de87e50fa9cab5d8ab80af7108cc233223620/vendor/golang.org/x/sys/unix/zsyscall_aix_ppc.go#L1155-L1162
4b1de87e50fa9cab5d8ab80af7108cc233223620
cloud-provider-kind
github_2023
kubernetes-sigs
go
Fadvise
func Fadvise(fd int, offset int64, length int64, advice int) (err error) { _, _, e1 := Syscall6(SYS_FADVISE64, uintptr(fd), uintptr(offset), uintptr(length), uintptr(advice), 0, 0) if e1 != 0 { err = errnoErr(e1) } return }
// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT
https://github.com/kubernetes-sigs/cloud-provider-kind/blob/4b1de87e50fa9cab5d8ab80af7108cc233223620/vendor/golang.org/x/sys/unix/zsyscall_linux_mips64le.go#L65-L71
4b1de87e50fa9cab5d8ab80af7108cc233223620
cloud-provider-kind
github_2023
kubernetes-sigs
go
Utime
func Utime(path string, buf *Utimbuf) (err error) { var _p0 *byte _p0, err = BytePtrFromString(path) if err != nil { return } _, _, e1 := Syscall(SYS_UTIME, uintptr(unsafe.Pointer(_p0)), uintptr(unsafe.Pointer(buf)), 0) if e1 != 0 { err = errnoErr(e1) } return }
// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT
https://github.com/kubernetes-sigs/cloud-provider-kind/blob/4b1de87e50fa9cab5d8ab80af7108cc233223620/vendor/golang.org/x/sys/unix/zsyscall_linux_ppc.go#L575-L586
4b1de87e50fa9cab5d8ab80af7108cc233223620
cloud-provider-kind
github_2023
kubernetes-sigs
go
IoctlGetPtmget
func IoctlGetPtmget(fd int, req uint) (*Ptmget, error) { var value Ptmget err := ioctlPtr(fd, req, unsafe.Pointer(&value)) return &value, err }
//sys ioctl(fd int, req uint, arg uintptr) (err error) //sys ioctlPtr(fd int, req uint, arg unsafe.Pointer) (err error) = SYS_IOCTL //sys sysctl(mib []_C_int, old *byte, oldlen *uintptr, new *byte, newlen uintptr) (err error) = SYS___SYSCTL
https://github.com/kubernetes-sigs/cloud-provider-kind/blob/4b1de87e50fa9cab5d8ab80af7108cc233223620/vendor/golang.org/x/sys/unix/syscall_netbsd.go#L184-L188
4b1de87e50fa9cab5d8ab80af7108cc233223620
cloud-provider-kind
github_2023
kubernetes-sigs
go
getgroups
func getgroups(ngid int, gid *_Gid_t) (n int, err error) { r0, _, e1 := syscall_rawSyscall(libc_getgroups_trampoline_addr, uintptr(ngid), uintptr(unsafe.Pointer(gid)), 0) n = int(r0) if e1 != 0 { err = errnoErr(e1) } return }
// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT
https://github.com/kubernetes-sigs/cloud-provider-kind/blob/4b1de87e50fa9cab5d8ab80af7108cc233223620/vendor/golang.org/x/sys/unix/zsyscall_openbsd_mips64.go#L17-L24
4b1de87e50fa9cab5d8ab80af7108cc233223620
cloud-provider-kind
github_2023
kubernetes-sigs
go
Fadvise
func Fadvise(fd int, offset int64, length int64, advice int) (err error) { _, _, e1 := Syscall9(SYS_POSIX_FADVISE, uintptr(fd), 0, uintptr(offset), uintptr(offset>>32), uintptr(length), uintptr(length>>32), uintptr(advice), 0, 0) if e1 != 0 { err = errnoErr(e1) } return }
// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT
https://github.com/kubernetes-sigs/cloud-provider-kind/blob/4b1de87e50fa9cab5d8ab80af7108cc233223620/vendor/golang.org/x/sys/unix/zsyscall_freebsd_arm.go#L828-L834
4b1de87e50fa9cab5d8ab80af7108cc233223620
cloud-provider-kind
github_2023
kubernetes-sigs
go
lookupValue
func (t *bidiTrie) lookupValue(n uint32, b byte) uint8 { switch { default: return uint8(bidiValues[n<<6+uint32(b)]) } }
// lookupValue determines the type of block n and looks up the value for b.
https://github.com/kubernetes-sigs/cloud-provider-kind/blob/4b1de87e50fa9cab5d8ab80af7108cc233223620/vendor/golang.org/x/text/unicode/bidi/tables9.0.0.go#L194-L199
4b1de87e50fa9cab5d8ab80af7108cc233223620
cloud-provider-kind
github_2023
kubernetes-sigs
go
Snapshot
func (e *Encoder) Snapshot() encoderState { return e.encoderState }
// Snapshot returns the current snapshot for use in Reset.
https://github.com/kubernetes-sigs/cloud-provider-kind/blob/4b1de87e50fa9cab5d8ab80af7108cc233223620/vendor/google.golang.org/protobuf/internal/encoding/text/encode.go#L260-L262
4b1de87e50fa9cab5d8ab80af7108cc233223620
cloud-provider-kind
github_2023
kubernetes-sigs
go
MustParse
func MustParse(str string) Quantity { q, err := ParseQuantity(str) if err != nil { panic(fmt.Errorf("cannot parse '%v': %v", str, err)) } return q }
// MustParse turns the given string into a quantity or panics; for tests // or other cases where you know the string is valid.
https://github.com/kubernetes-sigs/cloud-provider-kind/blob/4b1de87e50fa9cab5d8ab80af7108cc233223620/vendor/k8s.io/apimachinery/pkg/api/resource/quantity.go#L138-L144
4b1de87e50fa9cab5d8ab80af7108cc233223620
cloud-provider-kind
github_2023
kubernetes-sigs
go
RollingUpdateDeployment
func RollingUpdateDeployment() *RollingUpdateDeploymentApplyConfiguration { return &RollingUpdateDeploymentApplyConfiguration{} }
// RollingUpdateDeploymentApplyConfiguration constructs a declarative configuration of the RollingUpdateDeployment type for use with // apply.
https://github.com/kubernetes-sigs/cloud-provider-kind/blob/4b1de87e50fa9cab5d8ab80af7108cc233223620/vendor/k8s.io/client-go/applyconfigurations/extensions/v1beta1/rollingupdatedeployment.go#L34-L36
4b1de87e50fa9cab5d8ab80af7108cc233223620
cloud-provider-kind
github_2023
kubernetes-sigs
go
IngressTLS
func IngressTLS() *IngressTLSApplyConfiguration { return &IngressTLSApplyConfiguration{} }
// IngressTLSApplyConfiguration constructs a declarative configuration of the IngressTLS type for use with // apply.
https://github.com/kubernetes-sigs/cloud-provider-kind/blob/4b1de87e50fa9cab5d8ab80af7108cc233223620/vendor/k8s.io/client-go/applyconfigurations/networking/v1/ingresstls.go#L30-L32
4b1de87e50fa9cab5d8ab80af7108cc233223620
cloud-provider-kind
github_2023
kubernetes-sigs
go
ExtractResourceSliceStatus
func ExtractResourceSliceStatus(resourceSlice *resourcev1alpha3.ResourceSlice, fieldManager string) (*ResourceSliceApplyConfiguration, error) { return extractResourceSlice(resourceSlice, fieldManager, "status") }
// ExtractResourceSliceStatus is the same as ExtractResourceSlice except // that it extracts the status subresource applied configuration. // Experimental!
https://github.com/kubernetes-sigs/cloud-provider-kind/blob/4b1de87e50fa9cab5d8ab80af7108cc233223620/vendor/k8s.io/client-go/applyconfigurations/resource/v1alpha3/resourceslice.go#L66-L68
4b1de87e50fa9cab5d8ab80af7108cc233223620
chainloop
github_2023
chainloop-dev
go
CreatedAtIn
func CreatedAtIn(vs ...time.Time) predicate.Integration { return predicate.Integration(sql.FieldIn(FieldCreatedAt, vs...)) }
// CreatedAtIn applies the In predicate on the "created_at" field.
https://github.com/chainloop-dev/chainloop/blob/a5f4b377b1676bbe7fb1deb146964d13f6caf9fb/app/controlplane/pkg/data/ent/integration/where.go#L375-L377
a5f4b377b1676bbe7fb1deb146964d13f6caf9fb
go-easy-utils
github_2023
jefferyjob
go
AnyToInt
func AnyToInt(i any) (int, error) { v, err := AnyToInt64(i) if err != nil { return 0, err } // int 兼容32位和64位系统 //if int64(int(v)) != v { // return 0, ErrValOut //} return int(v), nil }
// AnyToInt 将给定的值转换为 int
https://github.com/jefferyjob/go-easy-utils/blob/5cc229e3a6de69f3f038a8d7468a990a250a45e2/anyUtil/any_to_int_x.go#L10-L22
5cc229e3a6de69f3f038a8d7468a990a250a45e2
evilginx2-TTPs
github_2023
aalex954
go
ChallengeBlocks
func ChallengeBlocks(domain, keyAuth string) ([]byte, []byte, error) { // Compute the SHA-256 digest of the key authorization. zBytes := sha256.Sum256([]byte(keyAuth)) value, err := asn1.Marshal(zBytes[:sha256.Size]) if err != nil { return nil, nil, err } // Add the keyAuth digest as the acmeValidation-v1 extension // (marked as critical such that it won't be used by non-ACME software). // Reference: https://tools.ietf.org/html/draft-ietf-acme-tls-alpn-05#section-3 extensions := []pkix.Extension{ { Id: idPeAcmeIdentifierV1, Critical: true, Value: value, }, } // Generate a new RSA key for the certificates. tempPrivateKey, err := certcrypto.GeneratePrivateKey(certcrypto.RSA2048) if err != nil { return nil, nil, err } rsaPrivateKey := tempPrivateKey.(*rsa.PrivateKey) // Generate the PEM certificate using the provided private key, domain, and extra extensions. tempCertPEM, err := certcrypto.GeneratePemCert(rsaPrivateKey, domain, extensions) if err != nil { return nil, nil, err } // Encode the private key into a PEM format. We'll need to use it to generate the x509 keypair. rsaPrivatePEM := certcrypto.PEMEncode(rsaPrivateKey) return tempCertPEM, rsaPrivatePEM, nil }
// ChallengeBlocks returns PEM blocks (certPEMBlock, keyPEMBlock) with the acmeValidation-v1 extension // and domain name for the `tls-alpn-01` challenge.
https://github.com/aalex954/evilginx2-TTPs/blob/6813b69e5eed2c14da2a57c8627cfb2bffb2cd5b/vendor/github.com/go-acme/lego/v3/challenge/tlsalpn01/tls_alpn_challenge.go#L75-L113
6813b69e5eed2c14da2a57c8627cfb2bffb2cd5b
evilginx2-TTPs
github_2023
aalex954
go
callgetsystemcfg
func callgetsystemcfg(label int) (r1 uintptr, e1 Errno) { r1 = uintptr(C.getsystemcfg(C.int(label))) e1 = syscall.GetErrno() return }
// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT
https://github.com/aalex954/evilginx2-TTPs/blob/6813b69e5eed2c14da2a57c8627cfb2bffb2cd5b/vendor/golang.org/x/sys/unix/zsyscall_aix_ppc64_gccgo.go#L1026-L1030
6813b69e5eed2c14da2a57c8627cfb2bffb2cd5b
evilginx2-TTPs
github_2023
aalex954
go
ExtattrListFile
func ExtattrListFile(file string, attrnamespace int, data uintptr, nbytes int) (ret int, err error) { var _p0 *byte _p0, err = BytePtrFromString(file) if err != nil { return } r0, _, e1 := Syscall6(SYS_EXTATTR_LIST_FILE, uintptr(unsafe.Pointer(_p0)), uintptr(attrnamespace), uintptr(data), uintptr(nbytes), 0, 0) ret = int(r0) if e1 != 0 { err = errnoErr(e1) } return }
// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT
https://github.com/aalex954/evilginx2-TTPs/blob/6813b69e5eed2c14da2a57c8627cfb2bffb2cd5b/vendor/golang.org/x/sys/unix/zsyscall_freebsd_arm64.go#L704-L716
6813b69e5eed2c14da2a57c8627cfb2bffb2cd5b
evilginx2-TTPs
github_2023
aalex954
go
Setrlimit
func Setrlimit(resource int, rlim *Rlimit) (err error) { _, e1 := callsetrlimit(resource, uintptr(unsafe.Pointer(rlim))) if e1 != 0 { err = errnoErr(e1) } return }
// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT
https://github.com/aalex954/evilginx2-TTPs/blob/6813b69e5eed2c14da2a57c8627cfb2bffb2cd5b/vendor/golang.org/x/sys/unix/zsyscall_aix_ppc64.go#L1414-L1420
6813b69e5eed2c14da2a57c8627cfb2bffb2cd5b
evilginx2-TTPs
github_2023
aalex954
go
ExtattrGetFd
func ExtattrGetFd(fd int, attrnamespace int, attrname string, data uintptr, nbytes int) (ret int, err error) { var _p0 *byte _p0, err = BytePtrFromString(attrname) if err != nil { return } r0, _, e1 := Syscall6(SYS_EXTATTR_GET_FD, uintptr(fd), uintptr(attrnamespace), uintptr(unsafe.Pointer(_p0)), uintptr(data), uintptr(nbytes), 0) ret = int(r0) if e1 != 0 { err = errnoErr(e1) } return }
// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT
https://github.com/aalex954/evilginx2-TTPs/blob/6813b69e5eed2c14da2a57c8627cfb2bffb2cd5b/vendor/golang.org/x/sys/unix/zsyscall_netbsd_386.go#L573-L585
6813b69e5eed2c14da2a57c8627cfb2bffb2cd5b
evilginx2-TTPs
github_2023
aalex954
go
Access
func Access(path string, mode uint32) (err error) { var _p0 *byte _p0, err = BytePtrFromString(path) if err != nil { return } _, _, e1 := Syscall(SYS_ACCESS, uintptr(unsafe.Pointer(_p0)), uintptr(mode), 0) if e1 != 0 { err = errnoErr(e1) } return }
// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT
https://github.com/aalex954/evilginx2-TTPs/blob/6813b69e5eed2c14da2a57c8627cfb2bffb2cd5b/vendor/golang.org/x/sys/unix/zsyscall_netbsd_arm.go#L425-L436
6813b69e5eed2c14da2a57c8627cfb2bffb2cd5b
evilginx2-TTPs
github_2023
aalex954
go
Kill
func Kill(pid int, signum syscall.Signal) (err error) { _, _, e1 := Syscall(SYS_KILL, uintptr(pid), uintptr(signum), 0) if e1 != 0 { err = errnoErr(e1) } return }
// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT
https://github.com/aalex954/evilginx2-TTPs/blob/6813b69e5eed2c14da2a57c8627cfb2bffb2cd5b/vendor/golang.org/x/sys/unix/zsyscall_freebsd_arm.go#L1173-L1179
6813b69e5eed2c14da2a57c8627cfb2bffb2cd5b
evilginx2-TTPs
github_2023
aalex954
go
ExtattrListFd
func ExtattrListFd(fd int, attrnamespace int, data uintptr, nbytes int) (ret int, err error) { r0, _, e1 := Syscall6(SYS_EXTATTR_LIST_FD, uintptr(fd), uintptr(attrnamespace), uintptr(data), uintptr(nbytes), 0, 0) ret = int(r0) if e1 != 0 { err = errnoErr(e1) } return }
// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT
https://github.com/aalex954/evilginx2-TTPs/blob/6813b69e5eed2c14da2a57c8627cfb2bffb2cd5b/vendor/golang.org/x/sys/unix/zsyscall_freebsd_amd64.go#L631-L638
6813b69e5eed2c14da2a57c8627cfb2bffb2cd5b
evilginx2-TTPs
github_2023
aalex954
go
callfchown
func callfchown(fd int, uid int, gid int) (r1 uintptr, e1 Errno) { r1, _, e1 = syscall6(uintptr(unsafe.Pointer(&libc_fchown)), 3, uintptr(fd), uintptr(uid), uintptr(gid), 0, 0, 0) return }
// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT
https://github.com/aalex954/evilginx2-TTPs/blob/6813b69e5eed2c14da2a57c8627cfb2bffb2cd5b/vendor/golang.org/x/sys/unix/zsyscall_aix_ppc64_gc.go#L797-L800
6813b69e5eed2c14da2a57c8627cfb2bffb2cd5b
evilginx2-TTPs
github_2023
aalex954
go
KeyctlString
func KeyctlString(cmd int, id int) (string, error) { // We must loop as the string data may change in between the syscalls. // We could allocate a large buffer here to reduce the chance that the // syscall needs to be called twice; however, this is unnecessary as // the performance loss is negligible. var buffer []byte for { // Try to fill the buffer with data length, err := KeyctlBuffer(cmd, id, buffer, 0) if err != nil { return "", err } // Check if the data was written if length <= len(buffer) { // Exclude the null terminator return string(buffer[:length-1]), nil } // Make a bigger buffer if needed buffer = make([]byte, length) } }
// Keyctl Commands (http://man7.org/linux/man-pages/man2/keyctl.2.html) // KeyctlInt calls keyctl commands in which each argument is an int. // These commands are KEYCTL_REVOKE, KEYCTL_CHOWN, KEYCTL_CLEAR, KEYCTL_LINK, // KEYCTL_UNLINK, KEYCTL_NEGATE, KEYCTL_SET_REQKEY_KEYRING, KEYCTL_SET_TIMEOUT, // KEYCTL_ASSUME_AUTHORITY, KEYCTL_SESSION_TO_PARENT, KEYCTL_REJECT, // KEYCTL_INVALIDATE, and KEYCTL_GET_PERSISTENT. //sys KeyctlInt(cmd int, arg2 int, arg3 int, arg4 int, arg5 int) (ret int, err error) = SYS_KEYCTL // KeyctlBuffer calls keyctl commands in which the third and fourth // arguments are a buffer and its length, respectively. // These commands are KEYCTL_UPDATE, KEYCTL_READ, and KEYCTL_INSTANTIATE. //sys KeyctlBuffer(cmd int, arg2 int, buf []byte, arg5 int) (ret int, err error) = SYS_KEYCTL // KeyctlString calls keyctl commands which return a string. // These commands are KEYCTL_DESCRIBE and KEYCTL_GET_SECURITY.
https://github.com/aalex954/evilginx2-TTPs/blob/6813b69e5eed2c14da2a57c8627cfb2bffb2cd5b/vendor/golang.org/x/sys/unix/syscall_linux.go#L1201-L1223
6813b69e5eed2c14da2a57c8627cfb2bffb2cd5b
fleek
github_2023
ublue-os
go
NewError
func NewError(reason string) *Error { return &Error{reason: reason} }
// NewError returns a new error.
https://github.com/ublue-os/fleek/blob/2beec3661ab231c03034b817b3b4ee60125e3173/vendor/github.com/go-git/go-git/v5/plumbing/format/packfile/error.go#L11-L13
2beec3661ab231c03034b817b3b4ee60125e3173
fleek
github_2023
ublue-os
go
Changed
func (f *FlagSet) Changed(name string) bool { flag := f.Lookup(name) // If a flag doesn't exist, it wasn't changed.... if flag == nil { return false } return flag.Changed }
// Changed returns true if the flag was explicitly set during Parse() and false // otherwise
https://github.com/ublue-os/fleek/blob/2beec3661ab231c03034b817b3b4ee60125e3173/vendor/github.com/spf13/pflag/flag.go#L508-L515
2beec3661ab231c03034b817b3b4ee60125e3173
fleek
github_2023
ublue-os
go
Fstat
func Fstat(fd int, stat *Stat_t) (err error) { _, _, e1 := Syscall(SYS_FSTAT, uintptr(fd), uintptr(unsafe.Pointer(stat)), 0) if e1 != 0 { err = errnoErr(e1) } return }
// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT
https://github.com/ublue-os/fleek/blob/2beec3661ab231c03034b817b3b4ee60125e3173/vendor/golang.org/x/sys/unix/zsyscall_linux_arm64.go#L85-L91
2beec3661ab231c03034b817b3b4ee60125e3173
fleek
github_2023
ublue-os
go
pread
func pread(fd int, p []byte, offset int64) (n int, err error) { var _p0 unsafe.Pointer if len(p) > 0 { _p0 = unsafe.Pointer(&p[0]) } else { _p0 = unsafe.Pointer(&_zero) } r0, _, e1 := syscall_syscall6(libc_pread_trampoline_addr, uintptr(fd), uintptr(_p0), uintptr(len(p)), 0, uintptr(offset), uintptr(offset>>32)) n = int(r0) if e1 != 0 { err = errnoErr(e1) } return }
//go:cgo_import_dynamic libc_pathconf pathconf "libc.so" // THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT
https://github.com/ublue-os/fleek/blob/2beec3661ab231c03034b817b3b4ee60125e3173/vendor/golang.org/x/sys/unix/zsyscall_openbsd_arm.go#L1570-L1583
2beec3661ab231c03034b817b3b4ee60125e3173
fleek
github_2023
ublue-os
go
Access
func Access(path string, mode uint32) (err error) { return Faccessat(AT_FDCWD, path, mode, 0) }
/* * Wrapped */
https://github.com/ublue-os/fleek/blob/2beec3661ab231c03034b817b3b4ee60125e3173/vendor/golang.org/x/sys/unix/syscall_aix.go#L22-L24
2beec3661ab231c03034b817b3b4ee60125e3173
fleek
github_2023
ublue-os
go
Sync
func Sync() { SyscallNoError(SYS_SYNC, 0, 0, 0) return }
// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT
https://github.com/ublue-os/fleek/blob/2beec3661ab231c03034b817b3b4ee60125e3173/vendor/golang.org/x/sys/unix/zsyscall_linux.go#L1602-L1605
2beec3661ab231c03034b817b3b4ee60125e3173
insights-bot
github_2023
nekomeowww
go
FieldCleared
func (m *FeedbackSummarizationsReactionsMutation) FieldCleared(name string) bool { _, ok := m.clearedFields[name] return ok }
// FieldCleared returns a boolean indicating if a field with the given name was // cleared in this mutation.
https://github.com/nekomeowww/insights-bot/blob/967fa028caf356b0a96eaf19d85dcaa2968bbd1f/ent/mutation.go#L3043-L3046
967fa028caf356b0a96eaf19d85dcaa2968bbd1f
prometheus-plex-exporter
github_2023
jsclayton
go
Linkat
func Linkat(pathfd int, path string, linkfd int, link string, flags int) (err error) { var _p0 *byte _p0, err = BytePtrFromString(path) if err != nil { return } var _p1 *byte _p1, err = BytePtrFromString(link) if err != nil { return } _, _, e1 := Syscall6(SYS_LINKAT, uintptr(pathfd), uintptr(unsafe.Pointer(_p0)), uintptr(linkfd), uintptr(unsafe.Pointer(_p1)), uintptr(flags), 0) if e1 != 0 { err = errnoErr(e1) } return }
// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT
https://github.com/jsclayton/prometheus-plex-exporter/blob/041ea971fadc6db467ef8f792b6f4f824cc3034e/vendor/golang.org/x/sys/unix/zsyscall_freebsd_386.go#L1230-L1246
041ea971fadc6db467ef8f792b6f4f824cc3034e
prometheus-plex-exporter
github_2023
jsclayton
go
mknodat
func mknodat(fd int, path string, mode uint32, dev int) (err error) { var _p0 *byte _p0, err = BytePtrFromString(path) if err != nil { return } _, _, e1 := Syscall6(SYS_MKNODAT, uintptr(fd), uintptr(unsafe.Pointer(_p0)), uintptr(mode), uintptr(dev), 0, 0) if e1 != 0 { err = errnoErr(e1) } return }
// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT
https://github.com/jsclayton/prometheus-plex-exporter/blob/041ea971fadc6db467ef8f792b6f4f824cc3034e/vendor/golang.org/x/sys/unix/zsyscall_freebsd_arm64.go#L1335-L1346
041ea971fadc6db467ef8f792b6f4f824cc3034e
prometheus-plex-exporter
github_2023
jsclayton
go
Tee
func Tee(rfd int, wfd int, len int, flags int) (n int64, err error) { r0, _, e1 := Syscall6(SYS_TEE, uintptr(rfd), uintptr(wfd), uintptr(len), uintptr(flags), 0, 0) n = int64(r0) if e1 != 0 { err = errnoErr(e1) } return }
// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT
https://github.com/jsclayton/prometheus-plex-exporter/blob/041ea971fadc6db467ef8f792b6f4f824cc3034e/vendor/golang.org/x/sys/unix/zsyscall_linux_riscv64.go#L38-L45
041ea971fadc6db467ef8f792b6f4f824cc3034e
prometheus-plex-exporter
github_2023
jsclayton
go
Fclonefileat
func Fclonefileat(srcDirfd int, dstDirfd int, dst string, flags int) (err error) { var _p0 *byte _p0, err = BytePtrFromString(dst) if err != nil { return } _, _, e1 := syscall_syscall6(libc_fclonefileat_trampoline_addr, uintptr(srcDirfd), uintptr(dstDirfd), uintptr(unsafe.Pointer(_p0)), uintptr(flags), 0, 0) if e1 != 0 { err = errnoErr(e1) } return }
//go:cgo_import_dynamic libc_fchownat fchownat "/usr/lib/libSystem.B.dylib" // THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT
https://github.com/jsclayton/prometheus-plex-exporter/blob/041ea971fadc6db467ef8f792b6f4f824cc3034e/vendor/golang.org/x/sys/unix/zsyscall_darwin_arm64.go#L1182-L1193
041ea971fadc6db467ef8f792b6f4f824cc3034e
prometheus-plex-exporter
github_2023
jsclayton
go
Setresgid
func Setresgid(rgid int, egid int, sgid int) (err error) { _, _, e1 := RawSyscall(SYS_SETRESGID, uintptr(rgid), uintptr(egid), uintptr(sgid)) if e1 != 0 { err = errnoErr(e1) } return }
// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT
https://github.com/jsclayton/prometheus-plex-exporter/blob/041ea971fadc6db467ef8f792b6f4f824cc3034e/vendor/golang.org/x/sys/unix/zsyscall_freebsd_amd64.go#L1695-L1701
041ea971fadc6db467ef8f792b6f4f824cc3034e
prometheus-plex-exporter
github_2023
jsclayton
go
RegisterExtension
func (r *Types) RegisterExtension(xt protoreflect.ExtensionType) error { // Under rare circumstances getting the descriptor might recursively // examine the registry, so fetch it before locking. // // A known case where this can happen: Fetching the TypeDescriptor for a // legacy ExtensionDesc can consult the global registry. xd := xt.TypeDescriptor() if r == GlobalTypes { globalMutex.Lock() defer globalMutex.Unlock() } field := xd.Number() message := xd.ContainingMessage().FullName() if prev := r.extensionsByMessage[message][field]; prev != nil { err := errors.New("extension number %d is already registered on message %v", field, message) err = amendErrorWithCaller(err, prev, xt) if !(r == GlobalTypes && ignoreConflict(xd, err)) { return err } } if err := r.register("extension", xd, xt); err != nil { return err } if r.extensionsByMessage == nil { r.extensionsByMessage = make(extensionsByMessage) } if r.extensionsByMessage[message] == nil { r.extensionsByMessage[message] = make(extensionsByNumber) } r.extensionsByMessage[message][field] = xt r.numExtensions++ return nil }
// RegisterExtension registers the provided extension type. // // If a naming conflict occurs, the type is not registered and an error is returned.
https://github.com/jsclayton/prometheus-plex-exporter/blob/041ea971fadc6db467ef8f792b6f4f824cc3034e/vendor/google.golang.org/protobuf/reflect/protoregistry/registry.go#L536-L571
041ea971fadc6db467ef8f792b6f4f824cc3034e
wescale
github_2023
wesql
go
NextPosition
func (ev binlogEvent) NextPosition() uint32 { return binary.LittleEndian.Uint32(ev.Bytes()[13 : 13+4]) }
// NextPosition returns the nextPosition field from the header
https://github.com/wesql/wescale/blob/5336f06e5b14979f277b061d622ecf756f16f2c1/go/mysql/binlog_event_common.go#L113-L115
5336f06e5b14979f277b061d622ecf756f16f2c1
wescale
github_2023
wesql
go
ConvertStateToMySQLErrorCode
func ConvertStateToMySQLErrorCode(state vterrors.State) string { s := getStateToMySQLState(state) return strconv.Itoa(s.num) }
// ConvertStateToMySQLErrorCode returns MySQL error code for the given vterrors.State // If the state is == 0, an empty string is returned
https://github.com/wesql/wescale/blob/5336f06e5b14979f277b061d622ecf756f16f2c1/go/mysql/sql_error.go#L214-L217
5336f06e5b14979f277b061d622ecf756f16f2c1
wescale
github_2023
wesql
go
checkTablesCount
func checkTablesCount(t *testing.T, tablet *cluster.Vttablet, showTableName string, expectCount int) { query := fmt.Sprintf(`show tables like '%%%s%%';`, showTableName) queryResult, err := tablet.VttabletProcess.QueryTablet(query, keyspaceName, true) require.Nil(t, err) assert.Equal(t, expectCount, len(queryResult.Rows)) }
// checkTablesCount checks the number of tables in the given tablet
https://github.com/wesql/wescale/blob/5336f06e5b14979f277b061d622ecf756f16f2c1/go/test/endtoend/versionupgrade/upgrade_test.go#L181-L186
5336f06e5b14979f277b061d622ecf756f16f2c1
wescale
github_2023
wesql
go
GetToTables
func (node *TruncateTable) GetToTables() TableNames { return nil }
// GetToTables implements the DDLStatement interface
https://github.com/wesql/wescale/blob/5336f06e5b14979f277b061d622ecf756f16f2c1/go/vt/sqlparser/ast.go#L1571-L1573
5336f06e5b14979f277b061d622ecf756f16f2c1
wescale
github_2023
wesql
go
AndNot
func (bs Bitset) AndNot(b2 Bitset) Bitset { if len(b2) == 0 { return bs } merged := make([]byte, len(bs)) m := 0 for m = 0; m < len(bs); m++ { if m < len(b2) { merged[m] = bs[m] & ^b2[m] } else { merged[m] = bs[m] } } for ; m > 0; m-- { if merged[m-1] != 0 { break } } return toBitset(merged[:m]) }
// AndNot returns the logical AND NOT of the two Bitsets as a new Bitset
https://github.com/wesql/wescale/blob/5336f06e5b14979f277b061d622ecf756f16f2c1/go/vt/vtgate/semantics/bitset/bitset.go#L100-L121
5336f06e5b14979f277b061d622ecf756f16f2c1
wescale
github_2023
wesql
go
GenerateInsertStatement
func GenerateInsertStatement(qr *rules.Rule, ifNotExist bool) (string, error) { insertTemplate := getInsertSQLTemplate(ifNotExist) parsed := sqlparser.BuildParsedQuery(insertTemplate, ":name", ":description", ":priority", ":status", ":plans", ":fully_qualified_table_names", ":query_regex", ":query_template", ":request_ip_regex", ":user_regex", ":leading_comment_regex", ":trailing_comment_regex", ":bind_var_conds", ":action", ":action_args", ) bindVars, err := qr.ToBindVariable() if err != nil { return "", err } bound, err := parsed.GenerateQuery(bindVars, nil) return bound, err }
// GenerateInsertStatement returns the SQL statement to insert the rule into the database.
https://github.com/wesql/wescale/blob/5336f06e5b14979f277b061d622ecf756f16f2c1/go/vt/vttablet/customrule/util.go#L26-L51
5336f06e5b14979f277b061d622ecf756f16f2c1
wescale
github_2023
wesql
go
buildSelectColumnList
func buildSelectColumnList(t *schema.Table) string { buf := sqlparser.NewTrackedBuffer(nil) for i, c := range t.MessageInfo.Fields { // Column names may have to be escaped. if i == 0 { buf.Myprintf("%v", sqlparser.NewIdentifierCI(c.Name)) } else { buf.Myprintf(", %v", sqlparser.NewIdentifierCI(c.Name)) } } return buf.String() }
// buildSelectColumnList is a convenience function that // builds a 'select' list for the user-defined columns.
https://github.com/wesql/wescale/blob/5336f06e5b14979f277b061d622ecf756f16f2c1/go/vt/vttablet/tabletserver/messager/message_manager.go#L340-L351
5336f06e5b14979f277b061d622ecf756f16f2c1
kubeadmiral
github_2023
kubewharf
go
NewCollectedStatusLister
func NewCollectedStatusLister(indexer cache.Indexer) CollectedStatusLister { return &collectedStatusLister{indexer: indexer} }
// NewCollectedStatusLister returns a new CollectedStatusLister.
https://github.com/kubewharf/kubeadmiral/blob/c1d6d2c17b09b129f84303e233a34514f0ace318/pkg/client/listers/core/v1alpha1/collectedstatus.go#L29-L31
c1d6d2c17b09b129f84303e233a34514f0ace318
evil_minio
github_2023
AbelChe
go
Lstat
func Lstat(name string) (os.FileInfo, error) { defer updateOSMetrics(osMetricLstat, name)() return os.Lstat(name) }
// Lstat captures time taken to call os.Lstat
https://github.com/AbelChe/evil_minio/blob/d337ea171f7833d286ae351ca68fd145d8b40e86/cmd/os-instrumented.go#L169-L172
d337ea171f7833d286ae351ca68fd145d8b40e86
evil_minio
github_2023
AbelChe
go
ParseHTTP
func (sses3) ParseHTTP(h http.Header) error { if h.Get(xhttp.AmzServerSideEncryption) != xhttp.AmzEncryptionAES { return ErrInvalidEncryptionMethod } return nil }
// ParseHTTP parses the SSE-S3 related HTTP headers and checks // whether they contain valid values.
https://github.com/AbelChe/evil_minio/blob/d337ea171f7833d286ae351ca68fd145d8b40e86/internal/crypto/sse-s3.go#L55-L60
d337ea171f7833d286ae351ca68fd145d8b40e86
guardllama
github_2023
guardllamanet
go
GetFilteringEnabled
func (o *ClientFindSubEntry) GetFilteringEnabled() bool { if o == nil || o.FilteringEnabled == nil { var ret bool return ret } return *o.FilteringEnabled }
// GetFilteringEnabled returns the FilteringEnabled field value if set, zero value otherwise.
https://github.com/guardllamanet/guardllama/blob/26ddaa8e627f6b2a5570f669e34976931be8db74/internal/adguard/gen/model_client_find_sub_entry.go#L152-L158
26ddaa8e627f6b2a5570f669e34976931be8db74
guardllama
github_2023
guardllamanet
go
IsCRC32
func IsCRC32(str string) bool { return IsHash(str, "crc32") }
// IsCRC32 checks is a string is a CRC32 hash. Alias for `IsHash(str, "crc32")`
https://github.com/guardllamanet/guardllama/blob/26ddaa8e627f6b2a5570f669e34976931be8db74/vendor/github.com/asaskevich/govalidator/validator.go#L778-L780
26ddaa8e627f6b2a5570f669e34976931be8db74
guardllama
github_2023
guardllamanet
go
NewSignalChannel
func NewSignalChannel() (<-chan os.Signal, func()) { signalC := make(chan os.Signal, 1) signal.Notify(signalC, signals...) return signalC, func() { signal.Stop(signalC) close(signalC) } }
// NewSignalChannel returns a new channel for interrupt signals. // // Call the returned function to cancel sending to this channel.
https://github.com/guardllamanet/guardllama/blob/26ddaa8e627f6b2a5570f669e34976931be8db74/vendor/github.com/bufbuild/buf/private/pkg/interrupt/interrupt.go#L45-L52
26ddaa8e627f6b2a5570f669e34976931be8db74
guardllama
github_2023
guardllamanet
go
Set
func (p *PortOpt) Set(value string) error { longSyntax, err := regexp.MatchString(`\w+=\w+(,\w+=\w+)*`, value) if err != nil { return err } if longSyntax { csvReader := csv.NewReader(strings.NewReader(value)) fields, err := csvReader.Read() if err != nil { return err } pConfig := swarm.PortConfig{} for _, field := range fields { parts := strings.SplitN(field, "=", 2) if len(parts) != 2 { return fmt.Errorf("invalid field %s", field) } key := strings.ToLower(parts[0]) value := strings.ToLower(parts[1]) switch key { case portOptProtocol: if value != string(swarm.PortConfigProtocolTCP) && value != string(swarm.PortConfigProtocolUDP) && value != string(swarm.PortConfigProtocolSCTP) { return fmt.Errorf("invalid protocol value %s", value) } pConfig.Protocol = swarm.PortConfigProtocol(value) case portOptMode: if value != string(swarm.PortConfigPublishModeIngress) && value != string(swarm.PortConfigPublishModeHost) { return fmt.Errorf("invalid publish mode value %s", value) } pConfig.PublishMode = swarm.PortConfigPublishMode(value) case portOptTargetPort: tPort, err := strconv.ParseUint(value, 10, 16) if err != nil { return err } pConfig.TargetPort = uint32(tPort) case portOptPublishedPort: pPort, err := strconv.ParseUint(value, 10, 16) if err != nil { return err } pConfig.PublishedPort = uint32(pPort) default: return fmt.Errorf("invalid field key %s", key) } } if pConfig.TargetPort == 0 { return fmt.Errorf("missing mandatory field %q", portOptTargetPort) } if pConfig.PublishMode == "" { pConfig.PublishMode = swarm.PortConfigPublishModeIngress } if pConfig.Protocol == "" { pConfig.Protocol = swarm.PortConfigProtocolTCP } p.ports = append(p.ports, pConfig) } else { // short syntax portConfigs := []swarm.PortConfig{} ports, portBindingMap, err := nat.ParsePortSpecs([]string{value}) if err != nil { return err } for _, portBindings := range portBindingMap { for _, portBinding := range portBindings { if portBinding.HostIP != "" { return fmt.Errorf("hostip is not supported") } } } for port := range ports { portConfig, err := ConvertPortToPortConfig(port, portBindingMap) if err != nil { return err } portConfigs = append(portConfigs, portConfig...) } p.ports = append(p.ports, portConfigs...) } return nil }
// Set a new port value // nolint: gocyclo
https://github.com/guardllamanet/guardllama/blob/26ddaa8e627f6b2a5570f669e34976931be8db74/vendor/github.com/docker/cli/opts/port.go#L29-L121
26ddaa8e627f6b2a5570f669e34976931be8db74
guardllama
github_2023
guardllamanet
go
IsDataLoss
func IsDataLoss(err error) bool { _, ok := getImplementer(err).(ErrDataLoss) return ok }
// IsDataLoss returns if the passed in error is an ErrDataLoss
https://github.com/guardllamanet/guardllama/blob/26ddaa8e627f6b2a5570f669e34976931be8db74/vendor/github.com/docker/docker/errdefs/is.go#L104-L107
26ddaa8e627f6b2a5570f669e34976931be8db74
guardllama
github_2023
guardllamanet
go
Marshal
func Marshal(v interface{}) ([]byte, error) { return marshal(v, false) }
// Marshal returns the JSON encoding of v. // // Marshal traverses the value v recursively. // If an encountered value implements the Marshaler interface // and is not a nil pointer, Marshal calls its MarshalJSON method // to produce JSON. If no MarshalJSON method is present but the // value implements encoding.TextMarshaler instead, Marshal calls // its MarshalText method. // The nil pointer exception is not strictly necessary // but mimics a similar, necessary exception in the behavior of // UnmarshalJSON. // // Otherwise, Marshal uses the following type-dependent default encodings: // // Boolean values encode as JSON booleans. // // Floating point, integer, and Number values encode as JSON numbers. // // String values encode as JSON strings coerced to valid UTF-8, // replacing invalid bytes with the Unicode replacement rune. // The angle brackets "<" and ">" are escaped to "\u003c" and "\u003e" // to keep some browsers from misinterpreting JSON output as HTML. // Ampersand "&" is also escaped to "\u0026" for the same reason. // // Array and slice values encode as JSON arrays, except that // []byte encodes as a base64-encoded string, and a nil slice // encodes as the null JSON object. // // Struct values encode as JSON objects. Each exported struct field // becomes a member of the object unless // - the field's tag is "-", or // - the field is empty and its tag specifies the "omitempty" option. // The empty values are false, 0, any // nil pointer or interface value, and any array, slice, map, or string of // length zero. The object's default key string is the struct field name // but can be specified in the struct field's tag value. The "json" key in // the struct field's tag value is the key name, followed by an optional comma // and options. Examples: // // // Field is ignored by this package. // Field int `json:"-"` // // // Field appears in JSON as key "myName". // Field int `json:"myName"` // // // Field appears in JSON as key "myName" and // // the field is omitted from the object if its value is empty, // // as defined above. // Field int `json:"myName,omitempty"` // // // Field appears in JSON as key "Field" (the default), but // // the field is skipped if empty. // // Note the leading comma. // Field int `json:",omitempty"` // // The "string" option signals that a field is stored as JSON inside a // JSON-encoded string. It applies only to fields of string, floating point, // integer, or boolean types. This extra level of encoding is sometimes used // when communicating with JavaScript programs: // // Int64String int64 `json:",string"` // // The key name will be used if it's a non-empty string consisting of // only Unicode letters, digits, dollar signs, percent signs, hyphens, // underscores and slashes. // // Anonymous struct fields are usually marshaled as if their inner exported fields // were fields in the outer struct, subject to the usual Go visibility rules amended // as described in the next paragraph. // An anonymous struct field with a name given in its JSON tag is treated as // having that name, rather than being anonymous. // An anonymous struct field of interface type is treated the same as having // that type as its name, rather than being anonymous. // // The Go visibility rules for struct fields are amended for JSON when // deciding which field to marshal or unmarshal. If there are // multiple fields at the same level, and that level is the least // nested (and would therefore be the nesting level selected by the // usual Go rules), the following extra rules apply: // // 1) Of those fields, if any are JSON-tagged, only tagged fields are considered, // even if there are multiple untagged fields that would otherwise conflict. // 2) If there is exactly one field (tagged or not according to the first rule), that is selected. // 3) Otherwise there are multiple fields, and all are ignored; no error occurs. // // Handling of anonymous struct fields is new in Go 1.1. // Prior to Go 1.1, anonymous struct fields were ignored. To force ignoring of // an anonymous struct field in both current and earlier versions, give the field // a JSON tag of "-". // // Map values encode as JSON objects. // The map's key type must be string; the map keys are used as JSON object // keys, subject to the UTF-8 coercion described for string values above. // // Pointer values encode as the value pointed to. // A nil pointer encodes as the null JSON object. // // Interface values encode as the value contained in the interface. // A nil interface value encodes as the null JSON object. // // Channel, complex, and function values cannot be encoded in JSON. // Attempting to encode such a value causes Marshal to return // an UnsupportedTypeError. // // JSON cannot represent cyclic data structures and Marshal does not // handle them. Passing cyclic structures to Marshal will result in // an infinite recursion. //
https://github.com/guardllamanet/guardllama/blob/26ddaa8e627f6b2a5570f669e34976931be8db74/vendor/github.com/docker/go/canonical/json/encode.go#L137-L139
26ddaa8e627f6b2a5570f669e34976931be8db74
guardllama
github_2023
guardllamanet
go
RandString
func (c Continue) RandString() string { return randString(c.Rand) }
// RandString makes a random string up to 20 characters long. The returned string // may include a variety of (valid) UTF-8 encodings.
https://github.com/guardllamanet/guardllama/blob/26ddaa8e627f6b2a5570f669e34976931be8db74/vendor/github.com/google/gofuzz/fuzz.go#L431-L433
26ddaa8e627f6b2a5570f669e34976931be8db74
guardllama
github_2023
guardllamanet
go
FieldMaskFromRequestBody
func FieldMaskFromRequestBody(r io.Reader, msg proto.Message) (*field_mask.FieldMask, error) { fm := &field_mask.FieldMask{} var root interface{} if err := json.NewDecoder(r).Decode(&root); err != nil { if err == io.EOF { return fm, nil } return nil, err } queue := []fieldMaskPathItem{{node: root, msg: msg.ProtoReflect()}} for len(queue) > 0 { // dequeue an item item := queue[0] queue = queue[1:] m, ok := item.node.(map[string]interface{}) switch { case ok: // if the item is an object, then enqueue all of its children for k, v := range m { if item.msg == nil { return nil, errors.New("JSON structure did not match request type") } fd := getFieldByName(item.msg.Descriptor().Fields(), k) if fd == nil { return nil, fmt.Errorf("could not find field %q in %q", k, item.msg.Descriptor().FullName()) } if isDynamicProtoMessage(fd.Message()) { for _, p := range buildPathsBlindly(string(fd.FullName().Name()), v) { newPath := p if item.path != "" { newPath = item.path + "." + newPath } queue = append(queue, fieldMaskPathItem{path: newPath}) } continue } if isProtobufAnyMessage(fd.Message()) && !fd.IsList() { _, hasTypeField := v.(map[string]interface{})["@type"] if hasTypeField { queue = append(queue, fieldMaskPathItem{path: k}) continue } else { return nil, fmt.Errorf("could not find field @type in %q in message %q", k, item.msg.Descriptor().FullName()) } } child := fieldMaskPathItem{ node: v, } if item.path == "" { child.path = string(fd.FullName().Name()) } else { child.path = item.path + "." + string(fd.FullName().Name()) } switch { case fd.IsList(), fd.IsMap(): // As per: https://github.com/protocolbuffers/protobuf/blob/master/src/google/protobuf/field_mask.proto#L85-L86 // Do not recurse into repeated fields. The repeated field goes on the end of the path and we stop. fm.Paths = append(fm.Paths, child.path) case fd.Message() != nil: child.msg = item.msg.Get(fd).Message() fallthrough default: queue = append(queue, child) } } case len(item.path) > 0: // otherwise, it's a leaf node so print its path fm.Paths = append(fm.Paths, item.path) } } // Sort for deterministic output in the presence // of repeated fields. sort.Strings(fm.Paths) return fm, nil }
// FieldMaskFromRequestBody creates a FieldMask printing all complete paths from the JSON body.
https://github.com/guardllamanet/guardllama/blob/26ddaa8e627f6b2a5570f669e34976931be8db74/vendor/github.com/grpc-ecosystem/grpc-gateway/v2/runtime/fieldmask.go#L25-L110
26ddaa8e627f6b2a5570f669e34976931be8db74
guardllama
github_2023
guardllamanet
go
indexNL
func (s *set) indexNL(key Key) int { for i, k := range s.keys { if k == key { return i } } return -1 }
// indexNL is Index(), but without the locking
https://github.com/guardllamanet/guardllama/blob/26ddaa8e627f6b2a5570f669e34976931be8db74/vendor/github.com/lestrrat-go/jwx/jwk/set.go#L67-L74
26ddaa8e627f6b2a5570f669e34976931be8db74
guardllama
github_2023
guardllamanet
go
BiDirectional
func BiDirectional() InitOption { return func(g *Generator) { g.workflow = &onceWorkflow{workflow: &standardWorkflow{BiDi: true}} } }
// BiDirectional instructs the Generator to build the AST graph in both // directions (ie, accessing dependents of an entity, not just dependencies).
https://github.com/guardllamanet/guardllama/blob/26ddaa8e627f6b2a5570f669e34976931be8db74/vendor/github.com/lyft/protoc-gen-star/v2/init_option.go#L47-L49
26ddaa8e627f6b2a5570f669e34976931be8db74
guardllama
github_2023
guardllamanet
go
DebugFn
func DebugFn(fn LogFunction) { std.DebugFn(fn) }
// DebugFn logs a message from a func at level Debug on the standard logger.
https://github.com/guardllamanet/guardllama/blob/26ddaa8e627f6b2a5570f669e34976931be8db74/vendor/github.com/sirupsen/logrus/exported.go#L143-L145
26ddaa8e627f6b2a5570f669e34976931be8db74
guardllama
github_2023
guardllamanet
go
Float64SliceVarP
func Float64SliceVarP(p *[]float64, name, shorthand string, value []float64, usage string) { CommandLine.VarP(newFloat64SliceValue(value, p), name, shorthand, usage) }
// Float64SliceVarP is like Float64SliceVar, but accepts a shorthand letter that can be used after a single dash.
https://github.com/guardllamanet/guardllama/blob/26ddaa8e627f6b2a5570f669e34976931be8db74/vendor/github.com/spf13/pflag/float64_slice.go#L138-L140
26ddaa8e627f6b2a5570f669e34976931be8db74
guardllama
github_2023
guardllamanet
go
IPMaskVar
func IPMaskVar(p *net.IPMask, name string, value net.IPMask, usage string) { CommandLine.VarP(newIPMaskValue(value, p), name, "", usage) }
// IPMaskVar defines an net.IPMask flag with specified name, default value, and usage string. // The argument p points to an net.IPMask variable in which to store the value of the flag.
https://github.com/guardllamanet/guardllama/blob/26ddaa8e627f6b2a5570f669e34976931be8db74/vendor/github.com/spf13/pflag/ipmask.go#L89-L91
26ddaa8e627f6b2a5570f669e34976931be8db74
guardllama
github_2023
guardllamanet
go
filterSet
func filterSet(kvs []KeyValue, filter Filter) (Set, []KeyValue) { var excluded []KeyValue // Move attributes that do not match the filter so they're adjacent before // calling computeDistinct(). distinctPosition := len(kvs) // Swap indistinct keys forward and distinct keys toward the // end of the slice. offset := len(kvs) - 1 for ; offset >= 0; offset-- { if filter(kvs[offset]) { distinctPosition-- kvs[offset], kvs[distinctPosition] = kvs[distinctPosition], kvs[offset] continue } } excluded = kvs[:distinctPosition] return Set{ equivalent: computeDistinct(kvs[distinctPosition:]), }, excluded }
// filterSet reorders kvs so that included keys are contiguous at the end of // the slice, while excluded keys precede the included keys.
https://github.com/guardllamanet/guardllama/blob/26ddaa8e627f6b2a5570f669e34976931be8db74/vendor/go.opentelemetry.io/otel/attribute/set.go#L287-L309
26ddaa8e627f6b2a5570f669e34976931be8db74
guardllama
github_2023
guardllamanet
go
ptracePtr
func ptracePtr(request int, pid int, addr unsafe.Pointer, data int) (err error) { _, _, e1 := Syscall6(SYS_PTRACE, uintptr(request), uintptr(pid), uintptr(addr), uintptr(data), 0, 0) if e1 != 0 { err = errnoErr(e1) } return }
// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT
https://github.com/guardllamanet/guardllama/blob/26ddaa8e627f6b2a5570f669e34976931be8db74/vendor/golang.org/x/sys/unix/zsyscall_freebsd_386.go#L427-L433
26ddaa8e627f6b2a5570f669e34976931be8db74
guardllama
github_2023
guardllamanet
go
pread
func pread(fd int, p []byte, offset int64) (n int, err error) { var _p0 unsafe.Pointer if len(p) > 0 { _p0 = unsafe.Pointer(&p[0]) } else { _p0 = unsafe.Pointer(&_zero) } r0, _, e1 := Syscall6(SYS_PREAD, uintptr(fd), uintptr(_p0), uintptr(len(p)), 0, uintptr(offset), 0) n = int(r0) if e1 != 0 { err = errnoErr(e1) } return }
// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT
https://github.com/guardllamanet/guardllama/blob/26ddaa8e627f6b2a5570f669e34976931be8db74/vendor/golang.org/x/sys/unix/zsyscall_netbsd_arm64.go#L1353-L1366
26ddaa8e627f6b2a5570f669e34976931be8db74
guardllama
github_2023
guardllamanet
go
Getrlimit
func Getrlimit(resource int, rlim *Rlimit) (err error) { _, _, e1 := RawSyscall(SYS_GETRLIMIT, uintptr(resource), uintptr(unsafe.Pointer(rlim)), 0) if e1 != 0 { err = errnoErr(e1) } return }
// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT
https://github.com/guardllamanet/guardllama/blob/26ddaa8e627f6b2a5570f669e34976931be8db74/vendor/golang.org/x/sys/unix/zsyscall_linux_sparc64.go#L155-L161
26ddaa8e627f6b2a5570f669e34976931be8db74
guardllama
github_2023
guardllamanet
go
pread
func pread(fd int, p []byte, offset int64) (n int, err error) { var _p0 *byte if len(p) > 0 { _p0 = &p[0] } r0, _, e1 := sysvicall6(uintptr(unsafe.Pointer(&procpread)), 4, uintptr(fd), uintptr(unsafe.Pointer(_p0)), uintptr(len(p)), uintptr(offset), 0, 0) n = int(r0) if e1 != 0 { err = errnoErr(e1) } return }
// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT
https://github.com/guardllamanet/guardllama/blob/26ddaa8e627f6b2a5570f669e34976931be8db74/vendor/golang.org/x/sys/unix/zsyscall_solaris_amd64.go#L1424-L1435
26ddaa8e627f6b2a5570f669e34976931be8db74
guardllama
github_2023
guardllamanet
go
Namespace
func (s *EnvSettings) Namespace() string { if ns, _, err := s.config.ToRawKubeConfigLoader().Namespace(); err == nil { return ns } return "default" }
// Namespace gets the namespace from the configuration
https://github.com/guardllamanet/guardllama/blob/26ddaa8e627f6b2a5570f669e34976931be8db74/vendor/helm.sh/helm/v3/pkg/cli/environment.go#L222-L227
26ddaa8e627f6b2a5570f669e34976931be8db74
guardllama
github_2023
guardllamanet
go
Resource
func Resource(resource string) schema.GroupResource { return SchemeGroupVersion.WithResource(resource).GroupResource() }
// Resource takes an unqualified resource and returns a Group qualified GroupResource
https://github.com/guardllamanet/guardllama/blob/26ddaa8e627f6b2a5570f669e34976931be8db74/vendor/k8s.io/api/flowcontrol/v1alpha1/register.go#L37-L39
26ddaa8e627f6b2a5570f669e34976931be8db74
guardllama
github_2023
guardllamanet
go
RegisterDefaults
func RegisterDefaults(scheme *runtime.Scheme) error { scheme.AddTypeDefaultingFunc(&CustomResourceDefinition{}, func(obj interface{}) { SetObjectDefaults_CustomResourceDefinition(obj.(*CustomResourceDefinition)) }) scheme.AddTypeDefaultingFunc(&CustomResourceDefinitionList{}, func(obj interface{}) { SetObjectDefaults_CustomResourceDefinitionList(obj.(*CustomResourceDefinitionList)) }) return nil }
// RegisterDefaults adds defaulters functions to the given scheme. // Public to allow building arbitrary schemes. // All generated defaulters are covering - they call all nested defaulters.
https://github.com/guardllamanet/guardllama/blob/26ddaa8e627f6b2a5570f669e34976931be8db74/vendor/k8s.io/apiextensions-apiserver/pkg/apis/apiextensions/v1/zz_generated.defaults.go#L31-L37
26ddaa8e627f6b2a5570f669e34976931be8db74
guardllama
github_2023
guardllamanet
go
UnmarshalJSON
func (r *Refable) UnmarshalJSON(d []byte) error { return json.Unmarshal(d, &r.Ref) }
// UnmarshalJSON unmarshalss the ref from json
https://github.com/guardllamanet/guardllama/blob/26ddaa8e627f6b2a5570f669e34976931be8db74/vendor/k8s.io/kube-openapi/pkg/validation/spec/ref.go#L37-L39
26ddaa8e627f6b2a5570f669e34976931be8db74
guardllama
github_2023
guardllamanet
go
ValidateBytes
func (c *paramVerifyingSchema) ValidateBytes(data []byte) error { obj, err := schemavalidation.Parse(data) if err != nil { return err } gvk, errs := schemavalidation.GetObjectKind(obj) if errs != nil { return utilerrors.NewAggregate(errs) } err = c.verifier.HasSupport(gvk) if resource.IsParamUnsupportedError(err) { switch c.directive { case metav1.FieldValidationStrict: return c.schema.ValidateBytes(data) case metav1.FieldValidationWarn: klog.Warningf("cannot perform warn validation if server-side field validation is unsupported, skipping validation") default: // can't be reached klog.Warningf("unexpected field validation directive: %s, skipping validation", c.directive) } return nil } return err }
// ValidateBytes validates bytes per a ParamVerifyingSchema
https://github.com/guardllamanet/guardllama/blob/26ddaa8e627f6b2a5570f669e34976931be8db74/vendor/k8s.io/kubectl/pkg/validation/schema.go#L129-L154
26ddaa8e627f6b2a5570f669e34976931be8db74
guardllama
github_2023
guardllamanet
go
GetNode
func GetNode(root *yaml.Node, path ...string) (*yaml.Node, bool, error) { resNode, restPath, err := asCloseAsPossible(root, path...) if err != nil { return nil, false, err } // more path means the node didn't exist if len(restPath) != 0 { return nil, false, nil } return resNode, true, nil }
// GetNode gets the node at the given path in the given sequence of mapping // nodes, or, if it doesn't exist, returning false.
https://github.com/guardllamanet/guardllama/blob/26ddaa8e627f6b2a5570f669e34976931be8db74/vendor/sigs.k8s.io/controller-tools/pkg/schemapatcher/internal/yaml/nested.go#L77-L87
26ddaa8e627f6b2a5570f669e34976931be8db74
gotour
github_2023
ardanlabs
go
main
func main() { x := Xenia{ Host: "localhost:8000", Timeout: time.Second, } p := Pillar{ Host: "localhost:9000", Timeout: time.Second, } if err := Copy(&x, &p, 3); err != io.EOF { fmt.Println(err) } }
// =============================================================================
https://github.com/ardanlabs/gotour/blob/6599a0b6d88dd03619c8bc4c5f53e59c70c36208/_content/tour/eng/composition/decoupling/example6.go#L114-L128
6599a0b6d88dd03619c8bc4c5f53e59c70c36208
gotour
github_2023
ardanlabs
go
Wait
func (s *Server) Wait() error { // ΠΡΟΣΠΟΙΗΘΕΙΤΕ ΟΤΙ ΥΠΑΡΧΕΙ ΣΥΓΚΕΚΡΙΜΕΝΗ ΥΛΟΠΟΙΗΣΗ. return nil }
// Η Wait αποτρέπει τον server να δεχτεί νέες συνδέσεις.
https://github.com/ardanlabs/gotour/blob/6599a0b6d88dd03619c8bc4c5f53e59c70c36208/_content/tour/grc/composition/pollution/example2.go#L41-L45
6599a0b6d88dd03619c8bc4c5f53e59c70c36208
gotour
github_2023
ardanlabs
go
sendNotification
func sendNotification(n notifier) { n.notify() }
// sendNotification accepts values that implement the notifier // interface and sends notifications.
https://github.com/ardanlabs/gotour/blob/6599a0b6d88dd03619c8bc4c5f53e59c70c36208/_content/tour/tur/interfaces/example3.go#L46-L48
6599a0b6d88dd03619c8bc4c5f53e59c70c36208
gotour
github_2023
ardanlabs
go
SmallestComponent
func (v PreciseVector) SmallestComponent() Axis { t := v.Abs() if t.X.Cmp(t.Y) < 0 { if t.X.Cmp(t.Z) < 0 { return XAxis } return ZAxis } if t.Y.Cmp(t.Z) < 0 { return YAxis } return ZAxis }
// SmallestComponent returns the axis that represents the smallest component in this vector.
https://github.com/ardanlabs/gotour/blob/6599a0b6d88dd03619c8bc4c5f53e59c70c36208/vendor/github.com/golang/geo/r3/precisevector.go#L185-L198
6599a0b6d88dd03619c8bc4c5f53e59c70c36208
gotour
github_2023
ardanlabs
go
CheckPath
func CheckPath(path string) (err error) { defer func() { if err != nil { err = &InvalidPathError{Kind: "module", Path: path, Err: err} } }() if err := checkPath(path, modulePath); err != nil { return err } i := strings.Index(path, "/") if i < 0 { i = len(path) } if i == 0 { return fmt.Errorf("leading slash") } if !strings.Contains(path[:i], ".") { return fmt.Errorf("missing dot in first path element") } if path[0] == '-' { return fmt.Errorf("leading dash in first path element") } for _, r := range path[:i] { if !firstPathOK(r) { return fmt.Errorf("invalid char %q in first path element", r) } } if _, _, ok := SplitPathVersion(path); !ok { return fmt.Errorf("invalid version") } return nil }
// CheckPath checks that a module path is valid. // A valid module path is a valid import path, as checked by [CheckImportPath], // with three additional constraints. // First, the leading path element (up to the first slash, if any), // by convention a domain name, must contain only lower-case ASCII letters, // ASCII digits, dots (U+002E), and dashes (U+002D); // it must contain at least one dot and cannot start with a dash. // Second, for a final path element of the form /vN, where N looks numeric // (ASCII digits and dots) must not begin with a leading zero, must not be /v1, // and must not contain any dots. For paths beginning with "gopkg.in/", // this second requirement is replaced by a requirement that the path // follow the gopkg.in server's conventions. // Third, no path element may begin with a dot.
https://github.com/ardanlabs/gotour/blob/6599a0b6d88dd03619c8bc4c5f53e59c70c36208/vendor/golang.org/x/mod/module/module.go#L309-L341
6599a0b6d88dd03619c8bc4c5f53e59c70c36208
gotour
github_2023
ardanlabs
go
accept
func accept(s int, rsa *RawSockaddrAny, addrlen *_Socklen) (fd int, err error) { r0, _, e1 := Syscall(SYS_ACCEPT, uintptr(s), uintptr(unsafe.Pointer(rsa)), uintptr(unsafe.Pointer(addrlen))) fd = int(r0) if e1 != 0 { err = errnoErr(e1) } return }
// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT
https://github.com/ardanlabs/gotour/blob/6599a0b6d88dd03619c8bc4c5f53e59c70c36208/vendor/golang.org/x/sys/unix/zsyscall_freebsd_riscv64.go#L49-L56
6599a0b6d88dd03619c8bc4c5f53e59c70c36208
gotour
github_2023
ardanlabs
go
Adjtime
func Adjtime(delta *Timeval, olddelta *Timeval) (err error) { _, _, e1 := Syscall(SYS_ADJTIME, uintptr(unsafe.Pointer(delta)), uintptr(unsafe.Pointer(olddelta)), 0) if e1 != 0 { err = errnoErr(e1) } return }
// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT
https://github.com/ardanlabs/gotour/blob/6599a0b6d88dd03619c8bc4c5f53e59c70c36208/vendor/golang.org/x/sys/unix/zsyscall_freebsd_riscv64.go#L451-L457
6599a0b6d88dd03619c8bc4c5f53e59c70c36208
gotour
github_2023
ardanlabs
go
Fchmodat
func Fchmodat(dirfd int, path string, mode uint32, flags int) (err error) { var _p0 *byte _p0, err = BytePtrFromString(path) if err != nil { return } _, _, e1 := Syscall6(SYS_FCHMODAT, uintptr(dirfd), uintptr(unsafe.Pointer(_p0)), uintptr(mode), uintptr(flags), 0, 0) if e1 != 0 { err = errnoErr(e1) } return }
// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT
https://github.com/ardanlabs/gotour/blob/6599a0b6d88dd03619c8bc4c5f53e59c70c36208/vendor/golang.org/x/sys/unix/zsyscall_dragonfly_amd64.go#L657-L668
6599a0b6d88dd03619c8bc4c5f53e59c70c36208
gotour
github_2023
ardanlabs
go
Setrtable
func Setrtable(rtable int) (err error) { _, _, e1 := syscall_rawSyscall(libc_setrtable_trampoline_addr, uintptr(rtable), 0, 0) if e1 != 0 { err = errnoErr(e1) } return }
//go:cgo_import_dynamic libc_setresuid setresuid "libc.so" // THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT
https://github.com/ardanlabs/gotour/blob/6599a0b6d88dd03619c8bc4c5f53e59c70c36208/vendor/golang.org/x/sys/unix/zsyscall_openbsd_arm64.go#L1946-L1952
6599a0b6d88dd03619c8bc4c5f53e59c70c36208
gotour
github_2023
ardanlabs
go
Faccessat
func Faccessat(dirfd int, path string, mode uint32, flags int) (err error) { var _p0 *byte _p0, err = BytePtrFromString(path) if err != nil { return } _, _, e1 := syscall_syscall6(libc_faccessat_trampoline_addr, uintptr(dirfd), uintptr(unsafe.Pointer(_p0)), uintptr(mode), uintptr(flags), 0, 0) if e1 != 0 { err = errnoErr(e1) } return }
//go:cgo_import_dynamic libc_exit exit "/usr/lib/libSystem.B.dylib" // THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT
https://github.com/ardanlabs/gotour/blob/6599a0b6d88dd03619c8bc4c5f53e59c70c36208/vendor/golang.org/x/sys/unix/zsyscall_darwin_arm64.go#L1137-L1148
6599a0b6d88dd03619c8bc4c5f53e59c70c36208
gotour
github_2023
ardanlabs
go
consumeFixed32Ptr
func consumeFixed32Ptr(b []byte, p pointer, wtyp protowire.Type, f *coderFieldInfo, opts unmarshalOptions) (out unmarshalOutput, err error) { if wtyp != protowire.Fixed32Type { return out, errUnknown } v, n := protowire.ConsumeFixed32(b) if n < 0 { return out, errDecode } vp := p.Uint32Ptr() if *vp == nil { *vp = new(uint32) } **vp = v out.n = n return out, nil }
// consumeFixed32Ptr wire decodes a *uint32 pointer as a Fixed32.
https://github.com/ardanlabs/gotour/blob/6599a0b6d88dd03619c8bc4c5f53e59c70c36208/vendor/google.golang.org/protobuf/internal/impl/codec_gen.go#L3486-L3501
6599a0b6d88dd03619c8bc4c5f53e59c70c36208
minder
github_2023
mindersec
go
ReregisterEntity
func (_ *RESTProvider) ReregisterEntity( _ context.Context, _ minderv1.Entity, _ *properties.Properties, ) error { // TODO: implement return nil }
// ReregisterEntity implements the Provider interface
https://github.com/mindersec/minder/blob/3cb22b6aa37dd3f54af46c3156dd09c4eda60105/internal/providers/testproviders/rest.go#L86-L91
3cb22b6aa37dd3f54af46c3156dd09c4eda60105
minder
github_2023
mindersec
go
GetNiceStatus
func GetNiceStatus(code codes.Code) *NiceStatus { s := &NiceStatus{} return s.SetCode(code) }
// GetNiceStatus get a nice status from the code.
https://github.com/mindersec/minder/blob/3cb22b6aa37dd3f54af46c3156dd09c4eda60105/internal/util/statuses.go#L29-L32
3cb22b6aa37dd3f54af46c3156dd09c4eda60105
dendy
github_2023
maxpoletaev
go
nameTableIdx
func (p *PPU) nameTableIdx(addr uint16) uint { var ( idx = (addr - 0x2000) / 0x0400 mode = p.cart.MirrorMode() ) switch mode { case ines.MirrorHorizontal: switch idx { case 0, 1: return 0 default: return 1 } case ines.MirrorVertical: switch idx { case 0, 2: return 0 default: return 1 } case ines.MirrorSingle0: return 0 case ines.MirrorSingle1: return 1 default: panic(fmt.Sprintf("invalid mirroring mode: %d", mode)) } }
// nameTableIdx returns the index of the nametable (0 or 1) for the given vram // address, based on the cartridge’s mirroring mode.
https://github.com/maxpoletaev/dendy/blob/19c75f9a5b6e5b891a0c458c71a5eadbb25fddab/ppu/ppu.go#L231-L259
19c75f9a5b6e5b891a0c458c71a5eadbb25fddab
wasi-go
github_2023
dispatchrun
go
TestSystem
func TestSystem(t *testing.T, makeSystem MakeSystem) { t.Run("file", file.runFunc(makeSystem)) t.Run("proc", proc.runFunc(makeSystem)) t.Run("poll", poll.runFunc(makeSystem)) t.Run("socket", socket.runFunc(makeSystem)) }
// TestSystem is a test suite which validates the behavior of wasi.System // implementations.
https://github.com/dispatchrun/wasi-go/blob/038d5104aacbb966c25af43797473f03c5da3e4f/wasitest/system.go#L14-L19
038d5104aacbb966c25af43797473f03c5da3e4f
ceremonyclient
github_2023
QuilibriumNetwork
go
AddReservation
func (c *constraints) AddReservation(p peer.ID, a ma.Multiaddr) error { c.mutex.Lock() now := time.Now() c.cleanup(now) if len(c.total) >= c.rc.MaxReservations { c.mutex.Unlock() return errTooManyReservations } ip, err := manet.ToIP(a) if err != nil { c.mutex.Unlock() return errors.New("no IP address associated with peer") } peerReservations := c.peers[p] if len(peerReservations) >= c.rc.MaxReservationsPerPeer { c.mutex.Unlock() return errTooManyReservationsForPeer } ipReservations := c.ips[ip.String()] if len(ipReservations) >= c.rc.MaxReservationsPerIP { c.mutex.Unlock() return errTooManyReservationsForIP } var asnReservations []time.Time var asn uint32 if ip.To4() == nil { asn = asnutil.AsnForIPv6(ip) if asn != 0 { asnReservations = c.asns[asn] if len(asnReservations) >= c.rc.MaxReservationsPerASN { c.mutex.Unlock() return errTooManyReservationsForASN } } } expiry := now.Add(validity) c.total = append(c.total, expiry) peerReservations = append(peerReservations, expiry) c.peers[p] = peerReservations ipReservations = append(ipReservations, expiry) c.ips[ip.String()] = ipReservations if asn != 0 { asnReservations = append(asnReservations, expiry) c.asns[asn] = asnReservations } c.mutex.Unlock() return nil }
// AddReservation adds a reservation for a given peer with a given multiaddr. // If adding this reservation violates IP constraints, an error is returned.
https://github.com/QuilibriumNetwork/ceremonyclient/blob/c3ebffc519ce29a88cc6fe14b3b39049c4989f34/go-libp2p/p2p/protocol/circuitv2/relay/constraints.go#L49-L106
c3ebffc519ce29a88cc6fe14b3b39049c4989f34
ceremonyclient
github_2023
QuilibriumNetwork
go
Delete
func (set *IdSet) Delete(atom Atom) bool { switch a := atom.(type) { case *Vertex: if _, exists := set.atoms[a.GetID()]; exists { delete(set.atoms, a.GetID()) return true } case *Hyperedge: if _, exists := set.atoms[a.GetID()]; exists { delete(set.atoms, a.GetID()) return true } } return false }
// Delete removes an atom from the IdSet and returns true if the atom was // present.
https://github.com/QuilibriumNetwork/ceremonyclient/blob/c3ebffc519ce29a88cc6fe14b3b39049c4989f34/node/hypergraph/inmem/types.go#L106-L120
c3ebffc519ce29a88cc6fe14b3b39049c4989f34
ceremonyclient
github_2023
QuilibriumNetwork
go
WithReason
func WithReason(ctx context.Context, reason Reason) context.Context { info := infoFromCtx(ctx) info.reason = reason return withInfo(ctx, info) }
// WithReason creates a context that has an associated Reason (which ends up in // traces created under that context).
https://github.com/QuilibriumNetwork/ceremonyclient/blob/c3ebffc519ce29a88cc6fe14b3b39049c4989f34/pebble/objstorage/objstorageprovider/objiotracing/obj_io_tracing_on.go#L270-L274
c3ebffc519ce29a88cc6fe14b3b39049c4989f34