text stringlengths 11 6.3k | embedding listlengths 768 768 |
|---|---|
func Mkdir(pathname string, mode os.FileMode, recursive bool) error {
if mode == 0 {
mode = 0777
}
var err error
if recursive {
err = os.MkdirAll(pathname, os.FileMode(mode))
} else {
err = os.Mkdir(pathname, os.FileMode(mode))
}
return err
} | [
0.12621411681175232,
0.13905934989452362,
0.6204213500022888,
0.6719468832015991,
-0.7051872611045837,
0.9330422282218933,
0.40056923031806946,
0.529454231262207,
-0.7462631464004517,
-0.17779280245304108,
0.445648729801178,
-0.22028625011444092,
-0.06042025238275528,
0.44559812545776367,
... |
func Rmdir(dirname string) error {
return syscall.Rmdir(dirname)
} | [
-0.10197984427213669,
0.20747224986553192,
0.12683172523975372,
0.5141920447349548,
-0.5732621550559998,
0.5448384881019592,
0.14725841581821442,
0.47849783301353455,
0.4180370271205902,
-0.5152755379676819,
0.1473969966173172,
0.009856891818344593,
-0.681682288646698,
1.4072072505950928,
... |
func Symlink(target, link string) error {
return os.Symlink(target, link)
} | [
0.6969088315963745,
0.3200470209121704,
0.21843266487121582,
-0.13687680661678314,
0.046536948531866074,
-0.30328476428985596,
-0.06941808760166168,
1.1391377449035645,
-0.06188178062438965,
-0.08245513588190079,
0.004021070897579193,
1.4281936883926392,
0.7171590328216553,
-0.488840699195... |
func Link(target, link string) error {
return os.Link(target, link)
} | [
0.2434648871421814,
0.38421639800071716,
0.12162475287914276,
0.6965725421905518,
0.49861037731170654,
0.14554651081562042,
-0.05298403277993202,
0.2517855167388916,
-0.13633185625076294,
-0.3484756052494049,
0.46989119052886963,
1.362846851348877,
0.6490132808685303,
-0.12646007537841797,... |
func Chmod(filename string, mode os.FileMode) error {
return os.Chmod(filename, os.FileMode(mode))
} | [
0.6953456997871399,
-0.9172937273979187,
0.2990259528160095,
0.08362766355276108,
-0.2991081178188324,
1.8411623239517212,
-0.39128056168556213,
0.9605332612991333,
-1.2702147960662842,
0.645847499370575,
0.44041699171066284,
0.7472215890884399,
0.011617385782301426,
0.14473553001880646,
... |
func Chown(filename string, uid, gid int) error {
return os.Chown(filename, uid, gid)
} | [
0.7036660313606262,
-1.025084137916565,
0.2092081755399704,
0.553111732006073,
-0.14988456666469574,
0.06809989362955093,
0.4688464403152466,
0.8621683716773987,
-1.1662874221801758,
-0.560057520866394,
-0.13747064769268036,
1.5784533023834229,
0.8852760195732117,
0.04352580010890961,
1.... |
func IsFile(filename string) bool {
fi, err := os.Stat(filename)
if err != nil {
return false
}
return fi.Mode().IsRegular()
} | [
-0.19359418749809265,
0.46633341908454895,
0.6750721335411072,
0.4805586040019989,
0.2539234161376953,
0.5747197866439819,
0.8609628677368164,
0.6443010568618774,
-0.3423141837120056,
-0.45261451601982117,
-0.03701414540410042,
-0.09078506380319595,
-0.815544605255127,
0.29931318759918213,... |
func IsDir(filename string) bool {
fi, err := os.Stat(filename)
if err != nil {
return false
}
return fi.Mode().IsDir()
} | [
-0.0713670551776886,
-0.3840675354003906,
0.6262418031692505,
0.7636433243751526,
-0.3610472083091736,
0.7970760464668274,
0.773059070110321,
0.8606347441673279,
-0.271408349275589,
-0.8465392589569092,
0.38813871145248413,
-0.3893983066082001,
-0.20435959100723267,
1.0534780025482178,
-... |
func IsLink(filename string) bool {
fi, err := os.Lstat(filename)
if err != nil {
return false
}
return fi.Mode()&os.ModeSymlink == os.ModeSymlink
} | [
0.040787938982248306,
-0.48893243074417114,
0.6287564039230347,
0.579322338104248,
0.26083865761756897,
-0.1501123011112213,
1.015598177909851,
0.5914087891578674,
1.271820068359375,
-0.7224246263504028,
-0.5139193534851074,
0.43035033345222473,
-0.6377788782119751,
0.7913264632225037,
-... |
func Copy(src, dst string) error {
in, err := os.Open(src)
if err != nil {
return err
}
defer in.Close()
out, err := os.Create(dst)
if err != nil {
return err
}
defer out.Close()
_, err = io.Copy(out, in)
if err != nil {
return err
}
return out.Close()
} | [
-0.4559735357761383,
0.0397886298596859,
0.518351674079895,
-0.22383977472782135,
-1.4698773622512817,
1.219643473625183,
0.1060200035572052,
-0.25401753187179565,
-0.7695795297622681,
0.4561828076839447,
0.34131690859794617,
0.5358512997627258,
0.6246874928474426,
-0.3458562195301056,
0... |
func FileExists(filename string) bool {
_, err := os.Stat(filename)
return err == nil
} | [
-0.5003001689910889,
-0.3416765332221985,
0.5149803757667542,
-0.12281818687915802,
1.6050344705581665,
0.7903949618339539,
-0.5923991799354553,
0.6509155631065369,
-0.8091988563537598,
-0.6064193248748779,
0.13812458515167236,
-0.7293922305107117,
0.6574582457542419,
0.3935380280017853,
... |
func FileSize(filename string) (int64, error) {
info, err := os.Stat(filename)
if err != nil {
return 0, err
}
return info.Size(), nil
} | [
-0.5853965282440186,
0.7760481238365173,
0.5612404346466064,
-0.16958756744861603,
0.07682833820581436,
-0.1794164776802063,
0.6083031296730042,
0.38396763801574707,
-0.5398313999176025,
-0.013742238283157349,
0.4661412835121155,
-0.24431419372558594,
-0.49263259768486023,
1.11644136905670... |
func Rename(oldname, newname string) error {
return os.Rename(oldname, newname)
} | [
0.32554301619529724,
-0.6833544969558716,
0.6496589183807373,
0.6146052479743958,
-0.14222794771194458,
-0.10159207135438919,
-0.9995209574699402,
0.2347097098827362,
-0.719295084476471,
0.5918136239051819,
0.49378952383995056,
1.2458990812301636,
-0.09930771589279175,
0.01412868034094572,... |
func FilePutContents(filename string, data string) error {
return ioutil.WriteFile(filename, []byte(data), 0666)
} | [
-0.41500043869018555,
-0.37133684754371643,
0.33165398240089417,
-0.4932396411895752,
0.005569332744926214,
0.13927336037158966,
-0.5378873348236084,
0.23511658608913422,
-1.2788089513778687,
0.3280637264251709,
-0.21531037986278534,
-1.1597052812576294,
-0.16303275525569916,
-0.7443706393... |
func FileGetContents(filename string) (string, error) {
data, err := ioutil.ReadFile(filename)
return string(data), err
} | [
-0.2593408524990082,
-0.6041130423545837,
0.39119860529899597,
-0.3331092596054077,
-0.08766809850931168,
-0.08044592291116714,
-0.6332916617393494,
-0.9693678617477417,
-1.230140209197998,
-0.2589745819568634,
0.5023282170295715,
-0.6885671615600586,
0.2287958860397339,
-0.721830904483795... |
func (*CollectionDef) XXX_OneofFuncs() (func(msg proto.Message, b *proto.Buffer) error, func(msg proto.Message, tag, wire int, b *proto.Buffer) (bool, error), func(msg proto.Message) (n int), []interface{}) {
return _CollectionDef_OneofMarshaler, _CollectionDef_OneofUnmarshaler, _CollectionDef_OneofSizer, []interface{... | [
0.11418627947568893,
0.4282114505767822,
0.5716853141784668,
-0.6508166193962097,
0.6512585878372192,
-0.37124064564704895,
0.6057987213134766,
-1.1607863903045654,
0.1212107390165329,
-0.5215590000152588,
-0.6968647837638855,
0.12198607623577118,
-0.40786033868789673,
1.6175050735473633,
... |
func (*TensorInfo) XXX_OneofFuncs() (func(msg proto.Message, b *proto.Buffer) error, func(msg proto.Message, tag, wire int, b *proto.Buffer) (bool, error), func(msg proto.Message) (n int), []interface{}) {
return _TensorInfo_OneofMarshaler, _TensorInfo_OneofUnmarshaler, _TensorInfo_OneofSizer, []interface{}{
(*Tenso... | [
-0.14464370906352997,
0.36409032344818115,
0.4561326503753662,
-1.1207026243209839,
0.4605664610862732,
-0.5506400465965271,
1.0313507318496704,
-1.395195484161377,
-0.13871371746063232,
-0.6200505495071411,
-0.5669546723365784,
-0.13779988884925842,
0.25599414110183716,
0.6238909959793091... |
func (m *AzureSqlVNetRuleManager) GetSQLVNetRule(
ctx context.Context,
subscriptionID string,
resourceGroupName string,
serverName string,
ruleName string,
) (result sql.VirtualNetworkRule, err error) {
vnetRulesClient, err := azuresqlshared.GetGoVNetRulesClient(azuresqlshared.GetSubscriptionCredentials(m.creds,... | [
0.8838629126548767,
0.3998110294342041,
0.2799563407897949,
-0.4861370027065277,
0.04721815511584282,
0.20203274488449097,
-1.7718950510025024,
-0.6565496325492859,
0.024927357211709023,
0.5510561466217041,
0.954765796661377,
1.2845368385314941,
-0.4427066445350647,
0.10076019167900085,
... |
func (m *AzureSqlVNetRuleManager) DeleteSQLVNetRule(ctx context.Context, subscriptionID string, resourceGroupName string, serverName string, ruleName string) (err error) {
// check to see if the rule exists, if it doesn't then short-circuit
_, err = m.GetSQLVNetRule(ctx, subscriptionID, resourceGroupName, serverName... | [
0.988056480884552,
0.04007096588611603,
0.4557214677333832,
-0.4768288731575012,
0.6562508344650269,
0.20533062517642975,
-1.619377613067627,
-0.14005737006664276,
0.33956584334373474,
0.8390858173370361,
0.6659801602363586,
0.7479828000068665,
-0.38446566462516785,
0.737079918384552,
0.... |
func (m *AzureSqlVNetRuleManager) CreateOrUpdateSQLVNetRule(
ctx context.Context,
resourceGroupName string,
serverName string,
ruleName string,
VNetRG string,
VNetName string,
SubnetName string,
subscription string,
IgnoreServiceEndpoint bool,
) (vnr sql.VirtualNetworkRule, err error) {
creds := azuresqlshar... | [
0.6379028558731079,
0.0920274406671524,
0.5204214453697205,
-0.6348651647567749,
0.41223329305648804,
0.6144620776176453,
-1.5199490785598755,
-0.4792012870311737,
0.17372627556324005,
1.1367231607437134,
0.4503811299800873,
-0.09418270736932755,
-0.3479926288127899,
0.22931823134422302,
... |
func (m *YBPSuccess) Validate(formats strfmt.Registry) error {
return nil
} | [
0.8345763683319092,
-0.12076512724161148,
0.31122010946273804,
0.4037826359272003,
0.5279391407966614,
0.7835644483566284,
0.6374183893203735,
0.1515904664993286,
-0.03867606446146965,
-0.28660815954208374,
-0.3940926492214203,
0.005555761978030205,
-0.7461103796958923,
0.41301804780960083... |
func (m *YBPSuccess) ContextValidate(ctx context.Context, formats strfmt.Registry) error {
var res []error
if err := m.contextValidateMessage(ctx, formats); err != nil {
res = append(res, err)
}
if err := m.contextValidateSuccess(ctx, formats); err != nil {
res = append(res, err)
}
if len(res) > 0 {
retu... | [
0.651992917060852,
-0.023893054574728012,
0.6044580936431885,
0.34334713220596313,
-0.05757388100028038,
0.49505701661109924,
0.30565544962882996,
-0.3658376932144165,
0.6922610402107239,
0.5451569557189941,
-0.16598628461360931,
0.5647291541099548,
-0.557486355304718,
0.14738044142723083,... |
func onDataSourceDelete(ctx context.Context, deletedSource string) {
// TODO - find a way to delete datasources - surely a config watch
log.Logger(ctx).Info("Sync = Send Event Server-wide for " + deletedSource)
cl := defaults.NewClient()
cl.Publish(ctx, cl.NewPublication(common.TOPIC_DATASOURCE_EVENT, &object.Dat... | [
0.6530495285987854,
-0.007813272066414356,
0.42081162333488464,
-0.7739094495773315,
-0.12831911444664001,
-1.0378271341323853,
-0.44194138050079346,
0.1741562783718109,
1.083359956741333,
-0.02900736965239048,
-1.144350528717041,
1.0757100582122803,
0.1317911595106125,
0.3123365640640259,... |
func TestActionNewAccount(t *testing.T) {
pubKey, err := ecc.NewPublicKey(ecc.PublicKeyPrefixCompat + "6MRyAjQq8ud7hVNYcfnVPJqcVpscN5So8BhtHuGYqET5GDW5CV")
require.NoError(t, err)
a := &eos.Action{
Account: eos.AccountName("eosio"),
Name: eos.ActionName("newaccount"),
Authorization: []eos.PermissionLevel{
... | [
0.34299880266189575,
-0.9155674576759338,
0.8097873330116272,
-0.3570815920829773,
0.42243877053260803,
0.168567955493927,
0.30137792229652405,
-0.38962051272392273,
0.47116488218307495,
0.14378833770751953,
-0.623429536819458,
0.4674335718154907,
0.9879806637763977,
-0.23352424800395966,
... |
func (p *PdfiumImplementation) FPDFPage_Flatten(request *requests.FPDFPage_Flatten) (*responses.FPDFPage_Flatten, error) {
p.Lock()
defer p.Unlock()
pageHandle, err := p.loadPage(request.Page)
if err != nil {
return nil, err
}
flattenPageResult := C.FPDFPage_Flatten(pageHandle.handle, C.int(request.Usage))
... | [
-1.701570987701416,
-0.16328121721744537,
0.5778576731681824,
-0.3830093443393707,
0.35469257831573486,
-1.0039381980895996,
0.29202887415885925,
-0.6948200464248657,
0.3157118558883667,
-0.30220234394073486,
0.20027445256710052,
-0.7018385529518127,
-1.4092227220535278,
0.2357192635536193... |
func newACLFilter(authorizer acl.Authorizer, logger *log.Logger, enforceVersion8 bool) *aclFilter {
if logger == nil {
logger = log.New(os.Stderr, "", log.LstdFlags)
}
return &aclFilter{
authorizer: authorizer,
logger: logger,
enforceVersion8: enforceVersion8,
}
} | [
0.3167347013950348,
-0.6115913391113281,
0.23434394598007202,
0.34589213132858276,
-1.483615756034851,
-0.18207716941833496,
-0.43862253427505493,
0.11788354068994522,
0.2331351935863495,
0.02522425912320614,
-0.007014910690486431,
1.038715124130249,
-0.0034071060363203287,
0.7715802788734... |
func (f *aclFilter) allowNode(node string) bool {
if !f.enforceVersion8 {
return true
}
return f.authorizer.NodeRead(node)
} | [
-0.09867926687002182,
1.0188922882080078,
0.5184653401374817,
-0.24809397757053375,
-1.2352855205535889,
0.737170934677124,
-0.1426856517791748,
0.29918792843818665,
0.017906973138451576,
0.8908038139343262,
1.5407084226608276,
0.6355821490287781,
-0.3095881938934326,
-0.2757526934146881,
... |
func (f *aclFilter) allowService(service string) bool {
if service == "" {
return true
}
if !f.enforceVersion8 && service == structs.ConsulServiceID {
return true
}
return f.authorizer.ServiceRead(service)
} | [
-0.07237062603235245,
0.09320396184921265,
0.48696625232696533,
0.572934627532959,
-1.4913301467895508,
0.6366392970085144,
-0.17284627258777618,
-0.3192213177680969,
0.3878980576992035,
0.023956038057804108,
1.532562494277954,
0.6356307864189148,
-0.8678907752037048,
0.5330685973167419,
... |
func (f *aclFilter) allowSession(node string) bool {
if !f.enforceVersion8 {
return true
}
return f.authorizer.SessionRead(node)
} | [
-0.572955310344696,
0.29495954513549805,
0.5136619210243225,
-0.011762681417167187,
-1.0638643503189087,
0.5731158256530762,
0.37872597575187683,
-0.5785919427871704,
0.3716672658920288,
1.0298348665237427,
1.1430107355117798,
0.4921284317970276,
-0.17347724735736847,
-0.7430321574211121,
... |
func (f *aclFilter) filterHealthChecks(checks *structs.HealthChecks) {
hc := *checks
for i := 0; i < len(hc); i++ {
check := hc[i]
if f.allowNode(check.Node) && f.allowService(check.ServiceName) {
continue
}
f.logger.Printf("[DEBUG] consul: dropping check %q from result due to ACLs", check.CheckID)
hc = ... | [
0.7738146781921387,
0.16895601153373718,
0.411350816488266,
0.504499614238739,
-0.4723713994026184,
0.6503217816352844,
0.7699573636054993,
-0.5199125409126282,
-0.0779782235622406,
-0.5339182615280151,
2.1379990577697754,
0.6688170433044434,
-0.6947680711746216,
0.37414079904556274,
0.5... |
func (f *aclFilter) filterServices(services structs.Services) {
for svc := range services {
if f.allowService(svc) {
continue
}
f.logger.Printf("[DEBUG] consul: dropping service %q from result due to ACLs", svc)
delete(services, svc)
}
} | [
0.022257408127188683,
0.4258626401424408,
0.34501415491104126,
-0.18994903564453125,
-0.9805266857147217,
0.0685945451259613,
0.49439966678619385,
-0.8178017139434814,
0.5640239119529724,
0.1320537030696869,
1.6372158527374268,
-0.03294325992465019,
-1.060739278793335,
0.45522844791412354,... |
func (f *aclFilter) filterServiceNodes(nodes *structs.ServiceNodes) {
sn := *nodes
for i := 0; i < len(sn); i++ {
node := sn[i]
if f.allowNode(node.Node) && f.allowService(node.ServiceName) {
continue
}
f.logger.Printf("[DEBUG] consul: dropping node %q from result due to ACLs", node.Node)
sn = append(sn[... | [
-0.044791847467422485,
0.5091769695281982,
0.3670988976955414,
-0.4761526882648468,
-0.8469607830047607,
-0.05761560797691345,
0.6057605743408203,
-0.2343946397304535,
-0.23094499111175537,
1.1068103313446045,
1.0865017175674438,
0.9899329543113708,
-0.5247762799263,
0.058172665536403656,
... |
func (f *aclFilter) filterNodeServices(services **structs.NodeServices) {
if *services == nil {
return
}
if !f.allowNode((*services).Node.Node) {
*services = nil
return
}
for svc := range (*services).Services {
if f.allowService(svc) {
continue
}
f.logger.Printf("[DEBUG] consul: dropping service %... | [
-0.0015631638234481215,
0.7050963640213013,
0.41567739844322205,
-0.42924854159355164,
-0.7613613605499268,
-0.19804975390434265,
0.6084334850311279,
-1.317644476890564,
0.3429855704307556,
0.12601174414157867,
1.972847819328308,
0.17829391360282898,
-0.6079436540603638,
0.3913294076919555... |
func (f *aclFilter) filterCheckServiceNodes(nodes *structs.CheckServiceNodes) {
csn := *nodes
for i := 0; i < len(csn); i++ {
node := csn[i]
if f.allowNode(node.Node.Node) && f.allowService(node.Service.Service) {
continue
}
f.logger.Printf("[DEBUG] consul: dropping node %q from result due to ACLs", node.N... | [
0.11712581664323807,
0.2772086262702942,
0.33350905776023865,
-0.053533885627985,
-0.5435136556625366,
0.2852191925048828,
0.5650596022605896,
-0.1507910192012787,
-0.12344638258218765,
0.7280580997467041,
1.3076447248458862,
0.9428194165229797,
-0.4184221625328064,
0.18316133320331573,
... |
func (f *aclFilter) filterSessions(sessions *structs.Sessions) {
s := *sessions
for i := 0; i < len(s); i++ {
session := s[i]
if f.allowSession(session.Node) {
continue
}
f.logger.Printf("[DEBUG] consul: dropping session %q from result due to ACLs", session.ID)
s = append(s[:i], s[i+1:]...)
i--
}
*se... | [
0.13334357738494873,
-0.2919238209724426,
0.4798203706741333,
-0.04168364033102989,
-0.655954897403717,
-0.07793184369802475,
1.1644788980484009,
-1.3368638753890991,
0.8654630780220032,
0.9089588522911072,
1.0342025756835938,
0.2449501007795334,
-0.8197193145751953,
-0.2902991473674774,
... |
func (f *aclFilter) filterCoordinates(coords *structs.Coordinates) {
c := *coords
for i := 0; i < len(c); i++ {
node := c[i].Node
if f.allowNode(node) {
continue
}
f.logger.Printf("[DEBUG] consul: dropping node %q from result due to ACLs", node)
c = append(c[:i], c[i+1:]...)
i--
}
*coords = c
} | [
0.12566688656806946,
0.6570544838905334,
0.34838205575942993,
-0.663194477558136,
-0.7413957118988037,
0.1956198364496231,
1.0664006471633911,
-0.4129902422428131,
-0.06897891312837601,
0.3216952681541443,
1.0583348274230957,
0.5440511703491211,
-0.6326169967651367,
-0.4515431523323059,
... |
func (f *aclFilter) filterIntentions(ixns *structs.Intentions) {
// Management tokens can see everything with no filtering.
if f.authorizer.ACLRead() {
return
}
// Otherwise, we need to see what the token has access to.
ret := make(structs.Intentions, 0, len(*ixns))
for _, ixn := range *ixns {
// If no prefi... | [
0.0037977644242346287,
-0.1065857782959938,
0.4252222180366516,
-0.0866536796092987,
0.040078625082969666,
-0.2890778183937073,
0.46803438663482666,
-0.812747597694397,
0.7096723914146423,
-0.03426315635442734,
1.3522779941558838,
0.9888737201690674,
-0.3654567301273346,
-0.107732683420181... |
func (f *aclFilter) filterNodeDump(dump *structs.NodeDump) {
nd := *dump
for i := 0; i < len(nd); i++ {
info := nd[i]
// Filter nodes
if node := info.Node; !f.allowNode(node) {
f.logger.Printf("[DEBUG] consul: dropping node %q from result due to ACLs", node)
nd = append(nd[:i], nd[i+1:]...)
i--
con... | [
-0.0986306369304657,
0.42416998744010925,
0.5687639117240906,
-1.0114365816116333,
-0.9722851514816284,
-0.05712028965353966,
0.862583339214325,
-0.8092271089553833,
0.05000343918800354,
-0.3600117266178131,
1.246981143951416,
0.7070175409317017,
0.029118996113538742,
0.2171788066625595,
... |
func (f *aclFilter) filterNodes(nodes *structs.Nodes) {
n := *nodes
for i := 0; i < len(n); i++ {
node := n[i].Node
if f.allowNode(node) {
continue
}
f.logger.Printf("[DEBUG] consul: dropping node %q from result due to ACLs", node)
n = append(n[:i], n[i+1:]...)
i--
}
*nodes = n
} | [
-0.13218313455581665,
0.9297623634338379,
0.2608034610748291,
-0.6706514358520508,
-0.33582058548927307,
-0.09922360628843307,
0.8506425619125366,
-0.26591575145721436,
-0.2102731168270111,
1.0511888265609741,
0.8906335830688477,
0.7935472726821899,
-0.7238017320632935,
-0.2206459939479828... |
func (f *aclFilter) redactPreparedQueryTokens(query **structs.PreparedQuery) {
// Management tokens can see everything with no filtering.
if f.authorizer.ACLWrite() {
return
}
// Let the user see if there's a blank token, otherwise we need
// to redact it, since we know they don't have a management
// token.
... | [
-0.007350368890911341,
-0.07859502732753754,
0.43940696120262146,
-0.28800299763679504,
-0.5753579139709473,
0.3070871829986572,
-0.05415857955813408,
0.01486013550311327,
0.6293947696685791,
-0.22857218980789185,
-0.20095106959342957,
1.3245453834533691,
0.5081661343574524,
-0.06501604616... |
func (f *aclFilter) filterPreparedQueries(queries *structs.PreparedQueries) {
// Management tokens can see everything with no filtering.
if f.authorizer.ACLWrite() {
return
}
// Otherwise, we need to see what the token has access to.
ret := make(structs.PreparedQueries, 0, len(*queries))
for _, query := range ... | [
0.09591247141361237,
-0.07058431208133698,
0.2712711989879608,
-0.2213265299797058,
-0.4410366714000702,
-0.09732713550329208,
0.3760460317134857,
-0.577495276927948,
0.5702134966850281,
0.17874667048454285,
0.6760865449905396,
0.07609466463327408,
0.10582390427589417,
0.6226431131362915,
... |
func (r *ACLResolver) filterACL(token string, subj interface{}) error {
// Get the ACL from the token
authorizer, err := r.ResolveToken(token)
if err != nil {
return err
}
// Fast path if ACLs are not enabled
if authorizer == nil {
return nil
}
return r.filterACLWithAuthorizer(authorizer, subj)
} | [
1.659961223602295,
0.23682111501693726,
0.5259638428688049,
0.8595054745674133,
-0.7880037426948547,
-0.5485978126525879,
-0.20561179518699646,
-0.337108314037323,
0.6063008308410645,
0.3754148483276367,
1.016379475593567,
0.602055013179779,
0.5455828309059143,
-0.1699638068675995,
0.311... |
func vetRegisterWithACL(rule acl.Authorizer, subj *structs.RegisterRequest,
ns *structs.NodeServices) error {
// Fast path if ACLs are not enabled.
if rule == nil {
return nil
}
// This gets called potentially from a few spots so we save it and
// return the structure we made if we have it.
var memo map[strin... | [
0.25022757053375244,
0.49696317315101624,
0.7655009031295776,
-0.34552136063575745,
0.10280855000019073,
-0.9498241543769836,
-0.07677017152309418,
-0.6670932769775391,
0.44724419713020325,
0.17402879893779755,
0.9040579199790955,
1.3705211877822876,
0.6362208127975464,
0.5983607172966003,... |
func vetDeregisterWithACL(rule acl.Authorizer, subj *structs.DeregisterRequest,
ns *structs.NodeService, nc *structs.HealthCheck) error {
// Fast path if ACLs are not enabled.
if rule == nil {
return nil
}
// We don't apply sentinel in this path, since at this time sentinel
// only applies to create and updat... | [
0.8562577962875366,
0.4394407272338867,
0.7736878991127014,
0.3581644594669342,
0.31874075531959534,
-0.1590203046798706,
-0.000649510242510587,
-0.35998716950416565,
0.4264982044696808,
-0.021646680310368538,
1.2250111103057861,
1.019263505935669,
0.34663107991218567,
0.5835260152816772,
... |
func vetNodeTxnOp(op *structs.TxnNodeOp, rule acl.Authorizer) error {
// Fast path if ACLs are not enabled.
if rule == nil {
return nil
}
node := op.Node
n := &api.Node{
Node: node.Node,
ID: string(node.ID),
Address: node.Address,
Datacenter: node.Datacenter,
Tagg... | [
0.39487066864967346,
0.49047353863716125,
0.6418518424034119,
-0.7725395560264587,
0.009030587039887905,
-0.6508728861808777,
0.2662574350833893,
-0.0395122654736042,
0.24223926663398743,
1.0980106592178345,
0.5837559103965759,
0.36006203293800354,
0.4248184859752655,
-0.6184542775154114,
... |
func vetServiceTxnOp(op *structs.TxnServiceOp, rule acl.Authorizer) error {
// Fast path if ACLs are not enabled.
if rule == nil {
return nil
}
service := op.Service
n := &api.Node{Node: op.Node}
svc := &api.AgentService{
ID: service.ID,
Service: service.Service,
Tags: ... | [
0.3817596435546875,
-0.07018595933914185,
0.6619362235069275,
-0.5509703159332275,
-0.3646997809410095,
-0.7005318999290466,
0.06567061692476273,
-0.14333578944206238,
0.43747156858444214,
0.981928288936615,
0.723503053188324,
0.5708944797515869,
0.20032258331775665,
-0.4359564185142517,
... |
func vetCheckTxnOp(op *structs.TxnCheckOp, rule acl.Authorizer) error {
// Fast path if ACLs are not enabled.
if rule == nil {
return nil
}
n := &api.Node{Node: op.Check.Node}
svc := &api.AgentService{
ID: op.Check.ServiceID,
Service: op.Check.ServiceID,
Tags: op.Check.ServiceTags,
}
var scope f... | [
0.3270666301250458,
0.13134722411632538,
0.7050225734710693,
0.06694159656763077,
-0.28027260303497314,
-0.27308282256126404,
0.3823447823524475,
-0.32681727409362793,
0.01104746013879776,
1.1730951070785522,
1.0430848598480225,
0.2438305765390396,
0.20006683468818665,
0.04880690574645996,... |
func CalculateBtcMDLValue(satoshis int64, mdlPerBTC string, maxDecimals int) (uint64, error) {
if satoshis < 0 {
return 0, errors.New("satoshis must be greater than or equal to 0")
}
if maxDecimals < 0 {
return 0, errors.New("maxDecimals can't be negative")
}
rate, err := mathutil.ParseRate(mdlPerBTC)
if err... | [
0.11949334293603897,
0.3701402544975281,
0.8607162833213806,
-0.3166872560977936,
-0.299221009016037,
-0.14487072825431824,
-0.5227702856063843,
0.3145977258682251,
0.01955343224108219,
-0.07132753729820251,
-0.031955018639564514,
-0.3107161819934845,
0.31429848074913025,
0.236707955598831... |
func CalculateEthMDLValue(wei *big.Int, mdlPerETH string, maxDecimals int) (uint64, error) {
if wei.Sign() < 0 {
return 0, errors.New("wei must be greater than or equal to 0")
}
if maxDecimals < 0 {
return 0, errors.New("maxDecimals can't be negative")
}
rate, err := mathutil.ParseRate(mdlPerETH)
if err != ni... | [
-0.5230746865272522,
0.6067355275154114,
0.8587260246276855,
-0.6786778569221497,
-1.0880552530288696,
-0.0901104286313057,
-0.3569013178348541,
0.06709453463554382,
0.06099642068147659,
0.3224240839481354,
0.2874479293823242,
-0.6039844751358032,
0.1730852574110031,
0.7008142471313477,
... |
func CalculateSkyMDLValue(droplets int64, mdlPerSKY string, maxDecimals int) (uint64, error) {
if droplets < 0 {
return 0, errors.New("droplets must be greater than or equal to 0")
}
if maxDecimals < 0 {
return 0, errors.New("maxDecimals can't be negative")
}
rate, err := mathutil.ParseRate(mdlPerSKY)
if err... | [
-0.531899631023407,
0.7807585597038269,
0.7818119525909424,
-0.2621086835861206,
-1.3145751953125,
-0.2560035288333893,
-0.8969069123268127,
0.28245803713798523,
0.23458483815193176,
-0.34851986169815063,
-0.07661624997854233,
0.12263339012861252,
0.018038643524050713,
0.8468543887138367,
... |
func CalculateWavesMDLValue(droplets int64, mdlPerWaves string, maxDecimals int) (uint64, error) {
if droplets < 0 {
return 0, errors.New("droplets must be greater than or equal to 0")
}
if maxDecimals < 0 {
return 0, errors.New("maxDecimals can't be negative")
}
rate, err := mathutil.ParseRate(mdlPerWaves)
... | [
-0.03189164027571678,
0.5172374248504639,
0.8359276652336121,
-0.5255944728851318,
-1.2339138984680176,
0.1206895187497139,
-0.40729930996894836,
-0.33063429594039917,
0.5235263705253601,
-0.042421482503414154,
-0.1413555145263672,
-0.6688997149467468,
-0.1351582109928131,
0.50562435388565... |
func Example() {
var window w32.HWND
{
var err error
window, err = openWindow("class name", handleEvent, 0, 0, windowWidth, windowHeight)
if err != nil {
panic(err)
}
w32.SetWindowText(window, "My New Window")
w32.ShowCursor(false)
w32.ShowWindow(window, 1)
}
driverTypes := []d3d11.DRIVER_TYPE{
d... | [
-0.8600144982337952,
0.34086084365844727,
0.9696242213249207,
0.4861205220222473,
-0.7688936591148376,
0.044082481414079666,
0.7940459847450256,
0.33517566323280334,
0.4163672626018524,
-0.23105691373348236,
-0.009031489491462708,
0.6650868654251099,
0.07964695245027542,
0.6217688918113708... |
func (a *AggregateTranslator) processMatchableTcpGateway(
params Params,
proxyName string,
parentGateway *v1.Gateway,
matchableTcpGateway *v1.MatchableTcpGateway,
builder *aggregateListenerBuilder,
) {
validateTcpHosts(params, parentGateway, matchableTcpGateway.GetTcpGateway(), matchableTcpGateway.GetMatcher().G... | [
0.30196693539619446,
-0.43340978026390076,
0.6216503977775574,
-1.0100082159042358,
-0.4954638183116913,
0.10202393680810928,
0.12742392718791962,
-0.21167078614234924,
0.30078497529029846,
0.6297118067741394,
0.06821217387914658,
-0.5796635150909424,
-0.11292339861392975,
1.29940891265869... |
func reconcileGatewayLevelHCMConfig(parentGateway *v1.Gateway, matchableHttpGateway *v1.MatchableHttpGateway) *gloov1.HttpListenerOptions {
// v ---- inheritance logic ---- v
preventChildOverrides := parentGateway.GetHybridGateway().GetDelegatedHttpGateways().GetPreventChildOverrides()
// HcmOptions
parentHcmOptio... | [
0.48469078540802,
-0.4652261435985565,
0.9840817451477051,
-0.32667142152786255,
0.6786097288131714,
0.17912700772285461,
-0.551647961139679,
-0.16915066540241241,
-0.22409068048000336,
0.05732814967632294,
-0.060091886669397354,
-0.5212193131446838,
-0.7348626255989075,
1.5135343074798584... |
func reconcileGatewayLevelSslConfig(parentGateway *v1.Gateway, matchableHttpGateway *v1.MatchableHttpGateway) *ssl.SslConfig {
// v ---- inheritance logic ---- v
preventChildOverrides := parentGateway.GetHybridGateway().GetDelegatedHttpGateways().GetPreventChildOverrides()
// SslConfig
parentSslConfig := parentGat... | [
0.30722248554229736,
-0.1808636635541916,
0.9373258948326111,
0.1588195264339447,
-0.1988830715417862,
0.3261280953884125,
-0.30183157324790955,
0.027768397703766823,
-0.36747780442237854,
-0.2279272973537445,
-0.6345397233963013,
0.17179086804389954,
-0.3005926311016083,
1.323094129562378... |
func SetHeader(ctx context.Context, key HeaderContextKey, value string) context.Context {
return context.WithValue(ctx, key, value)
} | [
0.18736790120601654,
-0.3353809714317322,
0.38374897837638855,
0.2923164367675781,
-1.0389957427978516,
0.547540009021759,
-0.779756486415863,
-0.33809518814086914,
0.7060431838035583,
-0.030123863369226456,
1.0359508991241455,
-0.007260126061737537,
0.5713179707527161,
-0.7995465993881226... |
func GetHeader(ctx context.Context, key HeaderContextKey) (header string, ok bool) {
header, ok = ctx.Value(key).(string)
return
} | [
-0.4602481424808502,
0.3854777216911316,
0.4910472631454468,
0.5627580881118774,
-0.4054899215698242,
-0.03159186244010925,
-0.7091026306152344,
-1.017141580581665,
0.571088969707489,
0.9405864477157593,
0.3237627446651459,
-0.11563186347484589,
-0.43276628851890564,
-0.7033994197845459,
... |
func NewEdgeContextHeaders(h http.Header) EdgeContextHeaders {
return EdgeContextHeaders{
EdgeRequest: h.Get(EdgeContextHeader),
}
} | [
-0.7082643508911133,
-0.7424378395080566,
0.36943188309669495,
0.29002442955970764,
-0.09371525049209595,
-0.5428815484046936,
-0.9671582579612732,
-1.1855030059814453,
0.24012702703475952,
0.6557631492614746,
0.3253936767578125,
-0.7071069478988647,
-0.8708891868591309,
-0.355684280395507... |
func (s EdgeContextHeaders) AsMap() map[string]string {
return map[string]string{
EdgeContextHeader: s.EdgeRequest,
}
} | [
-0.6965186595916748,
-0.8144798278808594,
0.635932207107544,
-0.19844426214694977,
0.06652513146400452,
0.060791075229644775,
-0.6956104040145874,
-0.895666241645813,
0.938249409198761,
0.6968902349472046,
0.8037735223770142,
-0.5970560908317566,
0.022145412862300873,
-0.3775399625301361,
... |
func NewSpanHeaders(h http.Header) SpanHeaders {
return SpanHeaders{
TraceID: h.Get(TraceIDHeader),
ParentID: h.Get(ParentIDHeader),
SpanID: h.Get(SpanIDHeader),
Flags: h.Get(SpanFlagsHeader),
Sampled: h.Get(SpanSampledHeader),
}
} | [
0.27921292185783386,
-0.5087173581123352,
0.24841587245464325,
0.436349093914032,
-1.128151774406433,
-0.47463393211364746,
-0.5283905863761902,
-1.1156580448150635,
0.9499839544296265,
-0.1284613162279129,
-1.3850682973861694,
-0.18164707720279694,
-0.7079089879989624,
-0.0034961334895342... |
func (s SpanHeaders) AsMap() map[string]string {
return map[string]string{
TraceIDHeader: s.TraceID,
ParentIDHeader: s.ParentID,
SpanIDHeader: s.SpanID,
SpanFlagsHeader: s.Flags,
SpanSampledHeader: s.Sampled,
}
} | [
0.4687667191028595,
-0.9935036897659302,
0.6394897103309631,
-0.5505184531211853,
-0.2831457853317261,
0.4535403251647949,
-0.33667927980422974,
-1.1266189813613892,
1.257927656173706,
0.008953618817031384,
-0.44690048694610596,
-0.25629571080207825,
0.3011086881160736,
-0.0398758575320243... |
func InjectTrustedContext(ctx context.Context, t HeaderTrustHandler, r *http.Request) context.Context {
if t.TrustEdgeContext(r) {
ctx = SetHeader(ctx, EdgeContextContextKey, r.Header.Get(EdgeContextHeader))
}
if t.TrustSpan(r) {
for k, v := range map[HeaderContextKey]string{
TraceIDContextKey: r.Header.... | [
-0.21189376711845398,
-0.0009271830786019564,
0.7397857308387756,
-0.7068809270858765,
-0.7255792617797852,
0.9974098205566406,
0.6419373750686646,
-1.3867300748825073,
0.3411767780780792,
0.5305383205413818,
-0.09339984506368637,
-0.16370058059692383,
-0.32989180088043213,
-0.217933893203... |
func PopulateRequestContext(t HeaderTrustHandler) httpgk.RequestFunc {
return func(ctx context.Context, r *http.Request) context.Context {
return InjectTrustedContext(ctx, t, r)
}
} | [
-0.7426557540893555,
0.4338963031768799,
0.8867473006248474,
0.2735700011253357,
-0.3950778543949127,
0.5964454412460327,
-0.37848594784736633,
-0.9185802936553955,
0.7349998950958252,
0.1253957897424698,
-0.6304498314857483,
0.06463389098644257,
0.3217591941356659,
-0.11629647016525269,
... |
func mknod(path string, mode uint32, dev uint64) error {
return unix.Mknod(path, mode, int(dev))
} | [
0.46595659852027893,
0.4305349290370941,
0.42309439182281494,
-0.10961079597473145,
-0.9268320202827454,
1.1758904457092285,
0.013215215876698494,
-0.11727727204561234,
-0.21395015716552734,
-0.258400022983551,
-0.4938490092754364,
0.5442506074905396,
0.6468462944030762,
-0.104904003441333... |
func lsetxattrCreate(link string, attr string, data []byte) error {
err := unix.Lsetxattr(link, attr, data, unix.XATTR_CREATE)
if err == unix.ENOTSUP || err == unix.ENODATA || err == unix.EEXIST {
return nil
}
return err
} | [
-0.0619375966489315,
-0.15348204970359802,
0.47358494997024536,
-0.9219036102294922,
-0.13451741635799408,
0.052719809114933014,
-0.8392615914344788,
-0.19520728290081024,
0.14971977472305298,
0.09662529826164246,
0.03659571334719658,
-0.15917415916919708,
-0.08618799597024918,
0.090796776... |
func lchmod(path string, mode os.FileMode) error {
fi, err := os.Lstat(path)
if err != nil {
return err
}
if fi.Mode()&os.ModeSymlink == 0 {
if err := os.Chmod(path, mode); err != nil {
return err
}
}
return nil
} | [
0.3446924388408661,
-0.4576348066329956,
0.8947153687477112,
-1.2658164501190186,
0.1445261687040329,
0.9087907671928406,
-0.14216113090515137,
0.07368577271699905,
0.35979774594306946,
0.14099225401878357,
0.24925637245178223,
0.5477887988090515,
-0.00006661726365564391,
0.310367673635482... |
func NewGrouping(arg string) *Grouping {
split := strings.Split(arg, ",")
var grouping *Grouping
if len(split) > 0 {
grouping = &Grouping{
Name: split[0],
}
}
if len(split) >= 2 {
index, _ := strconv.ParseInt(split[1], 0, 64)
grouping.Index = int(index)
}
if len(split) >= 3 {
duration, _ := time.Par... | [
-0.9393436908721924,
0.4794620871543884,
0.5904200673103333,
0.06267930567264557,
-1.0120761394500732,
-0.4877171814441681,
0.3155372738838196,
0.4175335466861725,
0.27874135971069336,
0.5585443377494812,
0.1339491456747055,
0.026012899354100227,
-0.5712761282920837,
-0.3124980330467224,
... |
func New(fsys fs.FS, path string) (source.Driver, error) {
var i driver
if err := i.Init(fsys, path); err != nil {
return nil, fmt.Errorf("failed to init driver with path %s: %w", path, err)
}
return &i, nil
} | [
-0.5068688988685608,
-0.9086129069328308,
0.21285364031791687,
-0.13044634461402893,
-0.7086278796195984,
-1.2547458410263062,
-0.30941590666770935,
-0.12561410665512085,
-0.2964974641799927,
-0.37561163306236267,
-0.18577228486537933,
-0.5577036738395691,
0.4195343255996704,
0.11079085618... |
func (d *driver) Open(url string) (source.Driver, error) {
return nil, errors.New("Open() cannot be called on the iofs passthrough driver")
} | [
-1.3205349445343018,
0.17194335162639618,
0.1754409521818161,
0.03526981920003891,
-0.47778746485710144,
-0.5818190574645996,
0.7398141622543335,
1.235007643699646,
0.26117175817489624,
-0.7576825618743896,
0.4897041320800781,
-0.8963228464126587,
-0.8540270328521729,
-0.3740030527114868,
... |
func (d *PartialDriver) Init(fsys fs.FS, path string) error {
entries, err := fs.ReadDir(fsys, path)
if err != nil {
return err
}
ms := source.NewMigrations()
for _, e := range entries {
if e.IsDir() {
continue
}
m, err := source.DefaultParse(e.Name())
if err != nil {
continue
}
file, err := e... | [
-0.6058633327484131,
0.13048355281352997,
0.6311053037643433,
-0.5018938779830933,
-0.21170449256896973,
-0.42344433069229126,
-0.01902085542678833,
0.1039157509803772,
-0.1303853988647461,
-0.1690317541360855,
-0.5987064242362976,
-0.026539219543337822,
0.5445675253868103,
1.0070329904556... |
func (d *PartialDriver) Close() error {
c, ok := d.fsys.(io.Closer)
if !ok {
return nil
}
return c.Close()
} | [
-0.08400285989046097,
-0.7579774856567383,
0.6281506419181824,
0.3990030884742737,
-0.4584614038467407,
-0.5289069414138794,
0.39796051383018494,
-0.8410349488258362,
-0.2617615759372711,
-1.241866946220398,
0.5139231085777283,
-1.0271320343017578,
-1.2269935607910156,
1.081668734550476,
... |
func (d *PartialDriver) First() (version uint, err error) {
if version, ok := d.migrations.First(); ok {
return version, nil
}
return 0, &fs.PathError{
Op: "first",
Path: d.path,
Err: fs.ErrNotExist,
}
} | [
0.12654371559619904,
0.025878416374325752,
0.4158705472946167,
0.5659298300743103,
0.7106238007545471,
-0.720468282699585,
0.1561613231897354,
0.23194314539432526,
-0.6113696098327637,
0.7280113101005554,
-0.21589627861976624,
-0.1919889599084854,
-0.028822600841522217,
0.9961103796958923,... |
func (d *PartialDriver) Prev(version uint) (prevVersion uint, err error) {
if version, ok := d.migrations.Prev(version); ok {
return version, nil
}
return 0, &fs.PathError{
Op: "prev for version " + strconv.FormatUint(uint64(version), 10),
Path: d.path,
Err: fs.ErrNotExist,
}
} | [
-0.37484580278396606,
0.41250428557395935,
0.8406175971031189,
0.38283103704452515,
-0.10006540268659592,
-0.3752538859844208,
1.1564372777938843,
0.3739321529865265,
0.19910910725593567,
0.6243862509727478,
-0.5650469660758972,
-0.7148834466934204,
-0.531358540058136,
0.20824533700942993,... |
func (d *PartialDriver) Next(version uint) (nextVersion uint, err error) {
if version, ok := d.migrations.Next(version); ok {
return version, nil
}
return 0, &fs.PathError{
Op: "next for version " + strconv.FormatUint(uint64(version), 10),
Path: d.path,
Err: fs.ErrNotExist,
}
} | [
-0.7589960694313049,
0.03064621426165104,
0.5155316591262817,
0.7006214261054993,
-0.6567404270172119,
-0.25939032435417175,
0.3022027611732483,
0.14228001236915588,
0.5044450163841248,
0.24454833567142487,
-0.2162378430366516,
-0.2422509342432022,
-0.3946336805820465,
0.5283469557762146,
... |
func (d *PartialDriver) ReadUp(version uint) (r io.ReadCloser, identifier string, err error) {
if m, ok := d.migrations.Up(version); ok {
body, err := d.open(path.Join(d.path, m.Raw))
if err != nil {
return nil, "", err
}
return body, m.Identifier, nil
}
return nil, "", &fs.PathError{
Op: "read up for... | [
-1.1387724876403809,
-0.5257605314254761,
1.069187879562378,
-0.38902491331100464,
-0.9535365700721741,
0.20508632063865662,
0.4195307195186615,
0.5369943380355835,
0.268149197101593,
0.8206814527511597,
0.12507733702659607,
-0.13427239656448364,
0.18458832800388336,
-0.20324978232383728,
... |
func (d *PartialDriver) ReadDown(version uint) (r io.ReadCloser, identifier string, err error) {
if m, ok := d.migrations.Down(version); ok {
body, err := d.open(path.Join(d.path, m.Raw))
if err != nil {
return nil, "", err
}
return body, m.Identifier, nil
}
return nil, "", &fs.PathError{
Op: "read do... | [
-0.6063192486763,
-0.8019788265228271,
1.0598441362380981,
-0.07794418931007385,
-0.9769738912582397,
0.6821185946464539,
0.4231625199317932,
0.37747013568878174,
0.40527036786079407,
0.3702079653739929,
0.20519369840621948,
-0.08435851335525513,
-0.2855665385723114,
0.32660189270973206,
... |
func (b BitBool) Value() (driver.Value, error) {
if b {
return []byte{1}, nil
} else {
return []byte{0}, nil
}
} | [
-0.6417369842529297,
0.11220955848693848,
0.507298469543457,
1.0607668161392212,
1.275610327720642,
0.3118019104003906,
0.035272497683763504,
-0.5746046900749207,
0.09972738474607468,
1.0246806144714355,
-0.035856153815984726,
0.5494502186775208,
-0.5678842067718506,
0.7232211828231812,
... |
func (b *BitBool) Scan(src interface{}) error {
v, ok := src.([]byte)
if !ok {
return errors.New("bad []byte type assertion")
}
*b = v[0] == 1
return nil
} | [
-0.9669470191001892,
0.4858451783657074,
0.39306730031967163,
1.3011130094528198,
-0.06166571006178856,
0.31722259521484375,
0.6929326057434082,
-0.09462565928697586,
0.010302169248461723,
-0.48879188299179077,
-0.623930037021637,
0.9523546695709229,
-1.054833173751831,
1.1402055025100708,... |
func New() (*Server, error) {
return &Server{}, nil
} | [
-0.974811851978302,
-1.2014762163162231,
-0.23714815080165863,
0.029330605641007423,
-0.07901690155267715,
-0.19690169394016266,
-0.2570624053478241,
-0.1943998783826828,
-0.12713894248008728,
-0.6238739490509033,
-0.6462060809135437,
0.9274974465370178,
0.009680302813649178,
0.72900575399... |
func Inject(target interface{}) Option {
v := reflect.ValueOf(target)
if t := v.Type(); t.Kind() != reflect.Ptr || t.Elem().Kind() != reflect.Struct {
return Invoke(func() error {
return fmt.Errorf("Inject expected a pointer to a struct, got a %v", t)
})
}
v = v.Elem()
t := v.Type()
// We generate a fun... | [
-0.8413007259368896,
0.20497731864452362,
0.838018000125885,
-0.37369805574417114,
0.35986319184303284,
-0.5354894399642944,
0.8178406357765198,
-0.24288703501224518,
-0.23901039361953735,
-0.09244010597467422,
-0.32834339141845703,
0.2876706123352051,
0.4225977659225464,
-0.59564036130905... |
func Rfc3339NanoEncoder(t time.Time, enc zapcore.PrimitiveArrayEncoder) {
enc.AppendString(t.Format(time.RFC3339Nano))
} | [
-0.7965761423110962,
0.5965690016746521,
0.15299229323863983,
-0.05027153715491295,
-0.08236417919397354,
0.653046727180481,
-1.4827526807785034,
-0.3194466531276703,
0.9453538060188293,
0.13611458241939545,
-0.6482334136962891,
0.731207013130188,
0.4394323527812958,
1.1396654844284058,
... |
func InitLogger(debug bool) {
var cfg zap.Config
if debug {
cfg = zap.NewDevelopmentConfig()
} else {
cfg = zap.NewProductionConfig()
cfg.EncoderConfig.LevelKey = "lvl"
cfg.EncoderConfig.MessageKey = "msg"
cfg.EncoderConfig.TimeKey = "timestamp"
cfg.EncoderConfig.EncodeTime = Rfc3339NanoEncoder
}
var... | [
-0.23378995060920715,
0.23950684070587158,
0.7406212687492371,
0.579253077507019,
0.0026975320652127266,
0.4476453959941864,
-0.4061509668827057,
0.6025028824806213,
-0.2825479805469513,
0.40694308280944824,
-1.0332906246185303,
-0.12295465171337128,
-0.6324671506881714,
2.0613534450531006... |
func L(ctx context.Context) *zap.Logger {
if ctx == nil {
return log
}
if l, ok := ctx.Value(requestIDKey).(*zap.Logger); ok {
return l
}
return log
} | [
-0.09373997151851654,
-0.19380788505077362,
0.44341227412223816,
0.09980198740959167,
-0.34249863028526306,
0.28917020559310913,
-0.3389875590801239,
-0.6339642405509949,
1.531374454498291,
-0.5548816919326782,
0.562737226486206,
-0.040680158883333206,
-0.29615116119384766,
0.6233461499214... |
func LogRequest(next http.Handler) http.Handler {
fn := func(w http.ResponseWriter, r *http.Request) {
// Start timer
start := time.Now()
// Add a requestID field to logger
uid, _ := ulid.NewFromTime(start)
l := log.With(zap.String("requestID", uid.String()))
// Add logger to context
ctx := context.With... | [
-0.39467790722846985,
0.10687731206417084,
0.9117197394371033,
-0.8013985753059387,
-0.7846524715423584,
-0.37913623452186584,
-0.46034061908721924,
-0.043683454394340515,
0.11015626788139343,
-0.11784381419420242,
0.5388635993003845,
-0.12085045129060745,
0.40990233421325684,
-0.351884752... |
func Recoverer(next http.Handler) http.Handler {
fn := func(w http.ResponseWriter, r *http.Request) {
defer func() {
if err := recover(); err != nil {
// stack := stack(3)
L(r.Context()).Error("panic", zap.Error(err.(error)), zap.Stack("stack"))
http.Error(w, http.StatusText(http.StatusInternalServerE... | [
0.1471414715051651,
-0.15360747277736664,
0.641543984413147,
0.7836277484893799,
-0.6886897683143616,
0.24266476929187775,
0.019617445766925812,
-0.476742148399353,
0.512241542339325,
-0.6284209489822388,
0.07606085389852524,
-0.5778083801269531,
0.23616141080856323,
0.48868653178215027,
... |
func New(mac string) (*MagicPacket, error) {
var packet MagicPacket
var macAddr WolMac
hwAddr, err := net.ParseMAC(mac)
if err != nil {
return nil, err
}
// We only support 6 byte MAC addresses since it is much harder to use the
// binary.Write(...) interface when the size of the MagicPacket is dynamic.
reg... | [
-0.3286474049091339,
-0.1945892572402954,
0.6202671527862549,
-0.7413887977600098,
-1.3959994316101074,
-0.951880156993866,
-0.15861910581588745,
-0.432750940322876,
0.0921964943408966,
-0.39696040749549866,
0.3064066767692566,
0.3419743478298187,
0.14103780686855316,
0.4253188967704773,
... |
func (mp *MagicPacket) Marshal() ([]byte, error) {
var buf bytes.Buffer
if err := binary.Write(&buf, binary.BigEndian, mp); err != nil {
return nil, err
}
return buf.Bytes(), nil
} | [
0.07134053111076355,
0.4940944314002991,
0.46643754839897156,
-0.7937125563621521,
-0.4996680021286011,
0.26905912160873413,
-1.4013655185699463,
-0.0040528299286961555,
0.5329331755638123,
-0.6176852583885193,
-0.10418538749217987,
1.3200089931488037,
-1.1879059076309204,
0.80115431547164... |
func ResolveExmplRootMessageInput__MapEnum(tr tracer.Tracer, ctx context.Context, i interface{}) (_ map[int32]testdata.RootMessage_NestedEnum, rerr error) {
span := tr.CreateChildSpanFromContext(ctx, "ResolveExmplRootMessageInput__MapEnum")
defer span.Finish()
defer func() {
if perr := recover(); perr != nil {
... | [
-1.2284817695617676,
-0.5460246801376343,
1.0667996406555176,
-0.4400595426559448,
-0.2977982461452484,
0.2029823660850525,
0.8084286451339722,
-0.33267098665237427,
0.3722634017467499,
-0.02947152405977249,
-0.306873083114624,
-0.1850634217262268,
-0.46977606415748596,
0.8393519520759583,... |
func (*CustomerExtensionSettingOperation) XXX_OneofWrappers() []interface{} {
return []interface{}{
(*CustomerExtensionSettingOperation_Create)(nil),
(*CustomerExtensionSettingOperation_Update)(nil),
(*CustomerExtensionSettingOperation_Remove)(nil),
}
} | [
-0.9892392158508301,
0.5537344217300415,
0.37263497710227966,
0.4166313707828522,
-0.49631163477897644,
-0.925656259059906,
0.6381505131721497,
-0.4668075144290924,
0.9251954555511475,
0.8035165667533875,
-0.432181715965271,
-0.6660264134407043,
-0.4986339211463928,
-0.1490943431854248,
... |
func (m *Model34) Validate(formats strfmt.Registry) error {
var res []error
if err := m.validateDeviceID(formats); err != nil {
res = append(res, err)
}
if err := m.validateDeviceType(formats); err != nil {
res = append(res, err)
}
if len(res) > 0 {
return errors.CompositeValidationError(res...)
}
retu... | [
-0.7786760330200195,
0.02352866530418396,
-0.04854065924882889,
0.1577529013156891,
0.41650691628456116,
0.19175070524215698,
-0.12735474109649658,
-1.2271329164505005,
-0.13103972375392914,
0.22571879625320435,
0.01726604625582695,
-0.3103128671646118,
-1.3638880252838135,
0.8060483336448... |
func (m *Model34) ContextValidate(ctx context.Context, formats strfmt.Registry) error {
return nil
} | [
0.26685383915901184,
0.10390207171440125,
0.06732261180877686,
-0.03335648030042648,
0.23072990775108337,
0.604793131351471,
-0.7476634979248047,
-0.46672487258911133,
0.9627174735069275,
-0.1260235458612442,
-0.2968848943710327,
0.17249947786331177,
-1.639868974685669,
0.31070974469184875... |
func (h Handler) NewRouter() *echo.Echo {
e := echo.New()
h.defineMiddlewares(e)
h.defineRoutes(e)
return e
} | [
0.2515445649623871,
-0.3650709390640259,
0.5701614618301392,
1.071541428565979,
-1.0302702188491821,
0.537078857421875,
-0.005307164508849382,
0.18095746636390686,
0.21982556581497192,
-0.8749732971191406,
-0.5750759840011597,
0.5028421878814697,
-0.04526487737894058,
1.8144365549087524,
... |
func NewSliceIter(slice interface{}) SliceIter {
return SliceIter{slice}
} | [
-0.33037737011909485,
-0.47716522216796875,
-0.035537295043468475,
0.2185925394296646,
-2.4433329105377197,
-0.45431241393089294,
-0.6498793959617615,
-0.23105590045452118,
0.1156194880604744,
1.094391942024231,
0.008602692745625973,
0.036250121891498566,
0.24988755583763123,
1.11955058574... |
func (s SliceIter) Peek() interface{} {
val := reflect.ValueOf(s.slice)
return val.Index(0).Interface()
} | [
-0.7634783387184143,
0.2150886505842209,
0.5919448733329773,
-0.5260506868362427,
-1.0759477615356445,
-0.6755887269973755,
0.4900122284889221,
-1.2974507808685303,
0.1508830189704895,
0.37152811884880066,
0.2338738739490509,
1.3828634023666382,
0.24709796905517578,
0.23590131103992462,
... |
func (s SliceIter) IsEmpty() bool {
val := reflect.ValueOf(s.slice)
return val.Len() == 0
} | [
-1.4395501613616943,
-0.18909801542758942,
0.38571909070014954,
-0.19015628099441528,
0.03711739555001259,
-0.5164995789527893,
-0.14269694685935974,
0.022695191204547882,
0.018158486112952232,
0.4861857295036316,
-0.2157469540834427,
0.9720208048820496,
-0.01909973844885826,
0.43273288011... |
func (s *SliceIter) Next() {
val := reflect.ValueOf(s.slice)
val = val.Slice(1, val.Len())
s.slice = val.Interface()
} | [
-0.6909513473510742,
0.35522016882896423,
0.16918528079986572,
-0.17232215404510498,
-1.1000627279281616,
-0.10689294338226318,
-0.14199960231781006,
0.15252451598644257,
0.5172537565231323,
0.24187564849853516,
0.20214617252349854,
1.2693995237350464,
-0.05199096351861954,
0.7456963062286... |
func (is *InputStream) Mark() {
is.markPush(is.offset)
} | [
-0.21820877492427826,
-0.08205772936344147,
0.39052650332450867,
-0.4037025272846222,
0.8296728730201721,
0.23269078135490417,
0.4740135371685028,
-0.10204064846038818,
0.20656166970729828,
-0.3285701274871826,
-0.19387255609035492,
1.6753796339035034,
-0.11649345606565475,
0.2385787367820... |
func Abbreviate(s string) string {
regex := regexp.MustCompile(`[a-zA-Z']+`).FindAllString(s, -1)
fmt.Println(regex)
return ""
} | [
0.6397934556007385,
-0.460834801197052,
0.6756213307380676,
-0.5468800067901611,
-0.20853553712368011,
-0.026140054687857628,
-0.3487790822982788,
0.4305640757083893,
-0.04805922135710716,
0.35878923535346985,
1.3753052949905396,
1.2100789546966553,
-0.19511927664279938,
-0.057405177503824... |
func Binary(sc trace.SpanContext) []byte {
if sc == (trace.SpanContext{}) {
return nil
}
var b [29]byte
copy(b[2:18], sc.TraceID[:])
b[18] = 1
copy(b[19:27], sc.SpanID[:])
b[27] = 2
b[28] = uint8(sc.TraceOptions)
return b[:]
} | [
0.507524311542511,
-0.46904459595680237,
0.5560651421546936,
0.25385501980781555,
0.7352249026298523,
0.38366544246673584,
-0.055955514311790466,
-1.5272729396820068,
1.483229637145996,
0.12794581055641174,
-0.9395048022270203,
0.36751002073287964,
-0.570475161075592,
0.018352335318922997,... |
func FromBinary(b []byte) (sc trace.SpanContext, ok bool) {
if len(b) == 0 || b[0] != 0 {
return trace.SpanContext{}, false
}
b = b[1:]
if len(b) >= 17 && b[0] == 0 {
copy(sc.TraceID[:], b[1:17])
b = b[17:]
} else {
return trace.SpanContext{}, false
}
if len(b) >= 9 && b[0] == 1 {
copy(sc.SpanID[:], b[... | [
0.6612483263015747,
0.024722406640648842,
1.0825262069702148,
0.1530480682849884,
-0.24636249244213104,
-0.09204971045255661,
0.4982629418373108,
-0.9582921266555786,
1.8618055582046509,
0.6441507339477539,
-0.7616654634475708,
-0.09838073700666428,
-0.6531872153282166,
-0.3545900881290436... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.