id
int32
0
25.3k
idx
stringlengths
5
9
nl_tokens
sequencelengths
1
418
pl_tokens
sequencelengths
22
4.98k
8,500
all-8501
[ "StorePluginResults", "stores", "a", "plugin", "s", "results", "in", "the", "database", "by", "updating", "the", "placeholder", "created", "by", "the", "call", "to", "StoreFileInfo" ]
[ "func", "(", "db", "*", "Database", ")", "StorePluginResults", "(", "results", "database", ".", "PluginResults", ")", "error", "{", "// Test connection to ElasticSearch", "err", ":=", "db", ".", "TestConnection", "(", ")", "\n", "if", "err", "!=", "nil", "{", "return", "errors", ".", "Wrap", "(", "err", ",", "\"", "\"", ")", "\n", "}", "\n\n", "client", ",", "err", ":=", "elastic", ".", "NewSimpleClient", "(", "elastic", ".", "SetURL", "(", "db", ".", "URL", ")", ",", "elastic", ".", "SetBasicAuth", "(", "utils", ".", "Getopts", "(", "db", ".", "Username", ",", "\"", "\"", ",", "\"", "\"", ")", ",", "utils", ".", "Getopts", "(", "db", ".", "Password", ",", "\"", "\"", ",", "\"", "\"", ")", ",", ")", ",", ")", "\n", "if", "err", "!=", "nil", "{", "return", "errors", ".", "Wrap", "(", "err", ",", "\"", "\"", ")", "\n", "}", "\n\n", "// get sample db record", "getSample", ",", "err", ":=", "client", ".", "Get", "(", ")", ".", "Index", "(", "db", ".", "Index", ")", ".", "Type", "(", "db", ".", "Type", ")", ".", "Id", "(", "results", ".", "ID", ")", ".", "Do", "(", "context", ".", "Background", "(", ")", ")", "\n", "// ignore 404 not found error", "if", "err", "!=", "nil", "&&", "!", "elastic", ".", "IsNotFound", "(", "err", ")", "{", "return", "errors", ".", "Wrapf", "(", "err", ",", "\"", "\"", ",", "results", ".", "ID", ")", "\n", "}", "\n\n", "if", "getSample", "!=", "nil", "&&", "getSample", ".", "Found", "{", "log", ".", "Debugf", "(", "\"", "\\n", "\"", ",", "getSample", ".", "Id", ",", "getSample", ".", "Version", ",", "getSample", ".", "Index", ",", "getSample", ".", "Type", ")", "\n", "updateScan", ":=", "map", "[", "string", "]", "interface", "{", "}", "{", "\"", "\"", ":", "time", ".", "Now", "(", ")", ".", "Format", "(", "time", ".", "RFC3339Nano", ")", ",", "\"", "\"", ":", "map", "[", "string", "]", "interface", "{", "}", "{", "<mask>", ".", "Category", ":", "map", "[", "string", "]", "interface", "{", "}", "{", "results", ".", "Name", ":", "results", ".", "Data", ",", "}", ",", "}", ",", "}", "\n", "update", ",", "err", ":=", "client", ".", "Update", "(", ")", ".", "Index", "(", "db", ".", "Index", ")", ".", "Type", "(", "db", ".", "Type", ")", ".", "Id", "(", "getSample", ".", "Id", ")", ".", "Doc", "(", "updateScan", ")", ".", "Do", "(", "context", ".", "Background", "(", ")", ")", "\n", "if", "err", "!=", "nil", "{", "return", "errors", ".", "Wrapf", "(", "err", ",", "\"", "\"", ",", "results", ".", "ID", ")", "\n", "}", "\n\n", "log", ".", "Debugf", "(", "\"", "\\n", "\"", ",", "update", ".", "Id", ",", "update", ".", "Version", ")", "\n\n", "}", "else", "{", "// ID not found so create new document with `index` command", "scan", ":=", "map", "[", "string", "]", "interface", "{", "}", "{", "\"", "\"", ":", "map", "[", "string", "]", "interface", "{", "}", "{", "results", ".", "Category", ":", "map", "[", "string", "]", "interface", "{", "}", "{", "results", ".", "Name", ":", "results", ".", "Data", ",", "}", ",", "}", ",", "\"", "\"", ":", "time", ".", "Now", "(", ")", ".", "Format", "(", "time", ".", "RFC3339Nano", ")", ",", "}", "\n\n", "newScan", ",", "err", ":=", "client", ".", "Index", "(", ")", ".", "Index", "(", "db", ".", "Index", ")", ".", "Type", "(", "db", ".", "Type", ")", ".", "OpType", "(", "\"", "\"", ")", ".", "// Id(\"1\").", "BodyJson", "(", "scan", ")", ".", "Do", "(", "context", ".", "Background", "(", ")", ")", "\n", "if", "err", "!=", "nil", "{", "return", "errors", ".", "Wrapf", "(", "err", ",", "\"", "\"", ",", "results", ".", "ID", ")", "\n", "}", "\n\n", "log", ".", "WithFields", "(", "log", ".", "Fields", "{", "\"", "\"", ":", "newScan", ".", "Id", ",", "\"", "\"", ":", "newScan", ".", "Index", ",", "\"", "\"", ":", "newScan", ".", "Type", ",", "}", ")", ".", "Debug", "(", "\"", "\"", ")", "\n", "}", "\n\n", "return", "nil", "\n", "}" ]
8,501
all-8502
[ "Finalize", "ensures", "there", "no", "nil", "pointers", "." ]
[ "func", "(", "c", "*", "VaultConfig", ")", "Finalize", "(", ")", "{", "if", "c", ".", "Address", "==", "nil", "{", "c", ".", "Address", "=", "stringFromEnv", "(", "[", "]", "string", "{", "api", ".", "EnvVaultAddress", ",", "}", ",", "\"", "\"", ")", "\n", "}", "\n\n", "if", "c", ".", "Grace", "==", "nil", "{", "c", ".", "Grace", "=", "TimeDuration", "(", "DefaultVaultGrace", ")", "\n", "}", "\n\n", "if", "c", ".", "Namespace", "==", "nil", "{", "c", ".", "Namespace", "=", "stringFromEnv", "(", "[", "]", "string", "{", "\"", "\"", "}", ",", "\"", "\"", ")", "\n", "}", "\n\n", "if", "c", ".", "RenewToken", "==", "nil", "{", "c", ".", "RenewToken", "=", "boolFromEnv", "(", "[", "]", "string", "{", "\"", "\"", ",", "}", ",", "DefaultVaultRenewToken", ")", "\n", "}", "\n\n", "if", "c", ".", "Retry", "==", "nil", "{", "c", ".", "Retry", "=", "DefaultRetryConfig", "(", ")", "\n", "}", "\n", "c", ".", "Retry", ".", "Finalize", "(", ")", "\n\n", "// Vault has custom SSL settings", "if", "c", ".", "SSL", "==", "nil", "{", "c", ".", "SSL", "=", "DefaultSSLConfig", "(", ")", "\n", "}", "\n", "if", "c", ".", "SSL", ".", "Enabled", "==", "nil", "{", "c", ".", "SSL", ".", "Enabled", "=", "Bool", "(", "true", ")", "\n", "}", "\n", "if", "c", ".", "SSL", ".", "CaCert", "==", "nil", "{", "c", ".", "SSL", ".", "CaCert", "=", "stringFromEnv", "(", "[", "]", "string", "{", "api", ".", "EnvVaultCACert", "}", ",", "\"", "\"", ")", "\n", "}", "\n", "if", "c", ".", "SSL", ".", "CaPath", "==", "nil", "{", "c", ".", "SSL", ".", "CaPath", "=", "stringFromEnv", "(", "[", "]", "string", "{", "api", ".", "EnvVaultCAPath", "}", ",", "\"", "\"", ")", "\n", "}", "\n", "if", "c", ".", "SSL", ".", "Cert", "==", "nil", "{", "c", ".", "SSL", ".", "Cert", "=", "stringFromEnv", "(", "[", "]", "string", "{", "api", ".", "EnvVaultClientCert", "}", ",", "\"", "\"", ")", "\n", "}", "\n", "if", "c", ".", "SSL", ".", "<mask>", "==", "nil", "{", "c", ".", "SSL", ".", "Key", "=", "stringFromEnv", "(", "[", "]", "string", "{", "api", ".", "EnvVaultClientKey", "}", ",", "\"", "\"", ")", "\n", "}", "\n", "if", "c", ".", "SSL", ".", "ServerName", "==", "nil", "{", "c", ".", "SSL", ".", "ServerName", "=", "stringFromEnv", "(", "[", "]", "string", "{", "api", ".", "EnvVaultTLSServerName", "}", ",", "\"", "\"", ")", "\n", "}", "\n", "if", "c", ".", "SSL", ".", "Verify", "==", "nil", "{", "c", ".", "SSL", ".", "Verify", "=", "antiboolFromEnv", "(", "[", "]", "string", "{", "api", ".", "EnvVaultInsecure", "}", ",", "true", ")", "\n", "}", "\n", "c", ".", "SSL", ".", "Finalize", "(", ")", "\n\n", "// Order of precedence", "// 1. `vault_agent_token_file` configuration value", "// 2. `token` configuration value`", "// 3. `VAULT_TOKEN` environment variable", "if", "c", ".", "Token", "==", "nil", "{", "c", ".", "Token", "=", "stringFromEnv", "(", "[", "]", "string", "{", "\"", "\"", ",", "}", ",", "\"", "\"", ")", "\n", "}", "\n\n", "if", "c", ".", "VaultAgentTokenFile", "!=", "nil", "{", "c", ".", "Token", "=", "stringFromFile", "(", "[", "]", "string", "{", "*", "c", ".", "VaultAgentTokenFile", "}", ",", "\"", "\"", ")", "\n", "c", ".", "RenewToken", "=", "Bool", "(", "false", ")", "\n", "}", "\n\n", "if", "c", ".", "Transport", "==", "nil", "{", "c", ".", "Transport", "=", "DefaultTransportConfig", "(", ")", "\n", "}", "\n", "c", ".", "Transport", ".", "Finalize", "(", ")", "\n\n", "if", "c", ".", "UnwrapToken", "==", "nil", "{", "c", ".", "UnwrapToken", "=", "boolFromEnv", "(", "[", "]", "string", "{", "\"", "\"", ",", "}", ",", "DefaultVaultUnwrapToken", ")", "\n", "}", "\n\n", "if", "c", ".", "Enabled", "==", "nil", "{", "c", ".", "Enabled", "=", "Bool", "(", "StringPresent", "(", "c", ".", "Address", ")", ")", "\n", "}", "\n", "}" ]
8,502
all-8503
[ "KubeClient", "returns", "a", "Kubernetes", "client", "." ]
[ "func", "(", "o", "*", "KubernetesClientOptions", ")", "KubeClient", "(", ")", "(", "kubernetes", ".", "Interface", ",", "error", ")", "{", "<mask>", "kube", ".", "GetKubernetesClient", "(", "o", ".", "masterURL", ",", "o", ".", "kubeConfig", ")", "\n", "}" ]
8,503
all-8504
[ "Set", "sets", "the", "config", ".", "Useful", "for", "testing", "." ]
[ "func", "(", "ca", "*", "Agent", ")", "Set", "(", "c", "*", "Config", ")", "{", "ca", ".", "mut", ".", "Lock", "(", ")", "\n", "defer", "ca", ".", "mut", ".", "Unlock", "(", ")", "\n", "var", "oldConfig", "Config", "\n", "if", "ca", ".", "c", "!=", "nil", "{", "oldConfig", "=", "*", "ca", ".", "c", "\n", "}", "\n", "delta", ":=", "Delta", "{", "oldConfig", ",", "*", "c", "}", "\n", "ca", ".", "c", "=", "c", "\n", "for", "_", ",", "subscription", ":=", "range", "ca", ".", "subscriptions", "{", "go", "func", "(", "sub", "DeltaChan", ")", "{", "// wait a minute to send each event", "end", ":=", "time", ".", "NewTimer", "(", "time", ".", "Minute", ")", "\n", "select", "{", "case", "sub", "<-", "delta", ":", "case", "<-", "end", ".", "C", ":", "}", "\n", "if", "!", "<mask>", ".", "Stop", "(", ")", "{", "// prevent new events", "<-", "end", ".", "C", "// drain the pending event", "\n", "}", "\n", "}", "(", "subscription", ")", "\n", "}", "\n", "}" ]
8,504
all-8505
[ "Update", "global", "Tracer", "configuration", "." ]
[ "func", "UpdateConfig", "(", "c", "GlobalConfig", ")", "{", "state", ".", "m", ".", "Lock", "(", ")", "\n", "defer", "state", ".", "m", ".", "Unlock", "(", ")", "\n\n", "<mask>", ".", "c", "=", "c", "\n", "}" ]
8,505
all-8506
[ "Do", "executes", "Storage", ".", "untrackCacheStorageForOrigin", "against", "the", "provided", "context", "." ]
[ "func", "(", "p", "*", "UntrackCacheStorageForOriginParams", ")", "Do", "(", "ctx", "context", ".", "<mask>", ")", "(", "err", "error", ")", "{", "return", "cdp", ".", "Execute", "(", "ctx", ",", "CommandUntrackCacheStorageForOrigin", ",", "p", ",", "nil", ")", "\n", "}" ]
8,506
all-8507
[ "SliceIndex", "indexes", "a", "slice", "(", "a", "[", "n", "]", ")", ".", "r", "must", "contain", "a", "slice", ".", "n", "must", "be", "in", "bounds", "for", "the", "slice", "." ]
[ "func", "(", "r", "region", ")", "SliceIndex", "(", "n", "int64", ")", "region", "{", "if", "r", ".", "typ", ".", "Kind", "!=", "KindSlice", "{", "panic", "(", "\"", "\"", ")", "\n", "}", "\n", "p", ":=", "r", ".", "p", ".", "proc", ".", "ReadPtr", "(", "r", ".", "a", ")", "\n", "return", "<mask>", "{", "p", ":", "r", ".", "p", ",", "a", ":", "p", ".", "Add", "(", "n", "*", "r", ".", "typ", ".", "Elem", ".", "Size", ")", ",", "typ", ":", "r", ".", "typ", ".", "Elem", "}", "\n", "}" ]
8,507
all-8508
[ "ConcatPermissioner", "concat", "permissioner" ]
[ "func", "ConcatPermissioner", "(", "<mask>", "...", "Permissioner", ")", "Permissioner", "{", "var", "newPS", "[", "]", "Permissioner", "\n", "for", "_", ",", "p", ":=", "range", "ps", "{", "if", "p", "!=", "nil", "{", "newPS", "=", "append", "(", "newPS", ",", "p", ")", "\n", "}", "\n", "}", "\n", "return", "permissioners", "(", "newPS", ")", "\n", "}" ]
8,508
all-8509
[ "Validate", "that", "options", "are", "usuable" ]
[ "func", "(", "opts", "*", "Options", ")", "Validate", "(", ")", "error", "{", "pwd", ",", "_", ":=", "os", ".", "Getwd", "(", ")", "\n", "if", "opts", ".", "App", ".", "IsZero", "(", ")", "{", "opts", ".", "App", "=", "meta", ".", "New", "(", "pwd", ")", "\n", "}", "\n", "if", "len", "(", "opts", ".", "Environment", ")", "==", "0", "{", "opts", ".", "Environment", "=", "\"", "\"", "\n", "}", "\n", "if", "opts", ".", "BuildTime", ".", "IsZero", "(", ")", "{", "opts", ".", "BuildTime", "=", "<mask>", ".", "Now", "(", ")", "\n", "}", "\n", "if", "len", "(", "opts", ".", "BuildVersion", ")", "==", "0", "{", "opts", ".", "BuildVersion", "=", "opts", ".", "BuildTime", ".", "Format", "(", "time", ".", "RFC3339", ")", "\n", "}", "\n", "if", "opts", ".", "rollback", "==", "nil", "{", "opts", ".", "rollback", "=", "&", "sync", ".", "Map", "{", "}", "\n", "}", "\n", "if", "len", "(", "opts", ".", "GoCommand", ")", "==", "0", "{", "opts", ".", "GoCommand", "=", "\"", "\"", "\n", "}", "\n", "return", "nil", "\n", "}" ]
8,509
all-8510
[ "Put", "md5", "file", "in", ".", "md5", "subdirectory", "of", "bucket", "where", "the", "file", "is", "stored", "e", ".", "g", ".", "the", "md5", "for", "https", ":", "//", "mybucket", ".", "s3", ".", "amazonaws", ".", "com", "/", "gof3r", "will", "be", "stored", "in", "https", ":", "//", "mybucket", ".", "s3", ".", "amazonaws", ".", "com", "/", "gof3r", ".", "md5" ]
[ "func", "(", "lo", "*", "largeObject", ")", "putMd5", "(", ")", "(", "err", "error", ")", "{", "calcMd5", ":=", "fmt", ".", "Sprintf", "(", "\"", "\"", ",", "lo", ".", "md5", ".", "Sum", "(", "nil", ")", ")", "\n", "md5Reader", ":=", "strings", ".", "NewReader", "(", "calcMd5", ")", "\n", "lo", ".", "logger", ".", "Debug", "(", "swiftLargeObjectLogTag", ",", "fmt", ".", "Sprintf", "(", "\"", "\"", ",", "calcMd5", ",", "lo", ".", "container", "+", "\"", "\"", "+", "lo", ".", "objectName", "+", "\"", "\"", ")", ")", "\n", "_", ",", "err", "=", "lo", ".", "c", ".", "ObjectPut", "(", "lo", ".", "<mask>", ",", "lo", ".", "objectName", "+", "\"", "\"", ",", "md5Reader", ",", "true", ",", "\"", "\"", ",", "\"", "\"", ",", "nil", ")", "\n", "return", "\n", "}" ]
8,510
all-8511
[ "authDisableCommandFunc", "executes", "the", "auth", "disable", "command", "." ]
[ "func", "authDisableCommandFunc", "(", "cmd", "*", "cobra", ".", "Command", ",", "args", "[", "]", "string", ")", "{", "if", "len", "(", "args", ")", "!=", "0", "{", "ExitWithError", "(", "ExitBadArgs", ",", "fmt", ".", "Errorf", "(", "\"", "\"", ")", ")", "\n", "}", "\n\n", "ctx", ",", "cancel", ":=", "commandCtx", "(", "cmd", ")", "\n", "_", ",", "<mask>", ":=", "mustClientFromCmd", "(", "cmd", ")", ".", "Auth", ".", "AuthDisable", "(", "ctx", ")", "\n", "cancel", "(", ")", "\n", "if", "err", "!=", "nil", "{", "ExitWithError", "(", "ExitError", ",", "err", ")", "\n", "}", "\n\n", "fmt", ".", "Println", "(", "\"", "\"", ")", "\n", "}" ]
8,511
all-8512
[ "GetProviderSpecificProperty", "returns", "a", "ProviderSpecificProperty", "if", "the", "property", "exists", "." ]
[ "func", "(", "e", "*", "Endpoint", ")", "GetProviderSpecificProperty", "(", "key", "string", ")", "(", "ProviderSpecificProperty", ",", "bool", ")", "{", "for", "_", ",", "providerSpecific", ":=", "<mask>", "e", ".", "ProviderSpecific", "{", "if", "providerSpecific", ".", "Name", "==", "key", "{", "return", "providerSpecific", ",", "true", "\n", "}", "\n", "}", "\n", "return", "ProviderSpecificProperty", "{", "}", ",", "false", "\n", "}" ]
8,512
all-8513
[ "ToArgv", "converts", "string", "s", "into", "an", "argv", "for", "exec", "." ]
[ "func", "ToArgv", "(", "s", "string", ")", "[", "]", "string", "{", "const", "(", "InArg", "=", "iota", "\n", "InArgQuote", "\n", "OutOfArg", "\n", ")", "\n", "currentState", ":=", "OutOfArg", "\n", "currentQuoteChar", ":=", "\"", "\\x00", "\"", "// to distinguish between ' and \" quotations", "\n", "// this allows to use \"foo'bar\"", "currentArg", ":=", "\"", "\"", "\n", "argv", ":=", "[", "]", "string", "{", "}", "\n\n", "isQuote", ":=", "func", "(", "c", "string", ")", "bool", "{", "return", "c", "==", "`\"`", "||", "c", "==", "`'`", "\n", "}", "\n\n", "isEscape", ":=", "func", "(", "c", "string", ")", "bool", "{", "return", "c", "==", "`\\`", "\n", "}", "\n\n", "isWhitespace", ":=", "func", "(", "c", "string", ")", "bool", "{", "return", "c", "==", "\"", "\"", "||", "c", "==", "\"", "\\t", "\"", "\n", "}", "\n\n", "L", ":=", "len", "(", "s", ")", "\n", "for", "i", ":=", "0", ";", "i", "<", "L", ";", "i", "++", "{", "c", ":=", "s", "[", "i", ":", "i", "+", "1", "]", "\n\n", "//fmt.Printf(\"c %s state %v arg %s argv %v i %d\\n\", c, currentState, currentArg, args, i)", "if", "isQuote", "(", "c", ")", "{", "switch", "currentState", "{", "case", "OutOfArg", ":", "currentArg", "=", "\"", "\"", "\n", "fallthrough", "\n", "case", "InArg", ":", "currentState", "=", "InArgQuote", "\n", "currentQuoteChar", "=", "c", "\n\n", "case", "InArgQuote", ":", "if", "c", "==", "currentQuoteChar", "{", "currentState", "=", "InArg", "\n", "}", "else", "{", "currentArg", "+=", "c", "\n", "}", "\n", "}", "\n\n", "}", "else", "if", "isWhitespace", "(", "c", ")", "{", "switch", "currentState", "{", "case", "InArg", ":", "argv", "=", "append", "(", "argv", ",", "currentArg", ")", "\n", "currentState", "=", "OutOfArg", "\n", "case", "InArgQuote", ":", "currentArg", "+=", "c", "\n", "case", "OutOfArg", ":", "// nothing", "}", "\n\n", "}", "else", "if", "isEscape", "(", "c", ")", "{", "switch", "currentState", "{", "case", "OutOfArg", ":", "currentArg", "=", "\"", "\"", "\n", "currentState", "=", "InArg", "\n", "fallthrough", "\n", "case", "InArg", ":", "fallthrough", "\n", "<mask>", "InArgQuote", ":", "if", "i", "==", "L", "-", "1", "{", "if", "runtime", ".", "GOOS", "==", "\"", "\"", "{", "// just add \\ to end for windows", "currentArg", "+=", "c", "\n", "}", "else", "{", "panic", "(", "\"", "\"", ")", "\n", "}", "\n", "}", "else", "{", "if", "runtime", ".", "GOOS", "==", "\"", "\"", "{", "peek", ":=", "s", "[", "i", "+", "1", ":", "i", "+", "2", "]", "\n", "if", "peek", "!=", "`\"`", "{", "currentArg", "+=", "c", "\n", "}", "\n", "}", "else", "{", "i", "++", "\n", "c", "=", "s", "[", "i", ":", "i", "+", "1", "]", "\n", "currentArg", "+=", "c", "\n", "}", "\n", "}", "\n", "}", "\n", "}", "else", "{", "switch", "currentState", "{", "case", "InArg", ",", "InArgQuote", ":", "currentArg", "+=", "c", "\n\n", "case", "OutOfArg", ":", "currentArg", "=", "\"", "\"", "\n", "currentArg", "+=", "c", "\n", "currentState", "=", "InArg", "\n", "}", "\n", "}", "\n", "}", "\n\n", "if", "currentState", "==", "InArg", "{", "argv", "=", "append", "(", "argv", ",", "currentArg", ")", "\n", "}", "else", "if", "currentState", "==", "InArgQuote", "{", "panic", "(", "\"", "\"", ")", "\n", "}", "\n\n", "return", "argv", "\n", "}" ]
8,513
all-8514
[ "urlsEqual", "checks", "equality", "of", "url", ".", "URLS", "between", "two", "arrays", ".", "This", "check", "pass", "even", "if", "an", "URL", "is", "in", "hostname", "and", "opposite", "is", "in", "IP", "address", "." ]
[ "func", "urlsEqual", "(", "ctx", "context", ".", "Context", ",", "lg", "*", "zap", ".", "Logger", ",", "a", "[", "]", "url", ".", "URL", ",", "b", "[", "]", "url", ".", "URL", ")", "(", "bool", ",", "error", ")", "{", "if", "len", "(", "a", ")", "!=", "len", "(", "b", ")", "{", "return", "false", ",", "fmt", ".", "Errorf", "(", "\"", "\"", ",", "urlsToStrings", "(", "a", ")", ",", "urlsToStrings", "(", "b", ")", ")", "\n", "}", "\n", "urls", ",", "err", ":=", "resolveTCPAddrs", "(", "ctx", ",", "lg", ",", "[", "]", "[", "]", "url", ".", "<mask>", "{", "a", ",", "b", "}", ")", "\n", "if", "err", "!=", "nil", "{", "return", "false", ",", "err", "\n", "}", "\n", "preva", ",", "prevb", ":=", "a", ",", "b", "\n", "a", ",", "b", "=", "urls", "[", "0", "]", ",", "urls", "[", "1", "]", "\n", "sort", ".", "Sort", "(", "types", ".", "URLs", "(", "a", ")", ")", "\n", "sort", ".", "Sort", "(", "types", ".", "URLs", "(", "b", ")", ")", "\n", "for", "i", ":=", "range", "a", "{", "if", "!", "reflect", ".", "DeepEqual", "(", "a", "[", "i", "]", ",", "b", "[", "i", "]", ")", "{", "return", "false", ",", "fmt", ".", "Errorf", "(", "\"", "\"", ",", "a", "[", "i", "]", ".", "String", "(", ")", ",", "preva", "[", "i", "]", ".", "String", "(", ")", ",", "b", "[", "i", "]", ".", "String", "(", ")", ",", "prevb", "[", "i", "]", ".", "String", "(", ")", ",", ")", "\n", "}", "\n", "}", "\n", "return", "true", ",", "nil", "\n", "}" ]
8,514
all-8515
[ "Dist2D", "derives", "the", "distance", "between", "v", "and", "v2", "on", "the", "xz", "-", "plane", ".", "The", "vectors", "are", "projected", "onto", "the", "xz", "-", "plane", "so", "the", "y", "-", "values", "are", "ignored", "." ]
[ "func", "(", "v", "Vec3", ")", "Dist2D", "(", "v1", "Vec3", ")", "float32", "{", "dx", ":=", "v1", "[", "0", "]", "-", "v", "[", "0", "]", "\n", "dz", ":=", "v1", "[", "2", "]", "-", "v", "[", "2", "]", "\n", "<mask>", "math32", ".", "Sqrt", "(", "dx", "*", "dx", "+", "dz", "*", "dz", ")", "\n", "}" ]
8,515
all-8516
[ "UnmarshalJSON", "supports", "json", ".", "Unmarshaler", "interface" ]
[ "func", "(", "v", "*", "CollectClassNamesFromSubtreeParams", ")", "UnmarshalJSON", "(", "data", "[", "]", "byte", ")", "error", "{", "r", ":=", "jlexer", ".", "Lexer", "{", "Data", ":", "data", "}", "\n", "easyjsonC5a4559bDecodeGithubComChromedpCdprotoDom77", "(", "&", "r", ",", "v", ")", "\n", "return", "r", ".", "<mask>", "(", ")", "\n", "}" ]
8,516
all-8517
[ "Locator", "returns", "a", "locator", "for", "the", "given", "resource" ]
[ "func", "(", "r", "*", "RightScriptAttachment", ")", "Locator", "(", "api", "*", "API", ")", "*", "RightScriptAttachmentLocator", "{", "for", "_", ",", "l", ":=", "<mask>", "r", ".", "Links", "{", "if", "l", "[", "\"", "\"", "]", "==", "\"", "\"", "{", "return", "api", ".", "RightScriptAttachmentLocator", "(", "l", "[", "\"", "\"", "]", ")", "\n", "}", "\n", "}", "\n", "return", "nil", "\n", "}" ]
8,517
all-8518
[ "/", "1", ".", "0", "/", "storage", "-", "pools", "/", "{", "name", "}", "/", "volumes", "/", "{", "type", "}", "List", "all", "storage", "volumes", "of", "a", "given", "volume", "type", "for", "a", "given", "storage", "pool", "." ]
[ "func", "storagePoolVolumesTypeGet", "(", "d", "*", "Daemon", ",", "r", "*", "http", ".", "Request", ")", "<mask>", "{", "project", ":=", "projectParam", "(", "r", ")", "\n\n", "// Get the name of the pool the storage volume is supposed to be", "// attached to.", "poolName", ":=", "mux", ".", "Vars", "(", "r", ")", "[", "\"", "\"", "]", "\n\n", "// Get the name of the volume type.", "volumeTypeName", ":=", "mux", ".", "Vars", "(", "r", ")", "[", "\"", "\"", "]", "\n\n", "recursion", ":=", "util", ".", "IsRecursionRequest", "(", "r", ")", "\n\n", "// Convert the volume type name to our internal integer representation.", "volumeType", ",", "err", ":=", "storagePoolVolumeTypeNameToType", "(", "volumeTypeName", ")", "\n", "if", "err", "!=", "nil", "{", "return", "BadRequest", "(", "err", ")", "\n", "}", "\n", "// Check that the storage volume type is valid.", "if", "!", "shared", ".", "IntInSlice", "(", "volumeType", ",", "supportedVolumeTypes", ")", "{", "return", "BadRequest", "(", "fmt", ".", "Errorf", "(", "\"", "\"", ",", "volumeTypeName", ")", ")", "\n", "}", "\n\n", "// Retrieve ID of the storage pool (and check if the storage pool", "// exists).", "poolID", ",", "err", ":=", "d", ".", "cluster", ".", "StoragePoolGetID", "(", "poolName", ")", "\n", "if", "err", "!=", "nil", "{", "return", "SmartError", "(", "err", ")", "\n", "}", "\n\n", "// Get the names of all storage volumes of a given volume type currently", "// attached to the storage pool.", "volumes", ",", "err", ":=", "d", ".", "cluster", ".", "StoragePoolNodeVolumesGetType", "(", "volumeType", ",", "poolID", ")", "\n", "if", "err", "!=", "nil", "{", "return", "SmartError", "(", "err", ")", "\n", "}", "\n\n", "resultString", ":=", "[", "]", "string", "{", "}", "\n", "resultMap", ":=", "[", "]", "*", "api", ".", "StorageVolume", "{", "}", "\n", "for", "_", ",", "volume", ":=", "range", "volumes", "{", "if", "!", "recursion", "{", "apiEndpoint", ",", "err", ":=", "storagePoolVolumeTypeToAPIEndpoint", "(", "volumeType", ")", "\n", "if", "err", "!=", "nil", "{", "return", "InternalError", "(", "err", ")", "\n", "}", "\n\n", "if", "apiEndpoint", "==", "storagePoolVolumeAPIEndpointContainers", "{", "apiEndpoint", "=", "\"", "\"", "\n", "}", "else", "if", "apiEndpoint", "==", "storagePoolVolumeAPIEndpointImages", "{", "apiEndpoint", "=", "\"", "\"", "\n", "}", "\n\n", "resultString", "=", "append", "(", "resultString", ",", "fmt", ".", "Sprintf", "(", "\"", "\"", ",", "version", ".", "APIVersion", ",", "poolName", ",", "apiEndpoint", ",", "volume", ")", ")", "\n", "}", "else", "{", "_", ",", "vol", ",", "err", ":=", "d", ".", "cluster", ".", "StoragePoolNodeVolumeGetType", "(", "volume", ",", "volumeType", ",", "poolID", ")", "\n", "if", "err", "!=", "nil", "{", "continue", "\n", "}", "\n\n", "volumeUsedBy", ",", "err", ":=", "storagePoolVolumeUsedByGet", "(", "d", ".", "State", "(", ")", ",", "project", ",", "vol", ".", "Name", ",", "vol", ".", "Type", ")", "\n", "if", "err", "!=", "nil", "{", "return", "SmartError", "(", "err", ")", "\n", "}", "\n", "vol", ".", "UsedBy", "=", "volumeUsedBy", "\n\n", "resultMap", "=", "append", "(", "resultMap", ",", "vol", ")", "\n", "}", "\n", "}", "\n\n", "if", "!", "recursion", "{", "return", "SyncResponse", "(", "true", ",", "resultString", ")", "\n", "}", "\n\n", "return", "SyncResponse", "(", "true", ",", "resultMap", ")", "\n", "}" ]
8,518
all-8519
[ "Set", "a", "new", "padding", "characters", "for", "the", "sequence" ]
[ "func", "(", "s", "*", "FileSequence", ")", "SetPadding", "(", "padChars", "<mask>", ")", "{", "s", ".", "padChar", "=", "padChars", "\n", "s", ".", "zfill", "=", "s", ".", "padMapper", ".", "PaddingCharsSize", "(", "padChars", ")", "\n", "}" ]
8,519
all-8520
[ "Accept", "waits", "for", "and", "returns", "the", "next", "incoming", "TLS", "connection", "then", "use", "the", "current", "TLS", "configuration", "to", "handle", "it", "." ]
[ "func", "(", "l", "*", "networkListener", ")", "Accept", "(", ")", "(", "<mask>", ".", "Conn", ",", "error", ")", "{", "c", ",", "err", ":=", "l", ".", "Listener", ".", "Accept", "(", ")", "\n", "if", "err", "!=", "nil", "{", "return", "nil", ",", "err", "\n", "}", "\n", "l", ".", "mu", ".", "RLock", "(", ")", "\n", "defer", "l", ".", "mu", ".", "RUnlock", "(", ")", "\n", "config", ":=", "l", ".", "config", "\n", "return", "tls", ".", "Server", "(", "c", ",", "config", ")", ",", "nil", "\n", "}" ]
8,520
all-8521
[ "Shutdown", "shutdowns", "bindSyncer", "waiting", "for", "the", "current", "sync", "to", "complete" ]
[ "func", "(", "b", "*", "bindSyncer", ")", "Shutdown", "(", "ctx", "context", ".", "Context", ")", "error", "{", "if", "!", "b", ".", "started", "{", "return", "nil", "\n", "}", "\n", "b", ".", "shutdown", "<-", "struct", "{", "}", "{", "}", "\n", "select", "{", "<mask>", "<-", "b", ".", "done", ":", "case", "<-", "ctx", ".", "Done", "(", ")", ":", "}", "\n", "b", ".", "started", "=", "false", "\n", "return", "ctx", ".", "Err", "(", ")", "\n", "}" ]
8,521
all-8522
[ "Create", "implements", "ClientInterface" ]
[ "func", "(", "c", "*", "Client", ")", "Create", "(", "obj", "Object", ")", "(", "Object", ",", "error", ")", "{", "result", ":=", "c", ".", "NewObject", "(", ")", "\n", "err", ":=", "c", ".", "cl", ".", "Post", "(", ")", ".", "Namespace", "(", "c", ".", "ns", ")", ".", "Resource", "(", "c", ".", "t", ".", "Plural", ")", ".", "Name", "(", "obj", ".", "GetName", "(", ")", ")", ".", "<mask>", "(", "obj", ")", ".", "Do", "(", ")", ".", "Into", "(", "result", ")", "\n", "return", "result", ",", "err", "\n", "}" ]
8,522
all-8523
[ "statusToNodeShardsForIndex", "finds", "the", "hosts", "which", "contains", "shards", "for", "the", "given", "index" ]
[ "func", "(", "c", "*", "Client", ")", "statusToNodeShardsForIndex", "(", "status", "Status", ",", "indexName", "string", ")", "(", "map", "[", "uint64", "]", "*", "URI", ",", "error", ")", "{", "result", ":=", "make", "(", "map", "[", "uint64", "]", "*", "URI", ")", "\n", "if", "maxShard", ",", "<mask>", ":=", "status", ".", "indexMaxShard", "[", "indexName", "]", ";", "ok", "{", "for", "shard", ":=", "0", ";", "shard", "<=", "int", "(", "maxShard", ")", ";", "shard", "++", "{", "fragmentNodes", ",", "err", ":=", "c", ".", "fetchFragmentNodes", "(", "indexName", ",", "uint64", "(", "shard", ")", ")", "\n", "if", "err", "!=", "nil", "{", "return", "nil", ",", "err", "\n", "}", "\n", "if", "len", "(", "fragmentNodes", ")", "==", "0", "{", "return", "nil", ",", "ErrNoFragmentNodes", "\n", "}", "\n", "node", ":=", "fragmentNodes", "[", "0", "]", "\n", "uri", ":=", "&", "URI", "{", "host", ":", "node", ".", "Host", ",", "port", ":", "node", ".", "Port", ",", "scheme", ":", "node", ".", "Scheme", ",", "}", "\n\n", "result", "[", "uint64", "(", "shard", ")", "]", "=", "uri", "\n", "}", "\n", "}", "else", "{", "return", "nil", ",", "ErrNoShard", "\n", "}", "\n", "return", "result", ",", "nil", "\n", "}" ]
8,523
all-8524
[ "leaseTimeToLiveCommandFunc", "executes", "the", "lease", "timetolive", "command", "." ]
[ "func", "leaseTimeToLiveCommandFunc", "(", "cmd", "*", "cobra", ".", "Command", ",", "args", "[", "]", "string", ")", "{", "if", "len", "(", "args", ")", "!=", "1", "{", "ExitWithError", "(", "ExitBadArgs", ",", "fmt", ".", "Errorf", "(", "\"", "\"", ")", ")", "\n", "}", "\n", "var", "opts", "[", "]", "v3", ".", "LeaseOption", "\n", "if", "timeToLiveKeys", "{", "opts", "=", "append", "(", "opts", ",", "v3", ".", "WithAttachedKeys", "(", ")", ")", "\n", "}", "\n", "resp", ",", "rerr", ":=", "mustClientFromCmd", "(", "cmd", ")", ".", "TimeToLive", "(", "<mask>", ".", "TODO", "(", ")", ",", "leaseFromArgs", "(", "args", "[", "0", "]", ")", ",", "opts", "...", ")", "\n", "if", "rerr", "!=", "nil", "{", "ExitWithError", "(", "ExitBadConnection", ",", "rerr", ")", "\n", "}", "\n", "display", ".", "TimeToLive", "(", "*", "resp", ",", "timeToLiveKeys", ")", "\n", "}" ]
8,524
all-8525
[ "someDigits", "formats", "a", "zero", "-", "prefixed", "variable", "-", "width", "integer", "at", "buf", ".", "tmp", "[", "i", "]", "." ]
[ "func", "(", "buf", "*", "buffer", ")", "someDigits", "(", "i", ",", "d", "int", ")", "int", "{", "// Print into the top, then copy down. We know there's space for at least", "// a 10-digit number.", "j", ":=", "len", "(", "buf", ".", "tmp", ")", "\n", "for", "{", "j", "--", "\n", "buf", ".", "tmp", "[", "j", "]", "=", "digits", "[", "d", "%", "10", "]", "\n", "d", "/=", "10", "\n", "if", "d", "==", "0", "{", "<mask>", "\n", "}", "\n", "}", "\n", "return", "copy", "(", "buf", ".", "tmp", "[", "i", ":", "]", ",", "buf", ".", "tmp", "[", "j", ":", "]", ")", "\n", "}" ]
8,525
all-8526
[ "NewPerfDatum", "returns", "a", "PerfDatum", "object", "suitable", "to", "use", "in", "a", "check", "result", ".", "unit", "must", "a", "valid", "Nagios", "unit", "i", ".", "e", ".", "one", "of", "us", "ms", "s", "%", "b", "kb", "mb", "gb", "tb", "c", "or", "the", "empty", "string", ".", "Zero", "to", "four", "thresholds", "may", "be", "supplied", ":", "min", "max", "warn", "and", "crit", ".", "Thresholds", "may", "be", "positive", "infinity", "negative", "infinity", "or", "NaN", "in", "which", "case", "they", "will", "be", "omitted", "in", "check", "output", "." ]
[ "func", "NewPerfDatum", "(", "label", "string", ",", "unit", "string", ",", "<mask>", "float64", ",", "thresholds", "...", "float64", ")", "(", "*", "PerfDatum", ",", "error", ")", "{", "datum", ":=", "new", "(", "PerfDatum", ")", "\n", "datum", ".", "label", "=", "label", "\n", "datum", ".", "value", "=", "value", "\n", "datum", ".", "unit", "=", "unit", "\n", "if", "!", "validUnit", "(", "unit", ")", "{", "return", "nil", ",", "fmt", ".", "Errorf", "(", "\"", "\"", ",", "unit", ")", "\n", "}", "\n", "if", "math", ".", "IsInf", "(", "value", ",", "0", ")", "||", "math", ".", "IsNaN", "(", "value", ")", "{", "return", "nil", ",", "fmt", ".", "Errorf", "(", "\"", "\"", ",", "value", ")", "\n", "}", "\n", "if", "len", "(", "thresholds", ")", ">=", "1", "{", "datum", ".", "min", "=", "&", "thresholds", "[", "0", "]", "\n", "}", "\n", "if", "len", "(", "thresholds", ")", ">=", "2", "{", "datum", ".", "max", "=", "&", "thresholds", "[", "1", "]", "\n", "}", "\n", "if", "len", "(", "thresholds", ")", ">=", "3", "{", "datum", ".", "warn", "=", "&", "thresholds", "[", "2", "]", "\n", "}", "\n", "if", "len", "(", "thresholds", ")", ">=", "4", "{", "datum", ".", "crit", "=", "&", "thresholds", "[", "3", "]", "\n", "}", "\n", "return", "datum", ",", "nil", "\n", "}" ]
8,526
all-8527
[ "Between", "check", "now", "between", "the", "begin", "end", "time", "or", "not" ]
[ "func", "Between", "(", "time1", ",", "time2", "string", ")", "bool", "{", "return", "New", "(", "<mask>", ".", "Now", "(", ")", ")", ".", "Between", "(", "time1", ",", "time2", ")", "\n", "}" ]
8,527
all-8528
[ "builds", "etcd", "client", "config", "depending", "on", "connection", "scheme", "and", "TLS", "parameters" ]
[ "func", "getETCDConfig", "(", ")", "(", "*", "etcdcv3", ".", "Config", ",", "error", ")", "{", "etcdURLsStr", ":=", "os", ".", "Getenv", "(", "\"", "\"", ")", "\n", "if", "etcdURLsStr", "==", "\"", "\"", "{", "etcdURLsStr", "=", "\"", "\"", "\n", "}", "\n", "etcdURLs", ":=", "strings", ".", "Split", "(", "etcdURLsStr", ",", "\"", "\"", ")", "\n", "firstURL", ":=", "strings", ".", "ToLower", "(", "etcdURLs", "[", "0", "]", ")", "\n", "if", "strings", ".", "HasPrefix", "(", "firstURL", ",", "\"", "\"", ")", "{", "return", "&", "etcdcv3", ".", "Config", "{", "Endpoints", ":", "etcdURLs", "}", ",", "nil", "\n", "}", "else", "if", "strings", ".", "HasPrefix", "(", "firstURL", ",", "\"", "\"", ")", "{", "caFile", ":=", "os", ".", "Getenv", "(", "\"", "\"", ")", "\n", "certFile", ":=", "<mask>", ".", "Getenv", "(", "\"", "\"", ")", "\n", "keyFile", ":=", "os", ".", "Getenv", "(", "\"", "\"", ")", "\n", "serverName", ":=", "os", ".", "Getenv", "(", "\"", "\"", ")", "\n", "isInsecureStr", ":=", "strings", ".", "ToLower", "(", "os", ".", "Getenv", "(", "\"", "\"", ")", ")", "\n", "isInsecure", ":=", "isInsecureStr", "==", "\"", "\"", "||", "isInsecureStr", "==", "\"", "\"", "||", "isInsecureStr", "==", "\"", "\"", "\n", "tlsConfig", ",", "err", ":=", "newTLSConfig", "(", "certFile", ",", "keyFile", ",", "caFile", ",", "serverName", ",", "isInsecure", ")", "\n", "if", "err", "!=", "nil", "{", "return", "nil", ",", "err", "\n", "}", "\n", "return", "&", "etcdcv3", ".", "Config", "{", "Endpoints", ":", "etcdURLs", ",", "TLS", ":", "tlsConfig", ",", "}", ",", "nil", "\n", "}", "else", "{", "return", "nil", ",", "errors", ".", "New", "(", "\"", "\"", ")", "\n", "}", "\n", "}" ]
8,528
all-8529
[ "MarshalEasyJSON", "satisfies", "easyjson", ".", "Marshaler", "." ]
[ "func", "(", "t", "MouseType", ")", "MarshalEasyJSON", "(", "out", "*", "jwriter", ".", "Writer", ")", "{", "<mask>", ".", "String", "(", "string", "(", "t", ")", ")", "\n", "}" ]
8,529
all-8530
[ "WritePact", "should", "be", "called", "writes", "when", "all", "tests", "have", "been", "performed", "for", "a", "given", "Consumer", "<", "-", ">", "Provider", "pair", ".", "It", "will", "write", "out", "the", "Pact", "to", "the", "configured", "file", "." ]
[ "func", "(", "p", "*", "Pact", ")", "WritePact", "(", ")", "error", "{", "p", ".", "Setup", "(", "true", ")", "\n", "log", ".", "Println", "(", "\"", "\"", ")", "\n", "mockServer", ":=", "MockService", "{", "BaseURL", ":", "fmt", ".", "Sprintf", "(", "\"", "\"", ",", "p", ".", "Host", ",", "p", ".", "Server", ".", "Port", ")", ",", "<mask>", ":", "p", ".", "Consumer", ",", "Provider", ":", "p", ".", "Provider", ",", "PactFileWriteMode", ":", "p", ".", "PactFileWriteMode", ",", "}", "\n", "err", ":=", "mockServer", ".", "WritePact", "(", ")", "\n", "if", "err", "!=", "nil", "{", "return", "err", "\n", "}", "\n\n", "return", "nil", "\n", "}" ]
8,530
all-8531
[ "UnmarshalEasyJSON", "satisfies", "easyjson", ".", "Unmarshaler", "." ]
[ "func", "(", "t", "*", "DetachReason", ")", "UnmarshalEasyJSON", "(", "in", "*", "jlexer", ".", "Lexer", ")", "{", "switch", "DetachReason", "(", "in", ".", "String", "(", ")", ")", "{", "case", "DetachReasonTargetClosed", ":", "*", "t", "=", "DetachReasonTargetClosed", "\n", "case", "DetachReasonCanceledByUser", ":", "*", "t", "=", "DetachReasonCanceledByUser", "\n", "case", "DetachReasonReplacedWithDevtools", ":", "*", "t", "=", "DetachReasonReplacedWithDevtools", "\n", "case", "DetachReasonRenderProcessGone", ":", "*", "t", "=", "DetachReasonRenderProcessGone", "\n\n", "default", ":", "<mask>", ".", "AddError", "(", "errors", ".", "New", "(", "\"", "\"", ")", ")", "\n", "}", "\n", "}" ]
8,531
all-8532
[ "VerifyRequest", "returns", "a", "handler", "that", "verifies", "that", "a", "request", "uses", "the", "specified", "method", "to", "connect", "to", "the", "specified", "path", "You", "may", "also", "pass", "in", "an", "optional", "rawQuery", "string", "which", "is", "tested", "against", "the", "request", "s", "req", ".", "URL", ".", "RawQuery", "For", "path", "you", "may", "pass", "in", "a", "string", "in", "which", "case", "strict", "equality", "will", "be", "applied", "Alternatively", "you", "can", "pass", "in", "a", "matcher", "(", "ContainSubstring", "(", "/", "foo", ")", "and", "MatchRegexp", "(", "/", "foo", "/", "[", "a", "-", "f0", "-", "9", "]", "+", ")", "for", "example", ")" ]
[ "func", "VerifyRequest", "(", "method", "string", ",", "path", "interface", "{", "}", ",", "rawQuery", "...", "string", ")", "http", ".", "HandlerFunc", "{", "return", "func", "(", "w", "http", ".", "ResponseWriter", ",", "req", "*", "http", ".", "Request", ")", "{", "Expect", "(", "req", ".", "Method", ")", ".", "Should", "(", "Equal", "(", "method", ")", ",", "\"", "\"", ")", "\n", "switch", "p", ":=", "path", ".", "(", "type", ")", "{", "case", "types", ".", "GomegaMatcher", ":", "Expect", "(", "req", ".", "URL", ".", "Path", ")", ".", "Should", "(", "p", ",", "\"", "\"", ")", "\n", "default", ":", "Expect", "(", "req", ".", "<mask>", ".", "Path", ")", ".", "Should", "(", "Equal", "(", "path", ")", ",", "\"", "\"", ")", "\n", "}", "\n", "if", "len", "(", "rawQuery", ")", ">", "0", "{", "values", ",", "err", ":=", "url", ".", "ParseQuery", "(", "rawQuery", "[", "0", "]", ")", "\n", "Expect", "(", "err", ")", ".", "ShouldNot", "(", "HaveOccurred", "(", ")", ",", "\"", "\"", ")", "\n\n", "Expect", "(", "req", ".", "URL", ".", "Query", "(", ")", ")", ".", "Should", "(", "Equal", "(", "values", ")", ",", "\"", "\"", ")", "\n", "}", "\n", "}", "\n", "}" ]
8,532
all-8533
[ "Querier", "calls", "f", "()", "with", "the", "given", "parameters", "." ]
[ "func", "(", "f", "QueryableFunc", ")", "Querier", "(", "ctx", "context", ".", "<mask>", ",", "mint", ",", "maxt", "int64", ")", "(", "Querier", ",", "error", ")", "{", "return", "f", "(", "ctx", ",", "mint", ",", "maxt", ")", "\n", "}" ]
8,533
all-8534
[ "GetScreen", "is", "a", "wrapper", "around", "gtk_widget_get_screen", "()", "." ]
[ "func", "(", "v", "*", "Widget", ")", "GetScreen", "(", ")", "(", "*", "gdk", ".", "Screen", ",", "error", ")", "{", "c", ":=", "C", ".", "gtk_widget_get_screen", "(", "v", ".", "native", "(", ")", ")", "\n", "if", "c", "==", "nil", "{", "<mask>", "nil", ",", "nilPtrErr", "\n", "}", "\n", "s", ":=", "&", "gdk", ".", "Screen", "{", "glib", ".", "Take", "(", "unsafe", ".", "Pointer", "(", "c", ")", ")", "}", "\n", "return", "s", ",", "nil", "\n", "}" ]
8,534
all-8535
[ "updateCommandFunc", "executes", "the", "update", "command", "." ]
[ "func", "updateCommandFunc", "(", "c", "*", "cli", ".", "Context", ",", "ki", "client", ".", "KeysAPI", ")", "{", "if", "len", "(", "c", ".", "Args", "(", ")", ")", "==", "0", "{", "handleError", "(", "c", ",", "ExitBadArgs", ",", "errors", ".", "New", "(", "\"", "\"", ")", ")", "\n", "}", "\n", "key", ":=", "c", ".", "Args", "(", ")", "[", "0", "]", "\n", "value", ",", "err", ":=", "argOrStdin", "(", "c", ".", "Args", "(", ")", ",", "os", ".", "Stdin", ",", "1", ")", "\n", "if", "err", "!=", "nil", "{", "handleError", "(", "c", ",", "ExitBadArgs", ",", "errors", ".", "New", "(", "\"", "\"", ")", ")", "\n", "}", "\n\n", "ttl", ":=", "c", ".", "Int", "(", "\"", "\"", ")", "\n\n", "ctx", ",", "cancel", ":=", "contextWithTotalTimeout", "(", "c", ")", "\n", "resp", ",", "err", ":=", "ki", ".", "Set", "(", "ctx", ",", "key", ",", "value", ",", "&", "client", ".", "SetOptions", "{", "TTL", ":", "time", ".", "Duration", "(", "ttl", ")", "*", "time", ".", "Second", ",", "PrevExist", ":", "<mask>", ".", "PrevExist", "}", ")", "\n", "cancel", "(", ")", "\n", "if", "err", "!=", "nil", "{", "handleError", "(", "c", ",", "ExitServerError", ",", "err", ")", "\n", "}", "\n\n", "printResponseKey", "(", "resp", ",", "c", ".", "GlobalString", "(", "\"", "\"", ")", ")", "\n", "}" ]
8,535
all-8536
[ "Writes", "HTTP", "response", "content", "data", "." ]
[ "func", "(", "c", "*", "compressedResponseWriter", ")", "Write", "(", "p", "[", "]", "byte", ")", "(", "int", ",", "error", ")", "{", "return", "c", ".", "<mask>", ".", "Write", "(", "p", ")", "\n", "}" ]
8,536
all-8537
[ "MarshalBinary", "interface", "implementation" ]
[ "func", "(", "m", "*", "TaskWrapper", ")", "MarshalBinary", "(", ")", "(", "[", "]", "<mask>", ",", "error", ")", "{", "if", "m", "==", "nil", "{", "return", "nil", ",", "nil", "\n", "}", "\n", "return", "swag", ".", "WriteJSON", "(", "m", ")", "\n", "}" ]
8,537
all-8538
[ "GetTitle", "returns", "the", "Title", "field", "if", "non", "-", "nil", "zero", "value", "otherwise", "." ]
[ "func", "(", "c", "*", "ChangeDefinition", ")", "GetTitle", "(", ")", "<mask>", "{", "if", "c", "==", "nil", "||", "c", ".", "Title", "==", "nil", "{", "return", "\"", "\"", "\n", "}", "\n", "return", "*", "c", ".", "Title", "\n", "}" ]
8,538
all-8539
[ "Helpers" ]
[ "func", "copyRequest", "(", "dstRequest", "*", "http", ".", "Request", ",", "srcRequest", "*", "http", ".", "Request", ",", "buffer", "io", ".", "Reader", ")", "{", "*", "(", "dstRequest", ")", "=", "*", "(", "srcRequest", ")", "\n", "dstRequest", ".", "<mask>", "=", "utils", ".", "CopyURL", "(", "srcRequest", ".", "URL", ")", "\n", "dstRequest", ".", "Header", "=", "make", "(", "http", ".", "Header", ")", "\n", "utils", ".", "CopyHeaders", "(", "dstRequest", ".", "Header", ",", "srcRequest", ".", "Header", ")", "\n", "dstRequest", ".", "ContentLength", "=", "srcRequest", ".", "ContentLength", "\n\n", "dstRequest", ".", "TransferEncoding", "=", "[", "]", "string", "{", "}", "\n", "dstRequest", ".", "Body", "=", "ioutil", ".", "NopCloser", "(", "buffer", ")", "\n", "}" ]
8,539
all-8540
[ "Get", "returns", "singleton", "glg", "instance" ]
[ "func", "Get", "(", ")", "*", "Glg", "{", "<mask>", ".", "Do", "(", "func", "(", ")", "{", "fastime", ".", "SetFormat", "(", "timeFormat", ")", "\n", "glg", "=", "New", "(", ")", "\n", "}", ")", "\n", "return", "glg", "\n", "}" ]
8,540
all-8541
[ "AddHosts", "adds", "a", "list", "of", "hosts", "to", "the", "list", "of", "hosts", "to", "be", "scanned" ]
[ "func", "(", "s", "Scan", ")", "AddHosts", "(", "hosts", "...", "string", ")", "Scan", "{", "s", ".", "configHosts", "=", "<mask>", "(", "s", ".", "configHosts", ",", "hosts", "...", ")", "\n", "return", "s", "\n", "}" ]
8,541
all-8542
[ "GetIcon", "is", "a", "wrapper", "around", "gtk_window_get_icon", "()", "." ]
[ "func", "(", "v", "*", "Window", ")", "GetIcon", "(", ")", "(", "*", "gdk", ".", "Pixbuf", ",", "<mask>", ")", "{", "c", ":=", "C", ".", "gtk_window_get_icon", "(", "v", ".", "native", "(", ")", ")", "\n", "if", "c", "==", "nil", "{", "return", "nil", ",", "nilPtrErr", "\n", "}", "\n\n", "p", ":=", "&", "gdk", ".", "Pixbuf", "{", "glib", ".", "Take", "(", "unsafe", ".", "Pointer", "(", "c", ")", ")", "}", "\n", "return", "p", ",", "nil", "\n", "}" ]
8,542
all-8543
[ "Delete", "deletes", "the", "cache" ]
[ "func", "(", "c", "*", "FileCache", ")", "Delete", "(", "<mask>", "string", ")", "error", "{", "return", "errors", ".", "Wrap", "(", "os", ".", "Remove", "(", "c", ".", "GetCachePath", "(", "key", ")", ")", ",", "\"", "\"", ")", "\n", "}" ]
8,543
all-8544
[ "Errorf", "is", "equivalent", "to", "Logf", "followed", "by", "Fail", "." ]
[ "func", "(", "t", "*", "T", ")", "Errorf", "(", "format", "string", ",", "args", "...", "<mask>", "{", "}", ")", "{", "fmt", ".", "Fprintf", "(", "os", ".", "Stderr", ",", "format", ",", "args", "...", ")", "\n", "t", ".", "Fail", "(", ")", "\n", "}" ]
8,544
all-8545
[ "GetGroup", "gets", "a", "group" ]
[ "func", "(", "c", "*", "Client", ")", "GetGroup", "(", "groupid", "string", ")", "(", "*", "Group", ",", "error", ")", "{", "url", ":=", "umGroupPath", "(", "groupid", ")", "+", "`?depth=`", "+", "c", ".", "client", ".", "<mask>", "+", "`&pretty=`", "+", "strconv", ".", "FormatBool", "(", "c", ".", "client", ".", "pretty", ")", "\n", "ret", ":=", "&", "Group", "{", "}", "\n", "err", ":=", "c", ".", "client", ".", "Get", "(", "url", ",", "ret", ",", "http", ".", "StatusOK", ")", "\n", "return", "ret", ",", "err", "\n", "}" ]
8,545
all-8546
[ "RoundTrip", "mocks", "base", "method" ]
[ "func", "(", "m", "*", "MockRoundTripper", ")", "RoundTrip", "(", "arg0", "*", "http", ".", "Request", ")", "(", "*", "<mask>", ".", "Response", ",", "error", ")", "{", "ret", ":=", "m", ".", "ctrl", ".", "Call", "(", "m", ",", "\"", "\"", ",", "arg0", ")", "\n", "ret0", ",", "_", ":=", "ret", "[", "0", "]", ".", "(", "*", "http", ".", "Response", ")", "\n", "ret1", ",", "_", ":=", "ret", "[", "1", "]", ".", "(", "error", ")", "\n", "return", "ret0", ",", "ret1", "\n", "}" ]
8,546
all-8547
[ "HasLabel", "returns", "a", "boolean", "if", "a", "field", "has", "been", "set", "." ]
[ "func", "(", "w", "*", "WidgetMarker", ")", "HasLabel", "(", ")", "bool", "{", "if", "w", "!=", "nil", "&&", "w", ".", "<mask>", "!=", "nil", "{", "return", "true", "\n", "}", "\n\n", "return", "false", "\n", "}" ]
8,547
all-8548
[ "rawConnDial", "dials", "the", "underlying", "net", ".", "Conn", "+", "manet", ".", "Conns" ]
[ "func", "(", "d", "*", "Dialer", ")", "rawConnDial", "(", "ctx", "context", ".", "Context", ",", "raddr", "ma", ".", "Multiaddr", ",", "remote", "peer", ".", "ID", ")", "(", "transport", ".", "Conn", ",", "error", ")", "{", "if", "strings", ".", "HasPrefix", "(", "raddr", ".", "String", "(", ")", ",", "\"", "\"", ")", "{", "log", ".", "Event", "(", "ctx", ",", "\"", "\"", ",", "lgbl", ".", "Dial", "(", "\"", "\"", ",", "d", ".", "LocalPeer", ",", "<mask>", ",", "nil", ",", "raddr", ")", ")", "\n", "return", "nil", ",", "fmt", ".", "Errorf", "(", "\"", "\"", ",", "raddr", ")", "\n", "}", "\n\n", "sd", ":=", "d", ".", "subDialerForAddr", "(", "raddr", ")", "\n", "if", "sd", "==", "nil", "{", "return", "nil", ",", "fmt", ".", "Errorf", "(", "\"", "\"", ",", "raddr", ")", "\n", "}", "\n\n", "return", "sd", ".", "DialContext", "(", "ctx", ",", "raddr", ")", "\n", "}" ]
8,548
all-8549
[ "expandHostNicFailureCriteria", "reads", "certain", "ResourceData", "keys", "and", "returns", "a", "HostNicFailureCriteria", "." ]
[ "func", "expandHostNicFailureCriteria", "(", "d", "*", "schema", ".", "ResourceData", ")", "*", "<mask>", ".", "HostNicFailureCriteria", "{", "obj", ":=", "&", "types", ".", "HostNicFailureCriteria", "{", "}", "\n\n", "if", "v", ",", "ok", ":=", "d", ".", "GetOkExists", "(", "\"", "\"", ")", ";", "ok", "{", "obj", ".", "CheckBeacon", "=", "structure", ".", "BoolPtr", "(", "v", ".", "(", "bool", ")", ")", "\n", "}", "\n\n", "// These fields are deprecated and are set only to make things work. They are", "// not exposed to Terraform.", "obj", ".", "CheckSpeed", "=", "\"", "\"", "\n", "obj", ".", "Speed", "=", "10", "\n", "obj", ".", "CheckDuplex", "=", "structure", ".", "BoolPtr", "(", "false", ")", "\n", "obj", ".", "FullDuplex", "=", "structure", ".", "BoolPtr", "(", "false", ")", "\n", "obj", ".", "CheckErrorPercent", "=", "structure", ".", "BoolPtr", "(", "false", ")", "\n", "obj", ".", "Percentage", "=", "0", "\n\n", "return", "obj", "\n", "}" ]
8,549
all-8550
[ "JSONContext", "provides", "the", "same", "functionality", "as", "JSON", "with", "Context", "instance", "passing", "to", "http", ".", "Request", "." ]
[ "func", "(", "c", "Client", ")", "JSONContext", "(", "ctx", "context", ".", "Context", ",", "method", ",", "path", "string", ",", "query", "<mask>", ".", "Values", ",", "body", "io", ".", "Reader", ",", "response", "interface", "{", "}", ")", "(", "err", "error", ")", "{", "resp", ",", "err", ":=", "c", ".", "RequestContext", "(", "ctx", ",", "method", ",", "path", ",", "query", ",", "body", ",", "[", "]", "string", "{", "\"", "\"", "}", ")", "\n", "if", "err", "!=", "nil", "{", "return", "\n", "}", "\n", "defer", "func", "(", ")", "{", "io", ".", "Copy", "(", "ioutil", ".", "Discard", ",", "resp", ".", "Body", ")", "\n", "resp", ".", "Body", ".", "Close", "(", ")", "\n", "}", "(", ")", "\n\n", "if", "response", "!=", "nil", "{", "if", "resp", ".", "ContentLength", "==", "0", "{", "return", "errors", ".", "New", "(", "\"", "\"", ")", "\n", "}", "\n", "contentType", ":=", "resp", ".", "Header", ".", "Get", "(", "\"", "\"", ")", "\n", "if", "!", "strings", ".", "Contains", "(", "contentType", ",", "\"", "\"", ")", "{", "return", "fmt", ".", "Errorf", "(", "\"", "\"", ",", "contentType", ")", "\n", "}", "\n", "var", "body", "[", "]", "byte", "\n", "body", ",", "err", "=", "ioutil", ".", "ReadAll", "(", "resp", ".", "Body", ")", "\n", "if", "err", "!=", "nil", "{", "return", "\n", "}", "\n", "if", "err", "=", "JSONUnmarshal", "(", "body", ",", "&", "response", ")", ";", "err", "!=", "nil", "{", "return", "\n", "}", "\n", "}", "\n\n", "return", "\n", "}" ]
8,550
all-8551
[ "Your", "own", "route", "middle", "wrapper" ]
[ "func", "RouteMiddleware", "(", "next", "r2router", ".", "HandlerFunc", ")", "r2router", ".", "HandlerFunc", "{", "return", "func", "(", "w", "<mask>", ".", "ResponseWriter", ",", "r", "*", "http", ".", "Request", ",", "p", "r2router", ".", "Params", ")", "{", "p", ".", "AppSet", "(", "\"", "\"", ",", "\"", "\"", ")", "\n", "next", "(", "w", ",", "r", ",", "p", ")", "\n", "}", "\n", "}" ]
8,551
all-8552
[ "New", "creates", "a", "LocalGit", "and", "a", "git", ".", "Client", "pointing", "at", "it", "." ]
[ "func", "New", "(", ")", "(", "*", "LocalGit", ",", "*", "git", ".", "Client", ",", "error", ")", "{", "g", ",", "err", ":=", "exec", ".", "LookPath", "(", "\"", "\"", ")", "\n", "if", "err", "!=", "nil", "{", "return", "nil", ",", "nil", ",", "err", "\n", "}", "\n", "t", ",", "err", ":=", "ioutil", ".", "TempDir", "(", "\"", "\"", ",", "\"", "\"", ")", "\n", "if", "err", "!=", "nil", "{", "return", "nil", ",", "nil", ",", "err", "\n", "}", "\n", "c", ",", "err", ":=", "git", ".", "NewClient", "(", ")", "\n", "if", "err", "!=", "nil", "{", "<mask>", ".", "RemoveAll", "(", "t", ")", "\n", "return", "nil", ",", "nil", ",", "err", "\n", "}", "\n\n", "getSecret", ":=", "func", "(", ")", "[", "]", "byte", "{", "return", "[", "]", "byte", "(", "\"", "\"", ")", "\n", "}", "\n\n", "c", ".", "SetCredentials", "(", "\"", "\"", ",", "getSecret", ")", "\n\n", "c", ".", "SetRemote", "(", "t", ")", "\n", "return", "&", "LocalGit", "{", "Dir", ":", "t", ",", "Git", ":", "g", ",", "}", ",", "c", ",", "nil", "\n", "}" ]
8,552
all-8553
[ "Respond", "without", "doing", "anything", ".", "This", "endpoint", "is", "used", "to", "check", "that", "the", "service", "is", "up", ".", "See", "#ping" ]
[ "func", "(", "github", "*", "Github", ")", "Ping", "(", ")", "error", "{", "<mask>", ":=", "tcclient", ".", "Client", "(", "*", "github", ")", "\n", "_", ",", "_", ",", "err", ":=", "(", "&", "cd", ")", ".", "APICall", "(", "nil", ",", "\"", "\"", ",", "\"", "\"", ",", "nil", ",", "nil", ")", "\n", "return", "err", "\n", "}" ]
8,553
all-8554
[ "UpdateUser", "updates", "the", "User", "object", "stored", "in", "the", "session", ".", "This", "is", "useful", "incase", "a", "change", "is", "made", "to", "the", "user", "model", "that", "needs", "to", "persist", "across", "requests", "." ]
[ "func", "UpdateUser", "(", "s", "sessions", ".", "Session", ",", "<mask>", "User", ")", "error", "{", "s", ".", "Set", "(", "SessionKey", ",", "user", ".", "UniqueId", "(", ")", ")", "\n", "return", "nil", "\n", "}" ]
8,554
all-8555
[ "ContainerProfiles", "returns", "a", "list", "of", "profiles", "for", "a", "given", "container", "ID", "." ]
[ "func", "(", "c", "*", "Cluster", ")", "ContainerProfiles", "(", "id", "int", ")", "(", "[", "]", "string", ",", "error", ")", "{", "var", "name", "string", "\n", "var", "profiles", "[", "]", "string", "\n\n", "query", ":=", "`\n SELECT name FROM containers_profiles\n JOIN profiles ON containers_profiles.profile_id=profiles.id\n\t\tWHERE container_id=?\n ORDER BY containers_profiles.apply_order`", "\n", "inargs", ":=", "[", "]", "interface", "{", "}", "{", "id", "}", "\n", "outfmt", ":=", "[", "]", "interface", "{", "}", "{", "name", "}", "\n\n", "results", ",", "err", ":=", "queryScan", "(", "c", ".", "db", ",", "query", ",", "inargs", ",", "outfmt", ")", "\n", "if", "err", "!=", "nil", "{", "return", "nil", ",", "err", "\n", "}", "\n\n", "for", "_", ",", "r", ":=", "range", "results", "{", "name", "=", "r", "[", "0", "]", ".", "(", "string", ")", "\n\n", "profiles", "=", "append", "(", "profiles", ",", "<mask>", ")", "\n", "}", "\n\n", "return", "profiles", ",", "nil", "\n", "}" ]
8,555
all-8556
[ "CheckFlags", "looks", "for", "organization", "and", "project", "flags", "to", "configure", "the", "client" ]
[ "func", "(", "<mask>", "*", "Client", ")", "CheckFlags", "(", ")", "error", "{", "if", "client", ".", "Org", "==", "\"", "\"", "{", "return", "fmt", ".", "Errorf", "(", "\"", "\"", ")", "\n", "}", "\n", "client", ".", "Org", "=", "strings", ".", "ToLower", "(", "client", ".", "Org", ")", "\n\n", "if", "client", ".", "Project", "==", "\"", "\"", "{", "return", "fmt", ".", "Errorf", "(", "\"", "\"", ")", "\n", "}", "\n", "client", ".", "Project", "=", "strings", ".", "ToLower", "(", "client", ".", "Project", ")", "\n\n", "return", "nil", "\n", "}" ]
8,556
all-8557
[ "establish", "data", "storage", "format", "and", "dimensions", "of", "a", "renderbuffer", "object", "s", "image" ]
[ "func", "RenderbufferStorage", "(", "<mask>", "uint32", ",", "internalformat", "uint32", ",", "width", "int32", ",", "height", "int32", ")", "{", "syscall", ".", "Syscall6", "(", "gpRenderbufferStorage", ",", "4", ",", "uintptr", "(", "target", ")", ",", "uintptr", "(", "internalformat", ")", ",", "uintptr", "(", "width", ")", ",", "uintptr", "(", "height", ")", ",", "0", ",", "0", ")", "\n", "}" ]
8,557
all-8558
[ "Disconnect", "a", "Mongo", "client" ]
[ "func", "(", "m", "*", "Mongo", ")", "Disconnect", "(", ")", "error", "{", "err", ":=", "m", ".", "Client", ".", "Disconnect", "(", "m", ".", "<mask>", ")", "\n", "if", "err", "!=", "nil", "{", "log", ".", "Printf", "(", "\"", "\"", ")", "\n", "return", "err", "\n", "}", "\n", "return", "nil", "\n", "}" ]
8,558
all-8559
[ "parseInt", "parses", "a", "string", "into", "a", "base", "10", "int" ]
[ "func", "parseInt", "(", "s", "string", ")", "(", "int64", ",", "error", ")", "{", "if", "s", "==", "\"", "\"", "{", "return", "0", ",", "nil", "\n", "}", "\n\n", "<mask>", ",", "err", ":=", "strconv", ".", "ParseInt", "(", "s", ",", "10", ",", "64", ")", "\n", "if", "err", "!=", "nil", "{", "return", "0", ",", "errors", ".", "Wrap", "(", "err", ",", "\"", "\"", ")", "\n", "}", "\n", "return", "result", ",", "nil", "\n", "}" ]
8,559
all-8560
[ "NormalizedMIMEType", "returns", "the", "effective", "MIME", "type", "of", "a", "manifest", "MIME", "type", "returned", "by", "a", "server", "centralizing", "various", "workarounds", "." ]
[ "func", "NormalizedMIMEType", "(", "input", "string", ")", "string", "{", "switch", "input", "{", "// \"application/json\" is a valid v2s1 value per https://github.com/docker/distribution/blob/master/docs/spec/manifest-v2-1.md .", "// This works for now, when nothing else seems to return \"application/json\"; if that were not true, the mapping/detection might", "// need to happen within the ImageSource.", "case", "\"", "\"", ":", "return", "DockerV2Schema1SignedMediaType", "\n", "case", "DockerV2Schema1MediaType", ",", "DockerV2Schema1SignedMediaType", ",", "imgspecv1", ".", "MediaTypeImageManifest", ",", "DockerV2Schema2MediaType", ",", "DockerV2ListMediaType", ":", "return", "input", "\n", "<mask>", ":", "// If it's not a recognized manifest media type, or we have failed determining the type, we'll try one last time", "// to deserialize using v2s1 as per https://github.com/docker/distribution/blob/master/manifests.go#L108", "// and https://github.com/docker/distribution/blob/master/manifest/schema1/manifest.go#L50", "//", "// Crane registries can also return \"text/plain\", or pretty much anything else depending on a file extension “recognized” in the tag.", "// This makes no real sense, but it happens", "// because requests for manifests are", "// redirected to a content distribution", "// network which is configured that way. See https://bugzilla.redhat.com/show_bug.cgi?id=1389442", "return", "DockerV2Schema1SignedMediaType", "\n", "}", "\n", "}" ]
8,560
all-8561
[ "InstallJaegerTracerFromEnv", "installs", "a", "Jaeger", "client", "as", "then", "opentracing", "global", "tracer", "relying", "on", "environment", "variables", "to", "configure", "the", "client", ".", "It", "returns", "the", "address", "used", "to", "initialize", "the", "global", "tracer", "if", "any", "initialization", "occurred" ]
[ "func", "InstallJaegerTracerFromEnv", "(", ")", "{", "jaegerOnce", ".", "Do", "(", "func", "(", ")", "{", "jaegerEndpoint", ",", "onUserMachine", ":=", "os", ".", "LookupEnv", "(", "jaegerEndpointEnvVar", ")", "\n", "if", "!", "onUserMachine", "{", "if", "host", ",", "ok", ":=", "<mask>", ".", "LookupEnv", "(", "\"", "\"", ")", ";", "ok", "{", "port", ":=", "os", ".", "Getenv", "(", "\"", "\"", ")", "\n", "jaegerEndpoint", "=", "fmt", ".", "Sprintf", "(", "\"", "\"", ",", "host", ",", "port", ")", "\n", "}", "\n", "}", "\n", "if", "jaegerEndpoint", "==", "\"", "\"", "{", "return", "// break early -- not using Jaeger", "\n", "}", "\n\n", "// canonicalize jaegerEndpoint as http://<hostport>/api/traces", "jaegerEndpoint", "=", "strings", ".", "TrimPrefix", "(", "jaegerEndpoint", ",", "\"", "\"", ")", "\n", "jaegerEndpoint", "=", "strings", ".", "TrimSuffix", "(", "jaegerEndpoint", ",", "\"", "\"", ")", "\n", "jaegerEndpoint", "=", "fmt", ".", "Sprintf", "(", "\"", "\"", ",", "jaegerEndpoint", ")", "\n", "cfg", ":=", "jaegercfg", ".", "Configuration", "{", "// Configure Jaeger to sample every call, but use the SpanInclusionFunc", "// addTraceIfTracingEnabled (defined below) to skip sampling every RPC", "// unless the PACH_ENABLE_TRACING environment variable is set", "Sampler", ":", "&", "jaegercfg", ".", "SamplerConfig", "{", "Type", ":", "\"", "\"", ",", "Param", ":", "1", ",", "}", ",", "Reporter", ":", "&", "jaegercfg", ".", "ReporterConfig", "{", "LogSpans", ":", "true", ",", "BufferFlushInterval", ":", "1", "*", "time", ".", "Second", ",", "CollectorEndpoint", ":", "jaegerEndpoint", ",", "}", ",", "}", "\n\n", "// configure jaeger logger", "logger", ":=", "jaeger", ".", "Logger", "(", "jaeger", ".", "NullLogger", ")", "\n", "if", "!", "onUserMachine", "{", "logger", "=", "jaeger", ".", "StdLogger", "\n", "}", "\n\n", "// Hack: ignore second argument (io.Closer) because the Jaeger", "// implementation of opentracing.Tracer also implements io.Closer (i.e. the", "// first and second return values from cfg.New(), here, are two interfaces", "// that wrap the same underlying type). Instead of storing the second return", "// value here, just cast the tracer to io.Closer in CloseAndReportTraces()", "// (below) and call 'Close()' on it there.", "tracer", ",", "_", ",", "err", ":=", "cfg", ".", "New", "(", "JaegerServiceName", ",", "jaegercfg", ".", "Logger", "(", "logger", ")", ")", "\n", "if", "err", "!=", "nil", "{", "panic", "(", "fmt", ".", "Sprintf", "(", "\"", "\"", ",", "err", ")", ")", "\n", "}", "\n", "opentracing", ".", "SetGlobalTracer", "(", "tracer", ")", "\n", "}", ")", "\n", "}" ]
8,561
all-8562
[ "Parameters", ":", "-", "Hr" ]
[ "func", "(", "p", "*", "MetaClient", ")", "Health", "(", "hr", "*", "HealthRequest", ")", "(", "r", "*", "HealthStatus", ",", "err", "<mask>", ")", "{", "if", "err", "=", "p", ".", "sendHealth", "(", "hr", ")", ";", "err", "!=", "nil", "{", "return", "\n", "}", "\n", "return", "p", ".", "recvHealth", "(", ")", "\n", "}" ]
8,562
all-8563
[ "GetAccessRole", "returns", "the", "AccessRole", "field", "if", "non", "-", "nil", "zero", "value", "otherwise", "." ]
[ "func", "(", "u", "*", "<mask>", ")", "GetAccessRole", "(", ")", "string", "{", "if", "u", "==", "nil", "||", "u", ".", "AccessRole", "==", "nil", "{", "return", "\"", "\"", "\n", "}", "\n", "return", "*", "u", ".", "AccessRole", "\n", "}" ]
8,563
all-8564
[ "Using", "the", "classic", "API", "posts", "a", "value", "to", "a", "stat", "using", "DefaultReporter", "." ]
[ "func", "PostValue", "(", "statKey", ",", "userKey", "string", ",", "value", "float64", ")", "error", "{", "return", "DefaultReporter", ".", "PostValue", "(", "statKey", ",", "userKey", ",", "<mask>", ")", "\n", "}" ]
8,564
all-8565
[ "LegacyContainersList", "returns", "the", "names", "of", "all", "the", "containers", "of", "the", "given", "type", ".", "NOTE", ":", "this", "is", "a", "pre", "-", "projects", "legacy", "API", "that", "is", "used", "only", "by", "patches", ".", "Don", "t", "use", "it", "for", "new", "code", "." ]
[ "func", "(", "c", "*", "Cluster", ")", "LegacyContainersList", "(", "cType", "ContainerType", ")", "(", "[", "]", "string", ",", "error", ")", "{", "q", ":=", "fmt", ".", "Sprintf", "(", "\"", "\"", ")", "\n", "inargs", ":=", "[", "]", "interface", "{", "}", "{", "cType", "}", "\n", "<mask>", "container", "string", "\n", "outfmt", ":=", "[", "]", "interface", "{", "}", "{", "container", "}", "\n", "result", ",", "err", ":=", "queryScan", "(", "c", ".", "db", ",", "q", ",", "inargs", ",", "outfmt", ")", "\n", "if", "err", "!=", "nil", "{", "return", "nil", ",", "err", "\n", "}", "\n\n", "var", "ret", "[", "]", "string", "\n", "for", "_", ",", "container", ":=", "range", "result", "{", "ret", "=", "append", "(", "ret", ",", "container", "[", "0", "]", ".", "(", "string", ")", ")", "\n", "}", "\n\n", "return", "ret", ",", "nil", "\n", "}" ]
8,565
all-8566
[ "returns", "a", "list", "of", "countries", "where", "Twilio", "phone", "numbers", "are", "supported" ]
[ "func", "(", "cpnps", "*", "CountryPhoneNumberPriceService", ")", "GetPage", "(", "ctx", "context", ".", "Context", ",", "<mask>", "url", ".", "Values", ")", "(", "*", "CountriesPricePage", ",", "error", ")", "{", "return", "cpnps", ".", "GetPageIterator", "(", "data", ")", ".", "Next", "(", "ctx", ")", "\n", "}" ]
8,566
all-8567
[ "specify", "a", "one", "-", "dimensional", "texture", "subimage", "in", "a", "compressed", "format" ]
[ "func", "CompressedTextureSubImage1D", "(", "texture", "uint32", ",", "level", "int32", ",", "xoffset", "int32", ",", "width", "int32", ",", "format", "uint32", ",", "imageSize", "int32", ",", "data", "unsafe", ".", "Pointer", ")", "{", "syscall", ".", "Syscall9", "(", "gpCompressedTextureSubImage1D", ",", "7", ",", "uintptr", "(", "texture", ")", ",", "uintptr", "(", "level", ")", ",", "uintptr", "(", "xoffset", ")", ",", "uintptr", "(", "width", ")", ",", "uintptr", "(", "format", ")", ",", "uintptr", "(", "imageSize", ")", ",", "uintptr", "(", "<mask>", ")", ",", "0", ",", "0", ")", "\n", "}" ]
8,567
all-8568
[ "Do", "executes", "Browser", ".", "crashGpuProcess", "against", "the", "provided", "context", "." ]
[ "func", "(", "p", "*", "CrashGpuProcessParams", ")", "Do", "(", "ctx", "<mask>", ".", "Context", ")", "(", "err", "error", ")", "{", "return", "cdp", ".", "Execute", "(", "ctx", ",", "CommandCrashGpuProcess", ",", "nil", ",", "nil", ")", "\n", "}" ]
8,568
all-8569
[ "AnalyzeDefinition", "analyzes", "a", "definition", "which", "is", "an", "object", ".", "Definitions", "are", "referenced", "by", "both", "inputs", "to", "requests", "(", "parameters", ")", "and", "outputs", "from", "requests", "(", "return", "types", ")", ".", "EvalCtx", "will", "store", "which", "we", "re", "analyzing", "currently", "." ]
[ "func", "(", "a", "*", "APIAnalyzer", ")", "AnalyzeDefinition", "(", "ec", "EvalCtx", ",", "def", "*", "Definition", ",", "refID", "string", ")", "gen", ".", "DataType", "{", "switch", "def", ".", "Type", "{", "case", "\"", "\"", ":", "elemT", ":=", "a", ".", "typeForRef", "(", "ec", ",", "def", ".", "Items", ")", "\n", "apElem", ":=", "&", "gen", ".", "ActionParam", "{", "Location", ":", "gen", ".", "PayloadParam", ",", "Type", ":", "elemT", ",", "}", "\n", "return", "&", "gen", ".", "ArrayDataType", "{", "ElemType", ":", "apElem", ",", "}", "\n", "default", ":", "name", ":=", "a", ".", "guessType", "(", "ec", ",", "def", ",", "refID", ")", "\n", "if", "name", "==", "\"", "\"", "||", "name", "==", "\"", "\"", "||", "name", "==", "\"", "\"", "{", "return", "basicType", "(", "\"", "\"", ")", "\n", "}", "\n", "// else: object is assumed", "isRequired", ":=", "map", "[", "string", "]", "bool", "{", "}", "\n", "for", "_", ",", "r", ":=", "range", "def", ".", "Required", "{", "isRequired", "[", "r", "]", "=", "true", "\n", "}", "\n\n", "obj", ":=", "&", "gen", ".", "ObjectDataType", "{", "TypeName", ":", "name", "}", "\n", "<mask>", ":=", "[", "]", "string", "{", "}", "\n", "for", "propName", ":=", "range", "def", ".", "Properties", "{", "keys", "=", "append", "(", "keys", ",", "propName", ")", "\n", "}", "\n", "sort", ".", "Strings", "(", "keys", ")", "\n", "for", "_", ",", "propName", ":=", "range", "keys", "{", "prop", ":=", "def", ".", "Properties", "[", "propName", "]", "\n", "attr", ":=", "a", ".", "AnalyzeProperty", "(", "ec", ".", "WithTrail", "(", "name", ")", ",", "propName", ",", "isRequired", "[", "propName", "]", ",", "prop", ")", "\n", "obj", ".", "Fields", "=", "append", "(", "obj", ".", "Fields", ",", "attr", ")", "\n", "}", "\n", "return", "obj", "\n", "}", "\n", "}" ]
8,569
all-8570
[ "DeleteMetricClusterByCID", "deletes", "metric", "cluster", "with", "passed", "cid", "." ]
[ "func", "(", "a", "*", "API", ")", "DeleteMetricClusterByCID", "(", "cid", "CIDType", ")", "(", "bool", ",", "error", ")", "{", "if", "cid", "==", "nil", "||", "*", "cid", "==", "\"", "\"", "{", "return", "false", ",", "fmt", ".", "Errorf", "(", "\"", "\"", ")", "\n", "}", "\n\n", "clusterCID", ":=", "string", "(", "*", "cid", ")", "\n\n", "matched", ",", "err", ":=", "regexp", ".", "MatchString", "(", "config", ".", "MetricClusterCIDRegex", ",", "clusterCID", ")", "\n", "if", "err", "!=", "nil", "{", "return", "false", ",", "err", "\n", "}", "\n", "if", "!", "matched", "{", "return", "false", ",", "fmt", ".", "Errorf", "(", "\"", "\"", ",", "clusterCID", ")", "\n", "}", "\n\n", "_", ",", "err", "=", "a", ".", "Delete", "(", "clusterCID", ")", "\n", "if", "err", "!=", "nil", "{", "return", "false", ",", "err", "\n", "}", "\n\n", "return", "<mask>", ",", "nil", "\n", "}" ]
8,570
all-8571
[ "CreateCommentReaction", "responds", "emotionally", "to", "comment", "id", "in", "org", "/", "repo", ".", "See", "https", ":", "//", "developer", ".", "github", ".", "com", "/", "v3", "/", "reactions", "/", "#create", "-", "reaction", "-", "for", "-", "an", "-", "issue", "-", "comment" ]
[ "func", "(", "c", "*", "Client", ")", "CreateCommentReaction", "(", "org", ",", "repo", "string", ",", "id", "int", ",", "reaction", "string", ")", "error", "{", "c", ".", "log", "(", "\"", "\"", ",", "org", ",", "repo", ",", "id", ",", "reaction", ")", "\n", "r", ":=", "Reaction", "{", "Content", ":", "reaction", "}", "\n", "_", ",", "err", ":=", "c", ".", "<mask>", "(", "&", "request", "{", "method", ":", "http", ".", "MethodPost", ",", "path", ":", "fmt", ".", "Sprintf", "(", "\"", "\"", ",", "org", ",", "repo", ",", "id", ")", ",", "accept", ":", "\"", "\"", ",", "exitCodes", ":", "[", "]", "int", "{", "201", "}", ",", "requestBody", ":", "&", "r", ",", "}", ",", "nil", ")", "\n", "return", "err", "\n", "}" ]
8,571
all-8572
[ "GetString", "reads", "a", "ResourceData", "and", "returns", "a", "*", "string", ".", "This", "differs", "from", "GetStringPtr", "in", "that", "a", "nil", "value", "is", "never", "returned", "." ]
[ "func", "GetString", "(", "d", "*", "schema", ".", "ResourceData", ",", "<mask>", "string", ")", "*", "string", "{", "return", "StringPtr", "(", "d", ".", "Get", "(", "key", ")", ".", "(", "string", ")", ")", "\n", "}" ]
8,572
all-8573
[ "PSCBalanceOf", "calls", "balanceOf", "method", "of", "Privatix", "service", "contract", "." ]
[ "func", "(", "b", "*", "backendInstance", ")", "PSCBalanceOf", "(", "opts", "*", "bind", ".", "CallOpts", ",", "owner", "common", ".", "Address", ")", "(", "uint64", ",", "error", ")", "{", "ctx2", ",", "cancel", ":=", "b", ".", "addTimeout", "(", "opts", ".", "Context", ")", "\n", "defer", "cancel", "(", ")", "\n\n", "opts", ".", "Context", "=", "ctx2", "\n\n", "val", ",", "err", ":=", "b", ".", "psc", ".", "BalanceOf", "(", "opts", ",", "<mask>", ")", "\n", "if", "err", "!=", "nil", "{", "err", "=", "fmt", ".", "Errorf", "(", "\"", "\"", ",", "err", ")", "\n", "}", "\n", "return", "val", ",", "err", "\n", "}" ]
8,573
all-8574
[ "incrementNumPendingJobs", "increments", "the", "amount", "of", "pending", "ProwJobs", "for", "the", "given", "job", "identifier" ]
[ "func", "(", "c", "*", "Controller", ")", "incrementNumPendingJobs", "(", "job", "string", ")", "{", "c", ".", "lock", ".", "Lock", "(", ")", "\n", "defer", "c", ".", "<mask>", ".", "Unlock", "(", ")", "\n", "c", ".", "pendingJobs", "[", "job", "]", "++", "\n", "}" ]
8,574
all-8575
[ "StartInitialization", "loads", "a", "container", "by", "opening", "the", "pipe", "fd", "from", "the", "parent", "to", "read", "the", "configuration", "and", "state", "This", "is", "a", "low", "level", "implementation", "detail", "of", "the", "reexec", "and", "should", "not", "be", "consumed", "externally" ]
[ "func", "(", "l", "*", "LinuxFactory", ")", "StartInitialization", "(", ")", "(", "err", "error", ")", "{", "pipefd", ",", "err", ":=", "strconv", ".", "Atoi", "(", "os", ".", "Getenv", "(", "\"", "\"", ")", ")", "\n", "if", "err", "!=", "nil", "{", "return", "err", "\n", "}", "\n", "var", "(", "pipe", "=", "os", ".", "NewFile", "(", "uintptr", "(", "pipefd", ")", ",", "\"", "\"", ")", "\n", "it", "=", "initType", "(", "os", ".", "Getenv", "(", "\"", "\"", ")", ")", "\n", ")", "\n", "// clear the current process's environment to clean any libcontainer", "// specific env vars.", "os", ".", "Clearenv", "(", ")", "\n", "defer", "func", "(", ")", "{", "// if we have an error during the initialization of the container's init then send it back to the", "// parent process in the form of an initError.", "if", "err", "!=", "nil", "{", "// ensure that any data sent from the parent is consumed so it doesn't", "// receive ECONNRESET when the child writes to the pipe.", "ioutil", ".", "ReadAll", "(", "pipe", ")", "\n", "if", "err", ":=", "json", ".", "NewEncoder", "(", "pipe", ")", ".", "Encode", "(", "newSystemError", "(", "err", ")", ")", ";", "err", "!=", "nil", "{", "panic", "(", "err", ")", "\n", "}", "\n", "}", "\n", "// ensure that this pipe is always closed", "pipe", ".", "Close", "(", ")", "\n", "}", "(", ")", "\n", "i", ",", "err", ":=", "newContainerInit", "(", "<mask>", ",", "pipe", ")", "\n", "if", "err", "!=", "nil", "{", "return", "err", "\n", "}", "\n", "return", "i", ".", "Init", "(", ")", "\n", "}" ]
8,575
all-8576
[ "DeepCopyObject", "implements", "the", "runtime", ".", "Object", "interface" ]
[ "func", "(", "in", "*", "ResourcesConfigCollection", ")", "DeepCopyObject", "(", ")", "runtime", ".", "<mask>", "{", "if", "c", ":=", "in", ".", "deepCopy", "(", ")", ";", "c", "!=", "nil", "{", "return", "c", "\n", "}", "\n", "return", "nil", "\n", "}" ]
8,576
all-8577
[ "/", "*", "Error", "uses", "msg", "as", "a", "format", "string", "with", "subsequent", "parameters", "as", "values", "and", "logs", "the", "resulting", "message", "to", "all", "added", "loggers", "at", "LogLevel", ".", "LevelError" ]
[ "func", "(", "la", "*", "LogAdapter", ")", "Error", "(", "msg", "string", ")", "error", "{", "return", "la", ".", "<mask>", "(", "LevelError", ",", "nil", ",", "msg", ")", "\n", "}" ]
8,577
all-8578
[ "ParseReference", "converts", "a", "string", "which", "should", "not", "start", "with", "the", "ImageTransport", ".", "Name", "prefix", "into", "an", "OpenShift", "ImageReference", "." ]
[ "func", "ParseReference", "(", "ref", "string", ")", "(", "types", ".", "ImageReference", ",", "error", ")", "{", "r", ",", "err", ":=", "reference", ".", "ParseNormalizedNamed", "(", "ref", ")", "\n", "if", "err", "!=", "nil", "{", "return", "nil", ",", "errors", ".", "Wrapf", "(", "err", ",", "\"", "\"", ",", "ref", ")", "\n", "}", "\n", "tagged", ",", "ok", ":=", "r", ".", "(", "reference", ".", "NamedTagged", ")", "\n", "if", "!", "<mask>", "{", "return", "nil", ",", "errors", ".", "Errorf", "(", "\"", "\"", ",", "ref", ")", "\n", "}", "\n", "return", "NewReference", "(", "tagged", ")", "\n", "}" ]
8,578
all-8579
[ "Get", "sends", "a", "GET", "request", "and", "marshals", "response", "data", "into", "holder" ]
[ "func", "(", "c", "<mask>", ")", "Get", "(", "path", "string", ",", "params", "interface", "{", "}", ",", "holder", "interface", "{", "}", ")", "error", "{", "return", "c", ".", "rpc", ".", "Request", "(", "\"", "\"", ",", "path", ",", "params", ",", "&", "holder", ")", "\n", "}" ]
8,579
all-8580
[ "UnmarshalJSON", "supports", "json", ".", "Unmarshaler", "interface" ]
[ "func", "(", "v", "*", "SignedCertificateTimestamp", ")", "UnmarshalJSON", "(", "data", "[", "]", "byte", ")", "error", "{", "r", ":=", "jlexer", ".", "Lexer", "{", "Data", ":", "<mask>", "}", "\n", "easyjsonC5a4559bDecodeGithubComChromedpCdprotoNetwork9", "(", "&", "r", ",", "v", ")", "\n", "return", "r", ".", "Error", "(", ")", "\n", "}" ]
8,580
all-8581
[ "Commits", "returns", "a", "collection", "of", "commits" ]
[ "func", "Commits", "(", "etcdClient", "*", "etcd", ".", "Client", ",", "etcdPrefix", "string", ",", "repo", "string", ")", "col", ".", "Collection", "{", "return", "col", ".", "NewCollection", "(", "etcdClient", ",", "path", ".", "Join", "(", "etcdPrefix", ",", "commitsPrefix", ",", "repo", ")", ",", "[", "]", "*", "col", ".", "<mask>", "{", "ProvenanceIndex", "}", ",", "&", "pfs", ".", "CommitInfo", "{", "}", ",", "nil", ",", "nil", ",", ")", "\n", "}" ]
8,581
all-8582
[ "Removes", "an", "element", "from", "the", "middle", "of", "a", "sequence", "." ]
[ "func", "(", "seq", "*", "Seq", ")", "RemoveAt", "(", "index", "int", ")", "{", "C", ".", "cvSeqRemove", "(", "(", "*", "C", ".", "struct_CvSeq", ")", "(", "seq", ")", ",", "C", ".", "int", "(", "<mask>", ")", ")", "\n", "}" ]
8,582
all-8583
[ "bind", "a", "range", "within", "a", "buffer", "object", "to", "a", "transform", "feedback", "buffer", "object" ]
[ "func", "TransformFeedbackBufferRange", "(", "xfb", "uint32", ",", "index", "uint32", ",", "<mask>", "uint32", ",", "offset", "int", ",", "size", "int", ")", "{", "C", ".", "glowTransformFeedbackBufferRange", "(", "gpTransformFeedbackBufferRange", ",", "(", "C", ".", "GLuint", ")", "(", "xfb", ")", ",", "(", "C", ".", "GLuint", ")", "(", "index", ")", ",", "(", "C", ".", "GLuint", ")", "(", "buffer", ")", ",", "(", "C", ".", "GLintptr", ")", "(", "offset", ")", ",", "(", "C", ".", "GLsizeiptr", ")", "(", "size", ")", ")", "\n", "}" ]
8,583
all-8584
[ "GetFinishings", "()", "is", "a", "wrapper", "around", "gtk_print_settings_get_finishings", "()", "." ]
[ "func", "(", "<mask>", "*", "PrintSettings", ")", "GetFinishings", "(", ")", "string", "{", "c", ":=", "C", ".", "gtk_print_settings_get_finishings", "(", "ps", ".", "native", "(", ")", ")", "\n", "return", "C", ".", "GoString", "(", "(", "*", "C", ".", "char", ")", "(", "c", ")", ")", "\n", "}" ]
8,584
all-8585
[ "ContainerByID", "mocks", "base", "method" ]
[ "func", "(", "m", "*", "MockTaskEngineState", ")", "ContainerByID", "(", "arg0", "string", ")", "(", "*", "<mask>", ".", "DockerContainer", ",", "bool", ")", "{", "ret", ":=", "m", ".", "ctrl", ".", "Call", "(", "m", ",", "\"", "\"", ",", "arg0", ")", "\n", "ret0", ",", "_", ":=", "ret", "[", "0", "]", ".", "(", "*", "container", ".", "DockerContainer", ")", "\n", "ret1", ",", "_", ":=", "ret", "[", "1", "]", ".", "(", "bool", ")", "\n", "return", "ret0", ",", "ret1", "\n", "}" ]
8,585
all-8586
[ "Make", "sure", "the", "local", "Write", "is", "called", "." ]
[ "func", "(", "w", "*", "recorderResponseWriter", ")", "WriteJson", "(", "v", "<mask>", "{", "}", ")", "error", "{", "b", ",", "err", ":=", "w", ".", "EncodeJson", "(", "v", ")", "\n", "if", "err", "!=", "nil", "{", "return", "err", "\n", "}", "\n", "_", ",", "err", "=", "w", ".", "Write", "(", "b", ")", "\n", "if", "err", "!=", "nil", "{", "return", "err", "\n", "}", "\n", "return", "nil", "\n", "}" ]
8,586
all-8587
[ "getGoPath", "returns", "a", "single", "GOPATH", ".", "If", "there", "are", "multiple", "defined", "in", "the", "users", "$GOPATH", "env", "variable", "then", "getGoPath", "validates", "that", "the", "working", "directory", "is", "part", "of", "one", "of", "the", "GOPATHs", "and", "uses", "the", "first", "one", "it", "finds", "that", "does", "." ]
[ "func", "getGoPath", "(", ")", "(", "string", ",", "error", ")", "{", "wd", ",", "err", ":=", "<mask>", ".", "Getwd", "(", ")", "\n", "if", "err", "!=", "nil", "{", "return", "\"", "\"", ",", "err", "\n", "}", "\n\n", "gopath", ":=", "os", ".", "Getenv", "(", "\"", "\"", ")", "\n", "if", "gopath", "==", "\"", "\"", "{", "return", "\"", "\"", ",", "fmt", ".", "Errorf", "(", "\"", "\"", ")", "\n", "}", "\n\n", "// Split out multiple GOPATHs if necessary", "if", "s", ".", "Contains", "(", "gopath", ",", "\"", "\"", ")", "{", "paths", ":=", "s", ".", "Split", "(", "gopath", ",", "\"", "\"", ")", "\n", "for", "_", ",", "path", ":=", "range", "paths", "{", "if", "s", ".", "Contains", "(", "wd", ",", "path", ")", "{", "gopath", "=", "path", "\n", "break", "\n", "}", "\n", "}", "\n", "}", "\n\n", "if", "!", "s", ".", "Contains", "(", "wd", ",", "gopath", ")", "{", "return", "\"", "\"", ",", "fmt", ".", "Errorf", "(", "\"", "\"", "+", "\"", "\"", ",", "wd", ",", "gopath", ")", "\n", "}", "\n", "return", "gopath", ",", "nil", "\n", "}" ]
8,587
all-8588
[ "MarshalJSON", "supports", "json", ".", "Marshaler", "interface" ]
[ "func", "(", "v", "MarkUndoableStateParams", ")", "MarshalJSON", "(", ")", "(", "[", "]", "byte", ",", "error", ")", "{", "w", ":=", "jwriter", ".", "Writer", "{", "}", "\n", "easyjsonC5a4559bEncodeGithubComChromedpCdprotoDom31", "(", "&", "w", ",", "v", ")", "\n", "return", "w", ".", "<mask>", ".", "BuildBytes", "(", ")", ",", "w", ".", "Error", "\n", "}" ]
8,588
all-8589
[ "flushAll", "flushes", "all", "the", "logs", "and", "attempts", "to", "sync", "their", "data", "to", "disk", ".", "l", ".", "mu", "is", "held", "." ]
[ "func", "(", "l", "*", "Log", ")", "flushAll", "(", ")", "{", "// Flush from fatal down, in case there's trouble flushing.", "for", "s", ":=", "FatalLog", ";", "s", ">=", "InfoLog", ";", "s", "--", "{", "file", ":=", "l", ".", "file", "[", "s", "]", "\n", "if", "file", "!=", "nil", "{", "file", ".", "Flush", "(", ")", "// ignore error", "\n", "<mask>", ".", "Sync", "(", ")", "// ignore error", "\n", "}", "\n", "}", "\n", "}" ]
8,589
all-8590
[ "splitPath", "splits", "a", "path", "into", "its", "components", ".", "The", "first", "item", "has", "its", "initial", "path", "separator", "kept", "." ]
[ "func", "splitPath", "(", "p", "string", ")", "[", "]", "string", "{", "if", "p", "==", "\"", "\"", "{", "return", "nil", "\n", "}", "\n", "var", "out", "[", "]", "string", "\n", "s", ":=", "\"", "\"", "\n", "for", "_", ",", "c", ":=", "range", "p", "{", "if", "c", "!=", "'/'", "||", "(", "len", "(", "out", ")", "==", "0", "&&", "strings", ".", "Count", "(", "s", ",", "\"", "\"", ")", "==", "len", "(", "s", ")", ")", "{", "s", "+=", "string", "(", "c", ")", "\n", "}", "else", "if", "s", "!=", "\"", "\"", "{", "out", "=", "<mask>", "(", "out", ",", "s", ")", "\n", "s", "=", "\"", "\"", "\n", "}", "\n", "}", "\n", "if", "s", "!=", "\"", "\"", "{", "out", "=", "append", "(", "out", ",", "s", ")", "\n", "}", "\n", "return", "out", "\n", "}" ]
8,590
all-8591
[ "UnmarshalJSON", "supports", "json", ".", "Unmarshaler", "interface" ]
[ "func", "(", "v", "*", "SetBreakpointOnFunctionCallReturns", ")", "UnmarshalJSON", "(", "data", "[", "]", "byte", ")", "error", "{", "r", ":=", "jlexer", ".", "Lexer", "{", "Data", ":", "<mask>", "}", "\n", "easyjsonC5a4559bDecodeGithubComChromedpCdprotoDebugger12", "(", "&", "r", ",", "v", ")", "\n", "return", "r", ".", "Error", "(", ")", "\n", "}" ]
8,591
all-8592
[ "Save", "saves", "the", "cedar", "to", "an", "io", ".", "Writer", "where", "dataType", "is", "either", "json", "or", "gob", "." ]
[ "func", "(", "da", "*", "Cedar", ")", "Save", "(", "out", "io", ".", "Writer", ",", "dataType", "string", ")", "error", "{", "switch", "dataType", "{", "case", "\"", "\"", ",", "\"", "\"", ":", "dataEecoder", ":=", "gob", ".", "NewEncoder", "(", "out", ")", "\n", "return", "dataEecoder", ".", "Encode", "(", "da", ".", "cedar", ")", "\n", "case", "\"", "\"", ",", "\"", "\"", ":", "dataEecoder", ":=", "json", ".", "NewEncoder", "(", "<mask>", ")", "\n", "return", "dataEecoder", ".", "Encode", "(", "da", ".", "cedar", ")", "\n", "}", "\n", "return", "ErrInvalidDataType", "\n", "}" ]
8,592
all-8593
[ "NewDiscovery", "returns", "a", "new", "Discovery", "for", "the", "given", "config", "." ]
[ "func", "NewDiscovery", "(", "conf", "*", "SDConfig", ",", "logger", "log", ".", "Logger", ")", "(", "*", "Discovery", ",", "error", ")", "{", "if", "logger", "==", "nil", "{", "logger", "=", "log", ".", "NewNopLogger", "(", ")", "\n", "}", "\n\n", "tls", ",", "err", ":=", "config_util", ".", "NewTLSConfig", "(", "&", "conf", ".", "TLSConfig", ")", "\n", "if", "err", "!=", "nil", "{", "return", "nil", ",", "err", "\n", "}", "\n", "transport", ":=", "&", "http", ".", "Transport", "{", "IdleConnTimeout", ":", "5", "*", "time", ".", "Duration", "(", "conf", ".", "RefreshInterval", ")", ",", "TLSClientConfig", ":", "tls", ",", "DialContext", ":", "conntrack", ".", "NewDialContextFunc", "(", "conntrack", ".", "DialWithTracing", "(", ")", ",", "conntrack", ".", "DialWithName", "(", "\"", "\"", ")", ",", ")", ",", "}", "\n", "wrapper", ":=", "&", "<mask>", ".", "Client", "{", "Transport", ":", "transport", ",", "Timeout", ":", "35", "*", "time", ".", "Second", ",", "}", "\n\n", "clientConf", ":=", "&", "consul", ".", "Config", "{", "Address", ":", "conf", ".", "Server", ",", "Scheme", ":", "conf", ".", "Scheme", ",", "Datacenter", ":", "conf", ".", "Datacenter", ",", "Token", ":", "string", "(", "conf", ".", "Token", ")", ",", "HttpAuth", ":", "&", "consul", ".", "HttpBasicAuth", "{", "Username", ":", "conf", ".", "Username", ",", "Password", ":", "string", "(", "conf", ".", "Password", ")", ",", "}", ",", "HttpClient", ":", "wrapper", ",", "}", "\n", "client", ",", "err", ":=", "consul", ".", "NewClient", "(", "clientConf", ")", "\n", "if", "err", "!=", "nil", "{", "return", "nil", ",", "err", "\n", "}", "\n", "cd", ":=", "&", "Discovery", "{", "client", ":", "client", ",", "tagSeparator", ":", "conf", ".", "TagSeparator", ",", "watchedServices", ":", "conf", ".", "Services", ",", "watchedTags", ":", "conf", ".", "ServiceTags", ",", "watchedNodeMeta", ":", "conf", ".", "NodeMeta", ",", "allowStale", ":", "conf", ".", "AllowStale", ",", "refreshInterval", ":", "time", ".", "Duration", "(", "conf", ".", "RefreshInterval", ")", ",", "clientDatacenter", ":", "conf", ".", "Datacenter", ",", "finalizer", ":", "transport", ".", "CloseIdleConnections", ",", "logger", ":", "logger", ",", "}", "\n", "return", "cd", ",", "nil", "\n", "}" ]
8,593
all-8594
[ "ListCommit", "lists", "commits", ".", "If", "only", "repo", "is", "given", "all", "commits", "in", "the", "repo", "are", "returned", ".", "If", "to", "is", "given", "only", "the", "ancestors", "of", "to", "including", "to", "itself", "are", "considered", ".", "If", "from", "is", "given", "only", "the", "descendents", "of", "from", "including", "from", "itself", "are", "considered", ".", "number", "determines", "how", "many", "commits", "are", "returned", ".", "If", "number", "is", "0", "all", "commits", "that", "match", "the", "aforementioned", "criteria", "are", "returned", "." ]
[ "func", "(", "c", "APIClient", ")", "ListCommit", "(", "repoName", "string", ",", "to", "string", ",", "from", "string", ",", "number", "uint64", ")", "(", "[", "]", "*", "pfs", ".", "CommitInfo", ",", "error", ")", "{", "<mask>", "result", "[", "]", "*", "pfs", ".", "CommitInfo", "\n", "if", "err", ":=", "c", ".", "ListCommitF", "(", "repoName", ",", "to", ",", "from", ",", "number", ",", "func", "(", "ci", "*", "pfs", ".", "CommitInfo", ")", "error", "{", "result", "=", "append", "(", "result", ",", "ci", ")", "\n", "return", "nil", "\n", "}", ")", ";", "err", "!=", "nil", "{", "return", "nil", ",", "err", "\n", "}", "\n", "return", "result", ",", "nil", "\n", "}" ]
8,594
all-8595
[ "SignalGoString", "returns", "the", "value", "of", "the", "os", ".", "Signal", "for", "printing", "in", "a", "string", "." ]
[ "func", "SignalGoString", "(", "s", "*", "<mask>", ".", "Signal", ")", "string", "{", "if", "s", "==", "nil", "{", "return", "\"", "\"", "\n", "}", "\n", "if", "*", "s", "==", "nil", "{", "return", "\"", "\"", "\n", "}", "\n", "return", "fmt", ".", "Sprintf", "(", "\"", "\"", ",", "*", "s", ")", "\n", "}" ]
8,595
all-8596
[ "NewV3", "creates", "a", "new", "UUID", "with", "variant", "3", "as", "described", "in", "RFC", "4122", ".", "Variant", "3", "based", "namespace", "-", "uuid", "and", "name", "and", "MD", "-", "5", "hash", "calculation", "." ]
[ "func", "NewV3", "(", "namespace", "*", "UUID", ",", "name", "[", "]", "byte", ")", "*", "UUID", "{", "uuid", ":=", "newByHash", "(", "md5", ".", "New", "(", ")", ",", "namespace", ",", "<mask>", ")", "\n", "uuid", "[", "6", "]", "=", "(", "uuid", "[", "6", "]", "&", "0x0f", ")", "|", "0x30", "\n", "return", "uuid", "\n", "}" ]
8,596
all-8597
[ "Errorm", "executes", "the", "same", "function", "on", "the", "default", "Base", "instance" ]
[ "func", "Errorm", "(", "m", "*", "Attrs", ",", "msg", "string", ",", "a", "...", "<mask>", "{", "}", ")", "error", "{", "return", "curDefault", ".", "Errorm", "(", "m", ",", "msg", ",", "a", "...", ")", "\n", "}" ]
8,597
all-8598
[ "NewTrustLineEntryExt", "creates", "a", "new", "TrustLineEntryExt", "." ]
[ "func", "NewTrustLineEntryExt", "(", "v", "int32", ",", "<mask>", "interface", "{", "}", ")", "(", "result", "TrustLineEntryExt", ",", "err", "error", ")", "{", "result", ".", "V", "=", "v", "\n", "switch", "int32", "(", "v", ")", "{", "case", "0", ":", "// void", "}", "\n", "return", "\n", "}" ]
8,598
all-8599
[ "Tournaments", "related", "functions", "and", "methods" ]
[ "func", "(", "t", "Tournaments", ")", "GroupByMonths", "(", "season", "int", ")", "map", "[", "time", ".", "Month", "]", "Tournaments", "{", "byMonth", ":=", "make", "(", "map", "[", "time", ".", "Month", "]", "Tournaments", ")", "\n\n", "for", "_", ",", "entry", ":=", "<mask>", "t", "{", "y", ",", "m", ":=", "entry", ".", "Info", ".", "Scheduled", ".", "Year", "(", ")", ",", "entry", ".", "Info", ".", "Scheduled", ".", "Month", "(", ")", "\n", "if", "y", "==", "season", "{", "byMonth", "[", "m", "]", "=", "append", "(", "byMonth", "[", "m", "]", ",", "entry", ")", "\n", "}", "\n", "}", "\n\n", "return", "byMonth", "\n", "}" ]
8,599
all-8600
[ "DepEnsure", "runs", "dep", "ensure", "-", "v", "or", "go", "get", "-", "u", "depending", "on", "app", "tooling", "to", "make", "sure", "that", "any", "newly", "changed", "imports", "are", "added", "to", "dep", "or", "installed", "." ]
[ "func", "DepEnsure", "(", "r", "*", "Runner", ")", "error", "{", "if", "r", ".", "App", ".", "WithPop", "{", "upkg", "=", "<mask>", "(", "upkg", ",", "\"", "\"", ",", "\"", "\"", ")", "\n", "}", "\n", "if", "!", "r", ".", "App", ".", "WithDep", "{", "fmt", ".", "Println", "(", "\"", "\"", ")", "\n", "return", "modGetUpdate", "(", "r", ")", "\n", "}", "\n\n", "fmt", ".", "Println", "(", "\"", "\"", ")", "\n", "return", "runDepEnsure", "(", "r", ")", "\n", "}" ]