code stringlengths 12 2.05k | label_name stringclasses 5
values | label int64 0 4 |
|---|---|---|
func isRepositoryGitPath(path string) bool {
return strings.HasSuffix(path, ".git") ||
strings.Contains(path, ".git"+string(os.PathSeparator)) ||
// Windows treats ".git." the same as ".git"
strings.HasSuffix(path, ".git.") ||
strings.Contains(path, ".git."+string(os.PathSeparator))
} | Base | 1 |
func (m *Nil) Unmarshal(dAtA []byte) error {
l := len(dAtA)
iNdEx := 0
for iNdEx < l {
preIndex := iNdEx
var wire uint64
for shift := uint(0); ; shift += 7 {
if shift >= 64 {
return ErrIntOverflowThetest
}
if iNdEx >= l {
return io.ErrUnexpectedEOF
}
b := dAtA[iNdEx]
iNdEx++
wire |... | Variant | 0 |
func (m *ADeepBranch) Unmarshal(dAtA []byte) error {
l := len(dAtA)
iNdEx := 0
for iNdEx < l {
preIndex := iNdEx
var wire uint64
for shift := uint(0); ; shift += 7 {
if shift >= 64 {
return ErrIntOverflowThetest
}
if iNdEx >= l {
return io.ErrUnexpectedEOF
}
b := dAtA[iNdEx]
iNdEx++
... | Variant | 0 |
func (x *ListStorageRequest) Reset() {
*x = ListStorageRequest{}
if protoimpl.UnsafeEnabled {
mi := &file_console_proto_msgTypes[30]
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
ms.StoreMessageInfo(mi)
}
} | Base | 1 |
func (f *Fosite) writeJsonError(rw http.ResponseWriter, err error) {
rw.Header().Set("Content-Type", "application/json;charset=UTF-8")
rw.Header().Set("Cache-Control", "no-store")
rw.Header().Set("Pragma", "no-cache")
rfcerr := ErrorToRFC6749Error(err)
if !f.SendDebugMessagesToClients {
rfcerr = rfcerr.Sanitize... | Class | 2 |
func (*RuntimeInfo) Descriptor() ([]byte, []int) {
return file_console_proto_rawDescGZIP(), []int{41}
} | Base | 1 |
func mountCgroupV1(m *configs.Mount, c *mountConfig) error {
binds, err := getCgroupMounts(m)
if err != nil {
return err
}
var merged []string
for _, b := range binds {
ss := filepath.Base(b.Destination)
if strings.Contains(ss, ",") {
merged = append(merged, ss)
}
}
tmpfs := &configs.Mount{
Source: ... | Class | 2 |
func (s *ConsoleServer) Authenticate(ctx context.Context, in *console.AuthenticateRequest) (*console.ConsoleSession, error) {
role := console.UserRole_USER_ROLE_UNKNOWN
var uname string
var email string
switch in.Username {
case s.config.GetConsole().Username:
if in.Password == s.config.GetConsole().Password {
... | Base | 1 |
func TestIsReqAuthenticated(t *testing.T) {
path, err := newTestConfig(globalMinioDefaultRegion)
if err != nil {
t.Fatalf("unable initialize config file, %s", err)
}
defer os.RemoveAll(path)
creds, err := auth.CreateCredentials("myuser", "mypassword")
if err != nil {
t.Fatalf("unable create credential, %s", ... | Variant | 0 |
func TestAddDebug(t *testing.T) {
err := ErrRevocationClientMismatch.WithDebug("debug")
assert.NotEqual(t, err, ErrRevocationClientMismatch)
assert.Empty(t, ErrRevocationClientMismatch.Debug)
assert.NotEmpty(t, err.Debug)
} | Class | 2 |
func (cf *clientsFactory) UpdateNamespaces(ctx context.Context) error {
clients, err := clientsForClusters(cf.clusters.Get())
if err != nil {
cf.log.Error(err, "failed to create clients for", "clusters", cf.clusters.Get())
return err
}
cf.syncCaches()
wg := sync.WaitGroup{}
for clusterName, c := range clie... | Base | 1 |
func (i *IDTokenHandleHelper) GetAccessTokenHash(ctx context.Context, requester fosite.AccessRequester, responder fosite.AccessResponder) string {
token := responder.GetAccessToken()
buffer := bytes.NewBufferString(token)
hash := sha256.New()
hash.Write(buffer.Bytes())
hashBuf := bytes.NewBuffer(hash.Sum([]byte{}... | Class | 2 |
func (x *DeleteGroupUserRequest) Reset() {
*x = DeleteGroupUserRequest{}
if protoimpl.UnsafeEnabled {
mi := &file_console_proto_msgTypes[18]
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
ms.StoreMessageInfo(mi)
}
} | Base | 1 |
func (m *NonByteCustomType) Unmarshal(dAtA []byte) error {
l := len(dAtA)
iNdEx := 0
for iNdEx < l {
preIndex := iNdEx
var wire uint64
for shift := uint(0); ; shift += 7 {
if shift >= 64 {
return ErrIntOverflowThetest
}
if iNdEx >= l {
return io.ErrUnexpectedEOF
}
b := dAtA[iNdEx]
iNd... | Variant | 0 |
func (x *LeaderboardRequest) Reset() {
*x = LeaderboardRequest{}
if protoimpl.UnsafeEnabled {
mi := &file_console_proto_msgTypes[25]
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
ms.StoreMessageInfo(mi)
}
} | Base | 1 |
func (m *UInt32Value) Unmarshal(dAtA []byte) error {
l := len(dAtA)
iNdEx := 0
for iNdEx < l {
preIndex := iNdEx
var wire uint64
for shift := uint(0); ; shift += 7 {
if shift >= 64 {
return ErrIntOverflowWrappers
}
if iNdEx >= l {
return io.ErrUnexpectedEOF
}
b := dAtA[iNdEx]
iNdEx++
... | Variant | 0 |
func ReadWriteProtocolTest(t *testing.T, protocolFactory ProtocolFactory) {
buf := bytes.NewBuffer(make([]byte, 0, 1024))
l := HTTPClientSetupForTest(t)
defer l.Close()
transports := []TransportFactory{
NewMemoryBufferTransportFactory(1024),
NewStreamTransportFactory(buf, buf, true),
NewFramedTransportFactory... | Base | 1 |
func isReqAuthenticated(r *http.Request, region string) (s3Error APIErrorCode) {
if r == nil {
return ErrInternalError
}
if errCode := reqSignatureV4Verify(r, region); errCode != ErrNone {
return errCode
}
payload, err := ioutil.ReadAll(r.Body)
if err != nil {
logger.LogIf(context.Background(), err)
ret... | Variant | 0 |
func Test_buildRouteConfiguration(t *testing.T) {
b := New("local-grpc", "local-http", nil, nil)
virtualHosts := make([]*envoy_config_route_v3.VirtualHost, 10)
routeConfig, err := b.buildRouteConfiguration("test-route-configuration", virtualHosts)
require.NoError(t, err)
assert.Equal(t, "test-route-configuration",... | Class | 2 |
func (m *C) Unmarshal(dAtA []byte) error {
l := len(dAtA)
iNdEx := 0
for iNdEx < l {
preIndex := iNdEx
var wire uint64
for shift := uint(0); ; shift += 7 {
if shift >= 64 {
return ErrIntOverflowExample
}
if iNdEx >= l {
return io.ErrUnexpectedEOF
}
b := dAtA[iNdEx]
iNdEx++
wire |= ... | Variant | 0 |
func (c *liveStateCache) IterateHierarchy(server string, key kube.ResourceKey, action func(child appv1.ResourceNode, appName string)) error {
clusterInfo, err := c.getSyncedCluster(server)
if err != nil {
return err
}
clusterInfo.IterateHierarchy(key, func(resource *clustercache.Resource, namespaceResources map[k... | Class | 2 |
func (x *StatusList) Reset() {
*x = StatusList{}
if protoimpl.UnsafeEnabled {
mi := &file_console_proto_msgTypes[40]
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
ms.StoreMessageInfo(mi)
}
} | Base | 1 |
func (c *linuxContainer) prepareCriuRestoreMounts(mounts []*configs.Mount) error {
// First get a list of a all tmpfs mounts
tmpfs := []string{}
for _, m := range mounts {
switch m.Device {
case "tmpfs":
tmpfs = append(tmpfs, m.Destination)
}
}
// Now go through all mounts and create the mountpoints
// i... | Class | 2 |
func (*DeleteGroupUserRequest) Descriptor() ([]byte, []int) {
return file_console_proto_rawDescGZIP(), []int{18}
} | Base | 1 |
func (cr *s3ChunkedReader) readS3ChunkHeader() {
// Read the first chunk line until CRLF.
var hexChunkSize, hexChunkSignature []byte
hexChunkSize, hexChunkSignature, cr.err = readChunkLine(cr.reader)
if cr.err != nil {
return
}
// <hex>;token=value - converts the hex into its uint64 form.
cr.n, cr.err = parseH... | Base | 1 |
func handleCollectedUplink(ctx context.Context, uplinkFrame gw.UplinkFrame, rxPacket models.RXPacket) error {
var uplinkIDs []uuid.UUID
for _, p := range rxPacket.RXInfoSet {
uplinkIDs = append(uplinkIDs, helpers.GetUplinkID(p))
}
log.WithFields(log.Fields{
"uplink_ids": uplinkIDs,
"mtype": rxPacket.PHY... | Class | 2 |
func (*Provider) Render(ctx *provider.Context, config, data string) string {
result := blackfriday.Run([]byte(data))
return string(result)
} | Base | 1 |
func (m *NidOptNonByteCustomType) Unmarshal(dAtA []byte) error {
l := len(dAtA)
iNdEx := 0
for iNdEx < l {
preIndex := iNdEx
var wire uint64
for shift := uint(0); ; shift += 7 {
if shift >= 64 {
return ErrIntOverflowThetest
}
if iNdEx >= l {
return io.ErrUnexpectedEOF
}
b := dAtA[iNdEx]
... | Variant | 0 |
func (svc *Service) MacadminsData(ctx context.Context, id uint) (*fleet.MacadminsData, error) {
if !svc.authz.IsAuthenticatedWith(ctx, authz_ctx.AuthnDeviceToken) {
if err := svc.authz.Authorize(ctx, &fleet.Host{}, fleet.ActionList); err != nil {
return nil, err
}
host, err := svc.ds.HostLite(ctx, id)
if e... | Class | 2 |
func New(
localGRPCAddress string,
localHTTPAddress string,
fileManager *filemgr.Manager,
reproxyHandler *reproxy.Handler,
) *Builder {
return &Builder{
localGRPCAddress: localGRPCAddress,
localHTTPAddress: localHTTPAddress,
filemgr: fileManager,
reproxy: reproxyHandler,
}
} | Class | 2 |
func (m *NidOptNonByteCustomType) Unmarshal(dAtA []byte) error {
l := len(dAtA)
iNdEx := 0
for iNdEx < l {
preIndex := iNdEx
var wire uint64
for shift := uint(0); ; shift += 7 {
if shift >= 64 {
return ErrIntOverflowThetest
}
if iNdEx >= l {
return io.ErrUnexpectedEOF
}
b := dAtA[iNdEx]
... | Variant | 0 |
func validateAndCreateWebhook(c *context.Context, orCtx *orgRepoContext, w *db.Webhook) {
c.Data["Webhook"] = w
if c.HasError() {
c.Success(orCtx.TmplNew)
return
}
field, msg, ok := validateWebhook(c.User, c.Locale, w)
if !ok {
c.FormErr(field)
c.RenderWithErr(msg, orCtx.TmplNew, nil)
return
}
if er... | Base | 1 |
func bindMountDeviceNode(dest string, node *devices.Device) error {
f, err := os.Create(dest)
if err != nil && !os.IsExist(err) {
return err
}
if f != nil {
f.Close()
}
return unix.Mount(node.Path, dest, "bind", unix.MS_BIND, "")
} | Class | 2 |
func (s *ConsoleServer) lookupConsoleUser(ctx context.Context, unameOrEmail, password string) (id uuid.UUID, uname string, email string, role console.UserRole, err error) {
role = console.UserRole_USER_ROLE_UNKNOWN
query := "SELECT id, username, email, role, password, disable_time FROM console_user WHERE username = $... | Base | 1 |
func TestDoesPolicySignatureV2Match(t *testing.T) {
obj, fsDir, err := prepareFS()
if err != nil {
t.Fatal(err)
}
defer os.RemoveAll(fsDir)
if err = newTestConfig(globalMinioDefaultRegion, obj); err != nil {
t.Fatal(err)
}
creds := globalActiveCred
policy := "policy"
testCases := []struct {
accessKey st... | Class | 2 |
func (x *DeleteWalletLedgerRequest) ProtoReflect() protoreflect.Message {
mi := &file_console_proto_msgTypes[22]
if protoimpl.UnsafeEnabled && x != nil {
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
if ms.LoadMessageInfo() == nil {
ms.StoreMessageInfo(mi)
}
return ms
}
return mi.MessageOf(x)
} | Base | 1 |
func (*LeaderboardList) Descriptor() ([]byte, []int) {
return file_console_proto_rawDescGZIP(), []int{24}
} | Base | 1 |
func isAdminOfTheModifiedTeams(currentUser *fleet.User, originalUserTeams, newUserTeams []fleet.UserTeam) bool {
// If the user is of the right global role, then they can modify the teams
if currentUser.GlobalRole != nil && (*currentUser.GlobalRole == fleet.RoleAdmin || *currentUser.GlobalRole == fleet.RoleMaintainer... | Class | 2 |
func (m *CustomContainer) Unmarshal(dAtA []byte) error {
l := len(dAtA)
iNdEx := 0
for iNdEx < l {
preIndex := iNdEx
var wire uint64
for shift := uint(0); ; shift += 7 {
if shift >= 64 {
return ErrIntOverflowThetest
}
if iNdEx >= l {
return io.ErrUnexpectedEOF
}
b := dAtA[iNdEx]
iNdEx... | Variant | 0 |
func (m *UnrecognizedWithInner_Inner) Unmarshal(dAtA []byte) error {
l := len(dAtA)
iNdEx := 0
for iNdEx < l {
preIndex := iNdEx
var wire uint64
for shift := uint(0); ; shift += 7 {
if shift >= 64 {
return ErrIntOverflowThetest
}
if iNdEx >= l {
return io.ErrUnexpectedEOF
}
b := dAtA[iNd... | Variant | 0 |
func (dag *DAG) EnsureService(meta types.NamespacedName, port intstr.IntOrString, cache *KubernetesCache) (*Service, error) {
svc, svcPort, err := cache.LookupService(meta, port)
if err != nil {
return nil, err
}
if dagSvc := dag.GetService(k8s.NamespacedNameOf(svc), svcPort.Port); dagSvc != nil {
return dagSv... | Class | 2 |
func TestNewOAuth2ResourceServer(t *testing.T) {
newMockResourceServer(t)
} | Base | 1 |
func TestRedactURL(t *testing.T) {
cases := []struct {
name string
url *url.URL
want string
}{
{
name: "non-blank Password",
url: &url.URL{
Scheme: "http",
Host: "host.tld",
Path: "this:that",
User: url.UserPassword("user", "password"),
},
want: "http://user:xxxxx@host.tld/t... | Base | 1 |
func (m *A) Unmarshal(dAtA []byte) error {
l := len(dAtA)
iNdEx := 0
for iNdEx < l {
preIndex := iNdEx
var wire uint64
for shift := uint(0); ; shift += 7 {
if shift >= 64 {
return ErrIntOverflowA
}
if iNdEx >= l {
return io.ErrUnexpectedEOF
}
b := dAtA[iNdEx]
iNdEx++
wire |= uint64... | Variant | 0 |
func (x *DeleteStorageObjectRequest) ProtoReflect() protoreflect.Message {
mi := &file_console_proto_msgTypes[21]
if protoimpl.UnsafeEnabled && x != nil {
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
if ms.LoadMessageInfo() == nil {
ms.StoreMessageInfo(mi)
}
return ms
}
return mi.MessageOf(x)
} | Base | 1 |
func (x *ListPurchasesRequest) ProtoReflect() protoreflect.Message {
mi := &file_console_proto_msgTypes[28]
if protoimpl.UnsafeEnabled && x != nil {
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
if ms.LoadMessageInfo() == nil {
ms.StoreMessageInfo(mi)
}
return ms
}
return mi.MessageOf(x)
} | Base | 1 |
func IsLocalHostname(hostname string, allowlist []string) bool {
for _, allow := range allowlist {
if hostname == allow {
return false
}
}
ips, err := net.LookupIP(hostname)
if err != nil {
return true
}
for _, ip := range ips {
for _, cidr := range localCIDRs {
if cidr.Contains(ip) {
return tr... | Base | 1 |
func (x *StorageCollectionsList) Reset() {
*x = StorageCollectionsList{}
if protoimpl.UnsafeEnabled {
mi := &file_console_proto_msgTypes[34]
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
ms.StoreMessageInfo(mi)
}
} | Base | 1 |
func (x *ListAccountsRequest) ProtoReflect() protoreflect.Message {
mi := &file_console_proto_msgTypes[26]
if protoimpl.UnsafeEnabled && x != nil {
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
if ms.LoadMessageInfo() == nil {
ms.StoreMessageInfo(mi)
}
return ms
}
return mi.MessageOf(x)
} | Base | 1 |
func fixTransferEncoding(requestMethod string, header Header) ([]string, error) {
raw, present := header["Transfer-Encoding"]
if !present {
return nil, nil
}
delete(header, "Transfer-Encoding")
encodings := strings.Split(raw[0], ",")
te := make([]string, 0, len(encodings))
// TODO: Even though we only suppor... | Base | 1 |
func (x *DeleteLeaderboardRecordRequest) ProtoReflect() protoreflect.Message {
mi := &file_console_proto_msgTypes[20]
if protoimpl.UnsafeEnabled && x != nil {
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
if ms.LoadMessageInfo() == nil {
ms.StoreMessageInfo(mi)
}
return ms
}
return mi.MessageOf(... | Base | 1 |
func (x *CallApiEndpointRequest) Reset() {
*x = CallApiEndpointRequest{}
if protoimpl.UnsafeEnabled {
mi := &file_console_proto_msgTypes[12]
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
ms.StoreMessageInfo(mi)
}
} | Base | 1 |
func (x *GetWalletLedgerRequest) ProtoReflect() protoreflect.Message {
mi := &file_console_proto_msgTypes[45]
if protoimpl.UnsafeEnabled && x != nil {
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
if ms.LoadMessageInfo() == nil {
ms.StoreMessageInfo(mi)
}
return ms
}
return mi.MessageOf(x)
} | Base | 1 |
func (*UpdateAccountRequest) Descriptor() ([]byte, []int) {
return file_console_proto_rawDescGZIP(), []int{36}
} | Base | 1 |
func remount(m *configs.Mount, rootfs string) error {
var (
dest = m.Destination
)
if !strings.HasPrefix(dest, rootfs) {
dest = filepath.Join(rootfs, dest)
}
return unix.Mount(m.Source, dest, m.Device, uintptr(m.Flags|unix.MS_REMOUNT), "")
} | Class | 2 |
func validateAndUpdateWebhook(c *context.Context, orCtx *orgRepoContext, w *db.Webhook) {
c.Data["Webhook"] = w
if c.HasError() {
c.Success(orCtx.TmplNew)
return
}
field, msg, ok := validateWebhook(c.User, c.Locale, w)
if !ok {
c.FormErr(field)
c.RenderWithErr(msg, orCtx.TmplNew, nil)
return
}
if er... | Base | 1 |
func (m *Foo) Unmarshal(dAtA []byte) error {
l := len(dAtA)
iNdEx := 0
for iNdEx < l {
preIndex := iNdEx
var wire uint64
for shift := uint(0); ; shift += 7 {
if shift >= 64 {
return ErrIntOverflowIssue617
}
if iNdEx >= l {
return io.ErrUnexpectedEOF
}
b := dAtA[iNdEx]
iNdEx++
wire ... | Variant | 0 |
func (svc Service) ListSoftware(ctx context.Context, opt fleet.SoftwareListOptions) ([]fleet.Software, error) {
if err := svc.authz.Authorize(ctx, &fleet.Software{}, fleet.ActionRead); err != nil {
return nil, err
}
// default sort order to hosts_count descending
if opt.OrderKey == "" {
opt.OrderKey = "hosts_c... | Class | 2 |
func UnpackXzTar(filename string, destination string, verbosityLevel int) (err error) {
Verbose = verbosityLevel
if !common.FileExists(filename) {
return fmt.Errorf("file %s not found", filename)
}
if !common.DirExists(destination) {
return fmt.Errorf("directory %s not found", destination)
}
filename, err = c... | Base | 1 |
func (x *UserList) Reset() {
*x = UserList{}
if protoimpl.UnsafeEnabled {
mi := &file_console_proto_msgTypes[39]
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
ms.StoreMessageInfo(mi)
}
} | Base | 1 |
func (*StorageList) Descriptor() ([]byte, []int) {
return file_console_proto_rawDescGZIP(), []int{33}
} | Base | 1 |
func mountNewCgroup(m *configs.Mount) error {
var (
data = m.Data
source = m.Source
)
if data == "systemd" {
data = cgroups.CgroupNamePrefix + data
source = "systemd"
}
if err := unix.Mount(source, m.Destination, m.Device, uintptr(m.Flags), data); err != nil {
return err
}
return nil
} | Class | 2 |
func (x *MatchState) ProtoReflect() protoreflect.Message {
mi := &file_console_proto_msgTypes[31]
if protoimpl.UnsafeEnabled && x != nil {
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
if ms.LoadMessageInfo() == nil {
ms.StoreMessageInfo(mi)
}
return ms
}
return mi.MessageOf(x)
} | Base | 1 |
func (m *R) Unmarshal(dAtA []byte) error {
l := len(dAtA)
iNdEx := 0
for iNdEx < l {
preIndex := iNdEx
var wire uint64
for shift := uint(0); ; shift += 7 {
if shift >= 64 {
return ErrIntOverflowExample
}
if iNdEx >= l {
return io.ErrUnexpectedEOF
}
b := dAtA[iNdEx]
iNdEx++
wire |= ... | Variant | 0 |
func (svc *Service) OSVersions(ctx context.Context, teamID *uint, platform *string) (*fleet.OSVersions, error) {
if err := svc.authz.Authorize(ctx, &fleet.Host{TeamID: teamID}, fleet.ActionList); err != nil {
return nil, err
}
osVersions, err := svc.ds.OSVersions(ctx, teamID, platform)
if err != nil {
return n... | Class | 2 |
func newSessionService() {
SessionProvider = Cfg.MustValueRange("session", "PROVIDER", "memory",
[]string{"memory", "file", "redis", "mysql"})
SessionConfig = new(session.Config)
SessionConfig.ProviderConfig = strings.Trim(Cfg.MustValue("session", "PROVIDER_CONFIG"), "\" ")
SessionConfig.CookieName = Cfg.MustVal... | Base | 1 |
func (mbox *Mailbox) newClient() (*client.Client, error) {
var imapClient *client.Client
var err error
if mbox.TLS {
config := new(tls.Config)
config.InsecureSkipVerify = mbox.IgnoreCertErrors
imapClient, err = client.DialTLS(mbox.Host, config)
} else {
imapClient, err = client.Dial(mbox.Host)
}
if err !=... | Base | 1 |
func (r *TokenRevocationHandler) RevokeToken(ctx context.Context, token string, tokenType fosite.TokenType, client fosite.Client) error {
discoveryFuncs := []func() (request fosite.Requester, err error){
func() (request fosite.Requester, err error) {
// Refresh token
signature := r.RefreshTokenStrategy.Refresh... | Class | 2 |
func SearchRepositoryByName(opt SearchOption) (repos []*Repository, err error) {
// Prevent SQL inject.
opt.Keyword = FilterSQLInject(opt.Keyword)
if len(opt.Keyword) == 0 {
return repos, nil
}
opt.Keyword = strings.ToLower(opt.Keyword)
repos = make([]*Repository, 0, opt.Limit)
// Append conditions.
sess :=... | Base | 1 |
func (m *TestRequest) Unmarshal(dAtA []byte) error {
l := len(dAtA)
iNdEx := 0
for iNdEx < l {
preIndex := iNdEx
var wire uint64
for shift := uint(0); ; shift += 7 {
if shift >= 64 {
return ErrIntOverflowEmpty
}
if iNdEx >= l {
return io.ErrUnexpectedEOF
}
b := dAtA[iNdEx]
iNdEx++
... | Variant | 0 |
func (cn *clusterNode) resurrect() {
gRPCServer, err := comm_utils.NewGRPCServer(cn.bindAddress, cn.serverConfig)
if err != nil {
panic(fmt.Errorf("failed starting gRPC server: %v", err))
}
cn.srv = gRPCServer
orderer.RegisterClusterServer(gRPCServer.Server(), cn)
go cn.srv.Start()
} | Class | 2 |
func (ctx *cbcAEAD) Open(dst, nonce, ciphertext, data []byte) ([]byte, error) {
if len(ciphertext) < ctx.authtagBytes {
return nil, errors.New("square/go-jose: invalid ciphertext (too short)")
}
offset := len(ciphertext) - ctx.authtagBytes
expectedTag := ctx.computeAuthTag(data, nonce, ciphertext[:offset])
matc... | Base | 1 |
func (hs *HTTPServer) getPluginAssets(c *models.ReqContext) {
pluginID := web.Params(c.Req)[":pluginId"]
plugin, exists := hs.pluginStore.Plugin(c.Req.Context(), pluginID)
if !exists {
c.JsonApiErr(404, "Plugin not found", nil)
return
}
requestedFile := filepath.Clean(web.Params(c.Req)["*"])
pluginFilePath :... | Base | 1 |
func (a *APIs) PostLogin(v *PostLoginReq) *kongchuanhujiao.Response {
if v.Code != account.GetCode(v.ID) || v.Code == "" { // FIXME datahub 鉴权
return kongchuanhujiao.GenerateErrResp(1, "验证码有误")
}
now := time.Now()
t, err := jwt.NewTokenWithClaims(jwt.SigningMethodES256, jwt.MapClaims{
"iss": config.GetJWTConf... | Base | 1 |
func makeStreamDistributedQueryCampaignResultsHandler(svc kolide.Service, jwtKey string, logger kitlog.Logger) http.Handler {
opt := sockjs.DefaultOptions
opt.Websocket = true
opt.RawWebsocket = true
return sockjs.NewHandler("/api/v1/kolide/results", opt, func(session sockjs.Session) {
defer session.Close(0, "non... | Class | 2 |
func (x *StatusList_Status) ProtoReflect() protoreflect.Message {
mi := &file_console_proto_msgTypes[49]
if protoimpl.UnsafeEnabled && x != nil {
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
if ms.LoadMessageInfo() == nil {
ms.StoreMessageInfo(mi)
}
return ms
}
return mi.MessageOf(x)
} | Base | 1 |
func mountCgroupV2(m *configs.Mount, c *mountConfig) error {
dest, err := securejoin.SecureJoin(c.root, m.Destination)
if err != nil {
return err
}
if err := os.MkdirAll(dest, 0755); err != nil {
return err
}
if err := unix.Mount(m.Source, dest, "cgroup2", uintptr(m.Flags), m.Data); err != nil {
// when we ... | Class | 2 |
func AppList(c *gin.Context) {
//service.MyService.Docker().DockerContainerCommit("test2")
index := c.DefaultQuery("index", "1")
size := c.DefaultQuery("size", "10000")
t := c.DefaultQuery("type", "rank")
categoryId := c.DefaultQuery("category_id", "0")
key := c.DefaultQuery("key", "")
recommend, list, communi... | Base | 1 |
func (m *FakeMap) Unmarshal(dAtA []byte) error {
l := len(dAtA)
iNdEx := 0
for iNdEx < l {
preIndex := iNdEx
var wire uint64
for shift := uint(0); ; shift += 7 {
if shift >= 64 {
return ErrIntOverflowMap
}
if iNdEx >= l {
return io.ErrUnexpectedEOF
}
b := dAtA[iNdEx]
iNdEx++
wire |... | Variant | 0 |
func (x *DeleteLeaderboardRecordRequest) Reset() {
*x = DeleteLeaderboardRecordRequest{}
if protoimpl.UnsafeEnabled {
mi := &file_console_proto_msgTypes[20]
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
ms.StoreMessageInfo(mi)
}
} | Base | 1 |
func (m *Empty) Unmarshal(dAtA []byte) error {
l := len(dAtA)
iNdEx := 0
for iNdEx < l {
preIndex := iNdEx
var wire uint64
for shift := uint(0); ; shift += 7 {
if shift >= 64 {
return ErrIntOverflowEmpty
}
if iNdEx >= l {
return io.ErrUnexpectedEOF
}
b := dAtA[iNdEx]
iNdEx++
wire |... | Variant | 0 |
func (EmptyEvidencePool) AddEvidenceFromConsensus(evidence types.Evidence) error {
return nil
} | Class | 2 |
func TestReadWriteCompactProtocol(t *testing.T) {
ReadWriteProtocolTest(t, NewCompactProtocolFactory())
// CompactProtocol is capable of reading and writing in different goroutines.
ReadWriteProtocolParallelTest(t, NewCompactProtocolFactory())
transports := []Transport{
NewMemoryBuffer(),
NewStreamTransportRW(b... | Base | 1 |
func (m *Subby) Unmarshal(dAtA []byte) error {
l := len(dAtA)
iNdEx := 0
for iNdEx < l {
preIndex := iNdEx
var wire uint64
for shift := uint(0); ; shift += 7 {
if shift >= 64 {
return ErrIntOverflowOne
}
if iNdEx >= l {
return io.ErrUnexpectedEOF
}
b := dAtA[iNdEx]
iNdEx++
wire |= ... | Variant | 0 |
func (p *BinaryProtocol) readStringBody(size int32) (value string, err error) {
if size < 0 {
return "", nil
}
if uint64(size) > p.trans.RemainingBytes() {
return "", invalidDataLength
}
var buf []byte
if int(size) <= len(p.buffer) {
buf = p.buffer[0:size]
} else {
buf = make([]byte, size)
}
_, e := io... | Base | 1 |
func (m *E) Unmarshal(dAtA []byte) error {
l := len(dAtA)
iNdEx := 0
for iNdEx < l {
preIndex := iNdEx
var wire uint64
for shift := uint(0); ; shift += 7 {
if shift >= 64 {
return ErrIntOverflowExample
}
if iNdEx >= l {
return io.ErrUnexpectedEOF
}
b := dAtA[iNdEx]
iNdEx++
wire |= ... | Variant | 0 |
func createDefaultConfigFileIfNotExists() error {
defaultFilePath := GetDefaultConfigFilePath()
if isExists(defaultFilePath) {
return nil
}
folderPath := filepath.Dir(defaultFilePath)
if !isExists(folderPath) {
err := os.Mkdir(folderPath, folderPermission)
if err != nil {
return err
}
}
f, err := os.C... | Base | 1 |
func (m *Wilson) Unmarshal(dAtA []byte) error {
l := len(dAtA)
iNdEx := 0
for iNdEx < l {
preIndex := iNdEx
var wire uint64
for shift := uint(0); ; shift += 7 {
if shift >= 64 {
return ErrIntOverflowCasttype
}
if iNdEx >= l {
return io.ErrUnexpectedEOF
}
b := dAtA[iNdEx]
iNdEx++
wi... | Variant | 0 |
func (f *ScmpFilter) addRuleGeneric(call ScmpSyscall, action ScmpAction, exact bool, conds []ScmpCondition) error {
f.lock.Lock()
defer f.lock.Unlock()
if !f.valid {
return errBadFilter
}
if len(conds) == 0 {
if err := f.addRuleWrapper(call, action, exact, nil); err != nil {
return err
}
} else {
// ... | Class | 2 |
func (d *partialArray) add(key string, val *lazyNode) error {
if key == "-" {
*d = append(*d, val)
return nil
}
idx, err := strconv.Atoi(key)
if err != nil {
return err
}
ary := make([]*lazyNode, len(*d)+1)
cur := *d
if idx < 0 {
idx *= -1
if idx > len(ary) {
return fmt.Errorf("Unable to acces... | Base | 1 |
func (m *Wilson) Unmarshal(dAtA []byte) error {
l := len(dAtA)
iNdEx := 0
for iNdEx < l {
preIndex := iNdEx
var wire uint64
for shift := uint(0); ; shift += 7 {
if shift >= 64 {
return ErrIntOverflowCastvalue
}
if iNdEx >= l {
return io.ErrUnexpectedEOF
}
b := dAtA[iNdEx]
iNdEx++
w... | Variant | 0 |
func MkdirSecure(pth string) (err error) {
err = os.MkdirAll(pth, 0755)
if err != nil {
err = &errortypes.WriteError{
errors.Wrap(err, "utils: Failed to create directory"),
}
return
}
err = acl.Apply(
pth,
true,
false,
acl.GrantName(windows.GENERIC_ALL, "CREATOR OWNER"),
acl.GrantName(windows.GE... | Class | 2 |
func (m *DroppedWithoutGetters) Unmarshal(dAtA []byte) error {
l := len(dAtA)
iNdEx := 0
for iNdEx < l {
preIndex := iNdEx
var wire uint64
for shift := uint(0); ; shift += 7 {
if shift >= 64 {
return ErrIntOverflowTypedeclall
}
if iNdEx >= l {
return io.ErrUnexpectedEOF
}
b := dAtA[iNdEx... | Variant | 0 |
func (m *NinRepNonByteCustomType) Unmarshal(dAtA []byte) error {
l := len(dAtA)
iNdEx := 0
for iNdEx < l {
preIndex := iNdEx
var wire uint64
for shift := uint(0); ; shift += 7 {
if shift >= 64 {
return ErrIntOverflowThetest
}
if iNdEx >= l {
return io.ErrUnexpectedEOF
}
b := dAtA[iNdEx]
... | Variant | 0 |
func (x *UpdateGroupUserStateRequest) ProtoReflect() protoreflect.Message {
mi := &file_console_proto_msgTypes[19]
if protoimpl.UnsafeEnabled && x != nil {
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
if ms.LoadMessageInfo() == nil {
ms.StoreMessageInfo(mi)
}
return ms
}
return mi.MessageOf(x)
... | Base | 1 |
func (b *Builder) buildControlPlanePathRoute(path string, protected bool) (*envoy_config_route_v3.Route, error) {
r := &envoy_config_route_v3.Route{
Name: "pomerium-path-" + path,
Match: &envoy_config_route_v3.RouteMatch{
PathSpecifier: &envoy_config_route_v3.RouteMatch_Path{Path: path},
},
Action: &envoy_c... | Class | 2 |
func (m *DeepLeaf) Unmarshal(dAtA []byte) error {
l := len(dAtA)
iNdEx := 0
for iNdEx < l {
preIndex := iNdEx
var wire uint64
for shift := uint(0); ; shift += 7 {
if shift >= 64 {
return ErrIntOverflowThetest
}
if iNdEx >= l {
return io.ErrUnexpectedEOF
}
b := dAtA[iNdEx]
iNdEx++
w... | Variant | 0 |
func (*WriteStorageObjectRequest) Descriptor() ([]byte, []int) {
return file_console_proto_rawDescGZIP(), []int{44}
} | Base | 1 |
func (o *casaService) GetServerAppInfo(id, t string) model.ServerAppList {
head := make(map[string]string)
head["Authorization"] = GetToken()
infoS := httper2.Get(config.ServerInfo.ServerApi+"/v2/app/info/"+id+"?t="+t, head)
info := model.ServerAppList{}
json2.Unmarshal([]byte(gjson.Get(infoS, "data").String())... | Base | 1 |
func TestToFromBig(t *testing.T) {
for i, test := range toFromBigTests {
n, _ := new(big.Int).SetString(test, 16)
var x p224FieldElement
p224FromBig(&x, n)
m := p224ToBig(&x)
if n.Cmp(m) != 0 {
t.Errorf("#%d: %x != %x", i, n, m)
}
q := p224AlternativeToBig(&x)
if n.Cmp(q) != 0 {
t.Errorf("#%d: %x... | Pillar | 3 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.