id
int32
0
25.3k
idx
stringlengths
5
9
nl_tokens
listlengths
1
418
pl_tokens
listlengths
22
4.98k
20,400
all-20401
[ "NewKeysAPIWithPrefix", "acts", "like", "NewKeysAPI", "but", "allows", "the", "caller", "to", "provide", "a", "custom", "base", "URL", "path", ".", "This", "should", "only", "be", "used", "in", "very", "rare", "cases", "." ]
[ "func", "NewKeysAPIWithPrefix", "(", "c", "<mask>", ",", "p", "string", ")", "KeysAPI", "{", "return", "&", "httpKeysAPI", "{", "client", ":", "c", ",", "prefix", ":", "p", ",", "}", "\n", "}" ]
20,401
all-20402
[ "MustParse", "processes", "command", "line", "arguments", "and", "exits", "upon", "failure" ]
[ "func", "MustParse", "(", "dest", "...", "interface", "{", "}", ")", "*", "Parser", "{", "p", ",", "err", ":=", "NewParser", "(", "Config", "{", "}", ",", "dest", "...", ")", "\n", "if", "err", "!=", "nil", "{", "fmt", ".", "Println", "(", "err", ")", "\n", "os", ".", "Exit", "(", "-", "1", ")", "\n", "}", "\n", "err", "=", "p", ".", "Parse", "(", "flags", "(", ")", ")", "\n", "if", "err", "==", "ErrHelp", "{", "p", ".", "WriteHelp", "(", "os", ".", "Stdout", ")", "\n", "os", ".", "Exit", "(", "0", ")", "\n", "}", "\n", "if", "err", "==", "ErrVersion", "{", "fmt", ".", "Println", "(", "p", ".", "<mask>", ")", "\n", "os", ".", "Exit", "(", "0", ")", "\n", "}", "\n", "if", "err", "!=", "nil", "{", "p", ".", "Fail", "(", "err", ".", "Error", "(", ")", ")", "\n", "}", "\n", "return", "p", "\n", "}" ]
20,402
all-20403
[ "toMap", "returns", "maps", "the", "file", "name", "to", "its", "coverage", "for", "faster", "retrieval", "&", "membership", "check" ]
[ "func", "toMap", "(", "g", "*", "calculation", ".", "CoverageList", ")", "map", "[", "string", "]", "calculation", ".", "Coverage", "{", "m", ":=", "<mask>", "(", "map", "[", "string", "]", "calculation", ".", "Coverage", ")", "\n", "for", "_", ",", "cov", ":=", "range", "g", ".", "Group", "{", "m", "[", "cov", ".", "Name", "]", "=", "cov", "\n", "}", "\n", "return", "m", "\n", "}" ]
20,403
all-20404
[ "UnmarshalJSON", "supports", "json", ".", "Unmarshaler", "interface" ]
[ "func", "(", "v", "*", "SetScriptExecutionDisabledParams", ")", "UnmarshalJSON", "(", "data", "[", "]", "<mask>", ")", "error", "{", "r", ":=", "jlexer", ".", "Lexer", "{", "Data", ":", "data", "}", "\n", "easyjsonC5a4559bDecodeGithubComChromedpCdprotoEmulation5", "(", "&", "r", ",", "v", ")", "\n", "return", "r", ".", "Error", "(", ")", "\n", "}" ]
20,404
all-20405
[ "expandCustomizationSysprepText", "reads", "certain", "ResourceData", "keys", "and", "returns", "a", "CustomizationSysprepText", "." ]
[ "func", "expandCustomizationSysprepText", "(", "d", "*", "schema", ".", "ResourceData", ")", "*", "types", ".", "CustomizationSysprepText", "{", "obj", ":=", "&", "<mask>", ".", "CustomizationSysprepText", "{", "Value", ":", "d", ".", "Get", "(", "cKeyPrefix", "+", "\"", "\"", "+", "\"", "\"", ")", ".", "(", "string", ")", ",", "}", "\n", "return", "obj", "\n", "}" ]
20,405
all-20406
[ "Calculate", "computes", "the", "actions", "needed", "to", "move", "current", "state", "towards", "desired", "state", ".", "It", "then", "passes", "those", "changes", "to", "the", "current", "policy", "for", "further", "processing", ".", "It", "returns", "a", "copy", "of", "Plan", "with", "the", "changes", "populated", "." ]
[ "func", "(", "p", "*", "Plan", ")", "Calculate", "(", ")", "*", "Plan", "{", "t", ":=", "newPlanTable", "(", ")", "\n\n", "for", "_", ",", "current", ":=", "range", "filterRecordsForPlan", "(", "p", ".", "Current", ")", "{", "t", ".", "addCurrent", "(", "current", ")", "\n", "}", "\n", "for", "_", ",", "desired", ":=", "range", "filterRecordsForPlan", "(", "p", ".", "Desired", ")", "{", "t", ".", "addCandidate", "(", "desired", ")", "\n", "}", "\n\n", "changes", ":=", "&", "Changes", "{", "}", "\n", "changes", ".", "Create", "=", "t", ".", "getCreates", "(", ")", "\n", "changes", ".", "Delete", "=", "t", ".", "getDeletes", "(", ")", "\n", "changes", ".", "UpdateNew", ",", "changes", ".", "UpdateOld", "=", "t", ".", "getUpdates", "(", ")", "\n", "for", "_", ",", "pol", ":=", "range", "p", ".", "Policies", "{", "changes", "=", "pol", ".", "Apply", "(", "changes", ")", "\n", "}", "\n\n", "<mask>", ":=", "&", "Plan", "{", "Current", ":", "p", ".", "Current", ",", "Desired", ":", "p", ".", "Desired", ",", "Changes", ":", "changes", ",", "}", "\n\n", "return", "plan", "\n", "}" ]
20,406
all-20407
[ "MapExprStrings", "applies", "a", "function", "to", "string", "sub", "-", "expressions", "within", "e", ".", "An", "expression", "containing", "the", "results", "with", "the", "same", "structure", "as", "e", "is", "returned", "." ]
[ "func", "MapExprStrings", "(", "e", "bzl", ".", "Expr", ",", "f", "func", "(", "string", ")", "string", ")", "bzl", ".", "Expr", "{", "if", "e", "==", "nil", "{", "return", "nil", "\n", "}", "\n", "switch", "expr", ":=", "e", ".", "(", "type", ")", "{", "case", "*", "bzl", ".", "StringExpr", ":", "s", ":=", "f", "(", "expr", ".", "Value", ")", "\n", "if", "s", "==", "\"", "\"", "{", "return", "nil", "\n", "}", "\n", "ret", ":=", "*", "expr", "\n", "ret", ".", "Value", "=", "s", "\n", "return", "&", "ret", "\n\n", "case", "*", "bzl", ".", "ListExpr", ":", "var", "list", "[", "]", "bzl", ".", "Expr", "\n", "for", "_", ",", "elem", ":=", "<mask>", "expr", ".", "List", "{", "elem", "=", "MapExprStrings", "(", "elem", ",", "f", ")", "\n", "if", "elem", "!=", "nil", "{", "list", "=", "append", "(", "list", ",", "elem", ")", "\n", "}", "\n", "}", "\n", "if", "len", "(", "list", ")", "==", "0", "&&", "len", "(", "expr", ".", "List", ")", ">", "0", "{", "return", "nil", "\n", "}", "\n", "ret", ":=", "*", "expr", "\n", "ret", ".", "List", "=", "list", "\n", "return", "&", "ret", "\n\n", "case", "*", "bzl", ".", "DictExpr", ":", "var", "cases", "[", "]", "bzl", ".", "Expr", "\n", "isEmpty", ":=", "true", "\n", "for", "_", ",", "kv", ":=", "range", "expr", ".", "List", "{", "keyval", ",", "ok", ":=", "kv", ".", "(", "*", "bzl", ".", "KeyValueExpr", ")", "\n", "if", "!", "ok", "{", "log", ".", "Panicf", "(", "\"", "\"", ",", "kv", ")", "\n", "}", "\n", "value", ":=", "MapExprStrings", "(", "keyval", ".", "Value", ",", "f", ")", "\n", "if", "value", "!=", "nil", "{", "cases", "=", "append", "(", "cases", ",", "&", "bzl", ".", "KeyValueExpr", "{", "Key", ":", "keyval", ".", "Key", ",", "Value", ":", "value", "}", ")", "\n", "if", "key", ",", "ok", ":=", "keyval", ".", "Key", ".", "(", "*", "bzl", ".", "StringExpr", ")", ";", "!", "ok", "||", "key", ".", "Value", "!=", "\"", "\"", "{", "isEmpty", "=", "false", "\n", "}", "\n", "}", "\n", "}", "\n", "if", "isEmpty", "{", "return", "nil", "\n", "}", "\n", "ret", ":=", "*", "expr", "\n", "ret", ".", "List", "=", "cases", "\n", "return", "&", "ret", "\n\n", "case", "*", "bzl", ".", "CallExpr", ":", "if", "x", ",", "ok", ":=", "expr", ".", "X", ".", "(", "*", "bzl", ".", "Ident", ")", ";", "!", "ok", "||", "x", ".", "Name", "!=", "\"", "\"", "||", "len", "(", "expr", ".", "List", ")", "!=", "1", "{", "log", ".", "Panicf", "(", "\"", "\"", ",", "e", ")", "\n", "}", "\n", "arg", ":=", "MapExprStrings", "(", "expr", ".", "List", "[", "0", "]", ",", "f", ")", "\n", "if", "arg", "==", "nil", "{", "return", "nil", "\n", "}", "\n", "call", ":=", "*", "expr", "\n", "call", ".", "List", "[", "0", "]", "=", "arg", "\n", "return", "&", "call", "\n\n", "case", "*", "bzl", ".", "BinaryExpr", ":", "x", ":=", "MapExprStrings", "(", "expr", ".", "X", ",", "f", ")", "\n", "y", ":=", "MapExprStrings", "(", "expr", ".", "Y", ",", "f", ")", "\n", "if", "x", "==", "nil", "{", "return", "y", "\n", "}", "\n", "if", "y", "==", "nil", "{", "return", "x", "\n", "}", "\n", "binop", ":=", "*", "expr", "\n", "binop", ".", "X", "=", "x", "\n", "binop", ".", "Y", "=", "y", "\n", "return", "&", "binop", "\n\n", "default", ":", "return", "nil", "\n", "}", "\n", "}" ]
20,407
all-20408
[ "SetupTrust", "is", "a", "convenience", "around", "ContainerServer", ".", "CreateCertificate", "that", "adds", "the", "given", "client", "certificate", "to", "the", "trusted", "pool", "of", "the", "cluster", "at", "the", "given", "address", "using", "the", "given", "password", "." ]
[ "func", "SetupTrust", "(", "cert", ",", "targetAddress", ",", "targetCert", ",", "targetPassword", "string", ")", "error", "{", "// Connect to the target cluster node.", "args", ":=", "&", "lxd", ".", "ConnectionArgs", "{", "TLSServerCert", ":", "targetCert", ",", "}", "\n", "target", ",", "err", ":=", "lxd", ".", "ConnectLXD", "(", "fmt", ".", "Sprintf", "(", "\"", "\"", ",", "targetAddress", ")", ",", "args", ")", "\n", "if", "err", "!=", "nil", "{", "return", "errors", ".", "Wrap", "(", "err", ",", "\"", "\"", ")", "\n", "}", "\n", "block", ",", "_", ":=", "pem", ".", "Decode", "(", "[", "]", "byte", "(", "cert", ")", ")", "\n", "if", "block", "==", "nil", "{", "return", "errors", ".", "Wrap", "(", "err", ",", "\"", "\"", ")", "\n", "}", "\n", "certificate", ":=", "base64", ".", "StdEncoding", ".", "EncodeToString", "(", "block", ".", "Bytes", ")", "\n", "post", ":=", "api", ".", "CertificatesPost", "{", "Password", ":", "targetPassword", ",", "Certificate", ":", "certificate", ",", "}", "\n", "fingerprint", ",", "err", ":=", "shared", ".", "CertFingerprintStr", "(", "cert", ")", "\n", "if", "err", "!=", "nil", "{", "return", "errors", ".", "Wrap", "(", "err", ",", "\"", "\"", ")", "\n", "}", "\n", "post", ".", "Name", "=", "fmt", ".", "Sprintf", "(", "\"", "\"", ",", "fingerprint", ")", "\n", "post", ".", "Type", "=", "\"", "\"", "\n", "err", "=", "target", ".", "CreateCertificate", "(", "post", ")", "\n", "if", "err", "!=", "nil", "&&", "err", ".", "<mask>", "(", ")", "!=", "\"", "\"", "{", "return", "errors", ".", "Wrap", "(", "err", ",", "\"", "\"", ")", "\n", "}", "\n", "return", "nil", "\n", "}" ]
20,408
all-20409
[ "HasOrderDir", "returns", "a", "boolean", "if", "a", "field", "has", "been", "set", "." ]
[ "func", "(", "t", "*", "TileDefRequest", ")", "HasOrderDir", "(", ")", "bool", "{", "if", "t", "!=", "nil", "&&", "t", ".", "OrderDir", "!=", "nil", "{", "return", "true", "\n", "}", "\n\n", "return", "<mask>", "\n", "}" ]
20,409
all-20410
[ "detectBinaryBody", "returns", "true", "if", "the", "mail", "header", "defines", "a", "binary", "body", "." ]
[ "func", "detectBinaryBody", "(", "root", "*", "Part", ")", "bool", "{", "if", "detectTextHeader", "(", "root", ".", "Header", ",", "<mask>", ")", "{", "return", "false", "\n", "}", "\n\n", "isBin", ":=", "detectAttachmentHeader", "(", "root", ".", "Header", ")", "\n", "if", "!", "isBin", "{", "// This must be an attachment, if the Content-Type is not", "// 'text/plain' or 'text/html'.", "// Example:", "// Content-Type: application/pdf; name=\"doc.pdf\"", "mediatype", ",", "_", ",", "_", ",", "_", ":=", "parseMediaType", "(", "root", ".", "Header", ".", "Get", "(", "hnContentType", ")", ")", "\n", "mediatype", "=", "strings", ".", "ToLower", "(", "mediatype", ")", "\n", "if", "mediatype", "!=", "ctTextPlain", "&&", "mediatype", "!=", "ctTextHTML", "{", "return", "true", "\n", "}", "\n", "}", "\n\n", "return", "isBin", "\n", "}" ]
20,410
all-20411
[ "GetIconOk", "returns", "a", "tuple", "with", "the", "Icon", "field", "if", "it", "s", "non", "-", "nil", "zero", "value", "otherwise", "and", "a", "boolean", "to", "check", "if", "the", "value", "has", "been", "set", "." ]
[ "func", "(", "c", "*", "CreatedBy", ")", "GetIconOk", "(", ")", "(", "string", ",", "bool", ")", "{", "if", "c", "==", "nil", "||", "c", ".", "Icon", "==", "nil", "{", "return", "\"", "\"", ",", "false", "\n", "}", "\n", "return", "*", "c", ".", "Icon", ",", "<mask>", "\n", "}" ]
20,411
all-20412
[ "PProfHandlers", "returns", "a", "map", "of", "pprof", "handlers", "keyed", "by", "the", "HTTP", "path", "." ]
[ "func", "PProfHandlers", "(", ")", "map", "[", "string", "]", "http", ".", "Handler", "{", "// set only when there's no existing setting", "if", "runtime", ".", "SetMutexProfileFraction", "(", "-", "1", ")", "==", "0", "{", "// 1 out of 5 mutex events are reported, on average", "runtime", ".", "SetMutexProfileFraction", "(", "5", ")", "\n", "}", "\n\n", "m", ":=", "make", "(", "map", "[", "string", "]", "http", ".", "Handler", ")", "\n\n", "m", "[", "HTTPPrefixPProf", "+", "\"", "\"", "]", "=", "http", ".", "HandlerFunc", "(", "pprof", ".", "<mask>", ")", "\n", "m", "[", "HTTPPrefixPProf", "+", "\"", "\"", "]", "=", "http", ".", "HandlerFunc", "(", "pprof", ".", "Profile", ")", "\n", "m", "[", "HTTPPrefixPProf", "+", "\"", "\"", "]", "=", "http", ".", "HandlerFunc", "(", "pprof", ".", "Symbol", ")", "\n", "m", "[", "HTTPPrefixPProf", "+", "\"", "\"", "]", "=", "http", ".", "HandlerFunc", "(", "pprof", ".", "Cmdline", ")", "\n", "m", "[", "HTTPPrefixPProf", "+", "\"", "\"", "]", "=", "http", ".", "HandlerFunc", "(", "pprof", ".", "Trace", ")", "\n", "m", "[", "HTTPPrefixPProf", "+", "\"", "\"", "]", "=", "pprof", ".", "Handler", "(", "\"", "\"", ")", "\n", "m", "[", "HTTPPrefixPProf", "+", "\"", "\"", "]", "=", "pprof", ".", "Handler", "(", "\"", "\"", ")", "\n", "m", "[", "HTTPPrefixPProf", "+", "\"", "\"", "]", "=", "pprof", ".", "Handler", "(", "\"", "\"", ")", "\n", "m", "[", "HTTPPrefixPProf", "+", "\"", "\"", "]", "=", "pprof", ".", "Handler", "(", "\"", "\"", ")", "\n", "m", "[", "HTTPPrefixPProf", "+", "\"", "\"", "]", "=", "pprof", ".", "Handler", "(", "\"", "\"", ")", "\n\n", "return", "m", "\n", "}" ]
20,412
all-20413
[ "String", "implements", "Stringer", "interface", "." ]
[ "func", "(", "i", "Identifier", ")", "<mask>", "(", ")", "string", "{", "s", ":=", "string", "(", "i", ")", "\n", "if", "reSimple", ".", "MatchString", "(", "s", ")", "{", "return", "s", "\n", "}", "\n", "return", "strconv", ".", "Quote", "(", "s", ")", "\n", "}" ]
20,413
all-20414
[ "l", ".", "firstIndex", "<", "=", "lo", "<", "=", "hi", "<", "=", "l", ".", "firstIndex", "+", "len", "(", "l", ".", "entries", ")" ]
[ "func", "(", "l", "*", "raftLog", ")", "mustCheckOutOfBounds", "(", "lo", ",", "hi", "uint64", ")", "error", "{", "if", "lo", ">", "hi", "{", "l", ".", "logger", ".", "Panicf", "(", "\"", "\"", ",", "lo", ",", "hi", ")", "\n", "}", "\n", "fi", ":=", "l", ".", "firstIndex", "(", ")", "\n", "if", "lo", "<", "fi", "{", "return", "ErrCompacted", "\n", "}", "\n\n", "<mask>", ":=", "l", ".", "lastIndex", "(", ")", "+", "1", "-", "fi", "\n", "if", "lo", "<", "fi", "||", "hi", ">", "fi", "+", "length", "{", "l", ".", "logger", ".", "Panicf", "(", "\"", "\"", ",", "lo", ",", "hi", ",", "fi", ",", "l", ".", "lastIndex", "(", ")", ")", "\n", "}", "\n", "return", "nil", "\n", "}" ]
20,414
all-20415
[ "NewClient", "establishes", "a", "new", "Client", "connection", "based", "on", "a", "set", "of", "Options", "." ]
[ "func", "(", "o", "Options", ")", "NewClient", "(", ")", "(", "*", "Client", ",", "error", ")", "{", "host", ":=", "o", ".", "Host", "\n", "c", ",", "err", ":=", "connect", "(", "<mask>", ",", "o", ".", "User", ",", "o", ".", "Password", ")", "\n", "if", "err", "!=", "nil", "{", "return", "nil", ",", "err", "\n", "}", "\n\n", "if", "strings", ".", "LastIndex", "(", "o", ".", "Host", ",", "\"", "\"", ")", ">", "0", "{", "host", "=", "host", "[", ":", "strings", ".", "LastIndex", "(", "o", ".", "Host", ",", "\"", "\"", ")", "]", "\n", "}", "\n\n", "client", ":=", "new", "(", "Client", ")", "\n", "if", "o", ".", "NoTLS", "{", "client", ".", "conn", "=", "c", "\n", "}", "else", "{", "var", "tlsconn", "*", "tls", ".", "Conn", "\n", "if", "o", ".", "TLSConfig", "!=", "nil", "{", "tlsconn", "=", "tls", ".", "Client", "(", "c", ",", "o", ".", "TLSConfig", ")", "\n", "}", "else", "{", "DefaultConfig", ".", "ServerName", "=", "host", "\n", "newconfig", ":=", "DefaultConfig", "\n", "newconfig", ".", "ServerName", "=", "host", "\n", "tlsconn", "=", "tls", ".", "Client", "(", "c", ",", "&", "newconfig", ")", "\n", "}", "\n", "if", "err", "=", "tlsconn", ".", "Handshake", "(", ")", ";", "err", "!=", "nil", "{", "return", "nil", ",", "err", "\n", "}", "\n", "insecureSkipVerify", ":=", "DefaultConfig", ".", "InsecureSkipVerify", "\n", "if", "o", ".", "TLSConfig", "!=", "nil", "{", "insecureSkipVerify", "=", "o", ".", "TLSConfig", ".", "InsecureSkipVerify", "\n", "}", "\n", "if", "!", "insecureSkipVerify", "{", "if", "err", "=", "tlsconn", ".", "VerifyHostname", "(", "host", ")", ";", "err", "!=", "nil", "{", "return", "nil", ",", "err", "\n", "}", "\n", "}", "\n", "client", ".", "conn", "=", "tlsconn", "\n", "}", "\n\n", "if", "err", ":=", "client", ".", "init", "(", "&", "o", ")", ";", "err", "!=", "nil", "{", "client", ".", "Close", "(", ")", "\n", "return", "nil", ",", "err", "\n", "}", "\n\n", "return", "client", ",", "nil", "\n", "}" ]
20,415
all-20416
[ "MarshalJSON", "supports", "json", ".", "Marshaler", "interface" ]
[ "func", "(", "v", "StartViolationsReportParams", ")", "MarshalJSON", "(", ")", "(", "[", "]", "byte", ",", "error", ")", "{", "w", ":=", "jwriter", ".", "Writer", "{", "}", "\n", "easyjsonC5a4559bEncodeGithubComChromedpCdprotoLog2", "(", "&", "w", ",", "v", ")", "\n", "return", "w", ".", "<mask>", ".", "BuildBytes", "(", ")", ",", "w", ".", "Error", "\n", "}" ]
20,416
all-20417
[ "AliasForSpec", "determines", "the", "GCS", "path", "aliases", "for", "a", "job", "spec" ]
[ "func", "AliasForSpec", "(", "<mask>", "*", "downwardapi", ".", "JobSpec", ")", "string", "{", "switch", "spec", ".", "Type", "{", "case", "prowapi", ".", "PeriodicJob", ",", "prowapi", ".", "PostsubmitJob", ",", "prowapi", ".", "BatchJob", ":", "return", "\"", "\"", "\n", "case", "prowapi", ".", "PresubmitJob", ":", "return", "path", ".", "Join", "(", "PRLogs", ",", "\"", "\"", ",", "spec", ".", "Job", ",", "fmt", ".", "Sprintf", "(", "\"", "\"", ",", "spec", ".", "BuildID", ")", ")", "\n", "default", ":", "logrus", ".", "Fatalf", "(", "\"", "\"", ",", "spec", ".", "Type", ")", "\n", "}", "\n", "return", "\"", "\"", "\n", "}" ]
20,417
all-20418
[ "GetLabel", "is", "a", "wrapper", "around", "gtk_tool_button_get_label", "()", "." ]
[ "func", "(", "v", "*", "ToolButton", ")", "GetLabel", "(", ")", "<mask>", "{", "c", ":=", "C", ".", "gtk_tool_button_get_label", "(", "v", ".", "native", "(", ")", ")", "\n", "return", "goString", "(", "c", ")", "\n", "}" ]
20,418
all-20419
[ "SetEndpoints", "updates", "client", "s", "endpoints", "." ]
[ "func", "(", "c", "*", "<mask>", ")", "SetEndpoints", "(", "eps", "...", "string", ")", "{", "c", ".", "mu", ".", "Lock", "(", ")", "\n", "defer", "c", ".", "mu", ".", "Unlock", "(", ")", "\n", "c", ".", "cfg", ".", "Endpoints", "=", "eps", "\n", "c", ".", "resolverGroup", ".", "SetEndpoints", "(", "eps", ")", "\n", "}" ]
20,419
all-20420
[ "imports", "returns", "a", "map", "of", "all", "import", "directories", "(", "recursively", ")", "used", "by", "the", "app", ".", "The", "return", "value", "maps", "full", "directory", "names", "to", "original", "import", "names", "." ]
[ "func", "imports", "(", "ctxt", "*", "build", ".", "Context", ",", "srcDir", "string", ",", "gopath", "[", "]", "string", ")", "(", "map", "[", "string", "]", "string", ",", "error", ")", "{", "pkg", ",", "err", ":=", "ctxt", ".", "ImportDir", "(", "srcDir", ",", "0", ")", "\n", "if", "err", "!=", "nil", "{", "return", "nil", ",", "fmt", ".", "Errorf", "(", "\"", "\"", ",", "err", ")", "\n", "}", "\n\n", "// Resolve all non-standard-library imports", "result", ":=", "make", "(", "map", "[", "string", "]", "string", ")", "\n", "for", "_", ",", "v", ":=", "range", "pkg", ".", "Imports", "{", "if", "!", "strings", ".", "Contains", "(", "v", ",", "\"", "\"", ")", "{", "continue", "\n", "}", "\n", "src", ",", "err", ":=", "findInGopath", "(", "v", ",", "gopath", ")", "\n", "if", "err", "!=", "nil", "{", "return", "nil", ",", "fmt", ".", "Errorf", "(", "\"", "\"", ",", "v", ",", "gopath", ",", "err", ")", "\n", "}", "\n", "result", "[", "src", "]", "=", "v", "\n", "im", ",", "err", ":=", "imports", "(", "ctxt", ",", "src", ",", "gopath", ")", "\n", "if", "err", "!=", "nil", "{", "return", "nil", ",", "fmt", ".", "Errorf", "(", "\"", "\"", ",", "src", ",", "err", ")", "\n", "}", "\n", "for", "k", ",", "v", ":=", "<mask>", "im", "{", "result", "[", "k", "]", "=", "v", "\n", "}", "\n", "}", "\n", "return", "result", ",", "nil", "\n", "}" ]
20,420
all-20421
[ "CancelRotateSecret", "mocks", "base", "method" ]
[ "func", "(", "m", "*", "MockSecretsManagerAPI", ")", "CancelRotateSecret", "(", "arg0", "*", "secretsmanager", ".", "CancelRotateSecretInput", ")", "(", "*", "secretsmanager", ".", "CancelRotateSecretOutput", ",", "error", ")", "{", "ret", ":=", "m", ".", "ctrl", ".", "Call", "(", "m", ",", "\"", "\"", ",", "arg0", ")", "\n", "ret0", ",", "_", ":=", "ret", "[", "0", "]", ".", "(", "*", "secretsmanager", ".", "CancelRotateSecretOutput", ")", "\n", "ret1", ",", "_", ":=", "<mask>", "[", "1", "]", ".", "(", "error", ")", "\n", "return", "ret0", ",", "ret1", "\n", "}" ]
20,421
all-20422
[ "newOpenshiftClient", "creates", "a", "new", "openshiftClient", "for", "the", "specified", "reference", "." ]
[ "func", "newOpenshiftClient", "(", "ref", "openshiftReference", ")", "(", "*", "openshiftClient", ",", "error", ")", "{", "// We have already done this parsing in ParseReference, but thrown away", "// httpClient. So, parse again.", "// (We could also rework/split restClientFor to \"get base URL\" to be done", "// in ParseReference, and \"get httpClient\" to be done here. But until/unless", "// we support non-default clusters, this is good enough.)", "// Overall, this is modelled on openshift/origin/pkg/cmd/util/clientcmd.New().ClientConfig() and openshift/origin/pkg/client.", "cmdConfig", ":=", "defaultClientConfig", "(", ")", "\n", "logrus", ".", "Debugf", "(", "\"", "\"", ",", "cmdConfig", ")", "\n", "restConfig", ",", "err", ":=", "cmdConfig", ".", "ClientConfig", "(", ")", "\n", "if", "err", "!=", "nil", "{", "return", "nil", ",", "err", "\n", "}", "\n", "// REMOVED: SetOpenShiftDefaults (values are not overridable in config files, so hard-coded these defaults.)", "logrus", ".", "Debugf", "(", "\"", "\"", ",", "restConfig", ")", "\n", "baseURL", ",", "httpClient", ",", "err", ":=", "restClientFor", "(", "restConfig", ")", "\n", "if", "err", "!=", "nil", "{", "return", "nil", ",", "err", "\n", "}", "\n", "logrus", ".", "Debugf", "(", "\"", "\"", ",", "*", "baseURL", ")", "\n\n", "if", "httpClient", "==", "nil", "{", "httpClient", "=", "http", ".", "DefaultClient", "\n", "}", "\n\n", "return", "&", "openshiftClient", "{", "<mask>", ":", "ref", ",", "baseURL", ":", "baseURL", ",", "httpClient", ":", "httpClient", ",", "bearerToken", ":", "restConfig", ".", "BearerToken", ",", "username", ":", "restConfig", ".", "Username", ",", "password", ":", "restConfig", ".", "Password", ",", "}", ",", "nil", "\n", "}" ]
20,422
all-20423
[ "NewClient", "returns", "a", "configured", "Rundeck", "client", "." ]
[ "func", "NewClient", "(", "config", "*", "ClientConfig", ")", "(", "*", "Client", ",", "error", ")", "{", "t", ":=", "&", "http", ".", "Transport", "{", "TLSClientConfig", ":", "&", "tls", ".", "Config", "{", "InsecureSkipVerify", ":", "config", ".", "AllowUnverifiedSSL", ",", "}", ",", "}", "\n", "httpClient", ":=", "&", "http", ".", "Client", "{", "Transport", ":", "t", ",", "}", "\n\n", "apiPath", ",", "_", ":=", "url", ".", "Parse", "(", "\"", "\"", ")", "\n", "baseURL", ",", "err", ":=", "<mask>", ".", "Parse", "(", "config", ".", "BaseURL", ")", "\n", "if", "err", "!=", "nil", "{", "return", "nil", ",", "fmt", ".", "Errorf", "(", "\"", "\"", ",", "err", ".", "Error", "(", ")", ")", "\n", "}", "\n", "apiURL", ":=", "baseURL", ".", "ResolveReference", "(", "apiPath", ")", "\n\n", "return", "&", "Client", "{", "httpClient", ":", "httpClient", ",", "apiURL", ":", "apiURL", ",", "authToken", ":", "config", ".", "AuthToken", ",", "}", ",", "nil", "\n", "}" ]
20,423
all-20424
[ "MustChangeTrustResult", "retrieves", "the", "ChangeTrustResult", "value", "from", "the", "union", "panicing", "if", "the", "value", "is", "not", "set", "." ]
[ "func", "(", "u", "OperationResultTr", ")", "MustChangeTrustResult", "(", ")", "ChangeTrustResult", "{", "val", ",", "ok", ":=", "u", ".", "GetChangeTrustResult", "(", ")", "\n\n", "if", "!", "<mask>", "{", "panic", "(", "\"", "\"", ")", "\n", "}", "\n\n", "return", "val", "\n", "}" ]
20,424
all-20425
[ "ExtractWriter", "extracts", "all", "cluster", "state", "and", "marshals", "it", "to", "w", "." ]
[ "func", "(", "c", "APIClient", ")", "ExtractWriter", "(", "objects", "bool", ",", "w", "io", ".", "Writer", ")", "error", "{", "<mask>", ":=", "pbutil", ".", "NewWriter", "(", "w", ")", "\n", "return", "c", ".", "Extract", "(", "objects", ",", "func", "(", "op", "*", "admin", ".", "Op", ")", "error", "{", "_", ",", "err", ":=", "writer", ".", "Write", "(", "op", ")", "\n", "return", "err", "\n", "}", ")", "\n", "}" ]
20,425
all-20426
[ "shrinkStates", "shrinks", "the", "state", "list", "down", "to", "size", "states" ]
[ "func", "(", "c", "*", "context", ")", "shrinkStates", "(", "states", "[", "]", "state", ",", "size", "int", ")", "[", "]", "state", "{", "i1", ":=", "units2Index", "[", "(", "len", "(", "states", ")", "+", "1", ")", ">>", "1", "]", "\n", "i2", ":=", "units2Index", "[", "(", "<mask>", "+", "1", ")", ">>", "1", "]", "\n\n", "if", "size", "==", "1", "{", "// store state in context, and free states block", "n", ":=", "c", ".", "statesIndex", "(", ")", "\n", "c", ".", "s", "[", "1", "]", "=", "states", "[", "0", "]", "\n", "states", "=", "c", ".", "s", "[", "1", ":", "]", "\n", "c", ".", "a", ".", "addFreeBlock", "(", "n", ",", "i1", ")", "\n", "}", "else", "if", "i1", "!=", "i2", "{", "if", "n", ":=", "c", ".", "a", ".", "removeFreeBlock", "(", "i2", ")", ";", "n", ">", "0", "{", "// allocate new block and copy", "copy", "(", "c", ".", "a", ".", "states", "[", "n", ":", "]", ",", "states", "[", ":", "size", "]", ")", "\n", "states", "=", "c", ".", "a", ".", "states", "[", "n", ":", "]", "\n", "// free old block", "c", ".", "a", ".", "addFreeBlock", "(", "c", ".", "statesIndex", "(", ")", ",", "i1", ")", "\n", "c", ".", "setStatesIndex", "(", "n", ")", "\n", "}", "else", "{", "// split current block, and free units not needed", "n", "=", "c", ".", "statesIndex", "(", ")", "+", "index2Units", "[", "i2", "]", "<<", "1", "\n", "u", ":=", "index2Units", "[", "i1", "]", "-", "index2Units", "[", "i2", "]", "\n", "c", ".", "a", ".", "freeUnits", "(", "n", ",", "u", ")", "\n", "}", "\n", "}", "\n", "c", ".", "setNumStates", "(", "size", ")", "\n", "return", "states", "[", ":", "size", "]", "\n", "}" ]
20,426
all-20427
[ "Wait", "blocks", "on", "the", "barrier", "key", "until", "it", "is", "deleted", ".", "If", "there", "is", "no", "key", "Wait", "assumes", "Release", "has", "already", "been", "called", "and", "returns", "immediately", "." ]
[ "func", "(", "b", "*", "Barrier", ")", "Wait", "(", ")", "error", "{", "resp", ",", "err", ":=", "b", ".", "client", ".", "Get", "(", "b", ".", "ctx", ",", "b", ".", "key", ",", "v3", ".", "WithFirstKey", "(", ")", "...", ")", "\n", "if", "err", "!=", "nil", "{", "return", "err", "\n", "}", "\n", "if", "len", "(", "resp", ".", "Kvs", ")", "==", "0", "{", "// key already removed", "return", "nil", "\n", "}", "\n", "_", ",", "err", "=", "WaitEvents", "(", "b", ".", "client", ",", "b", ".", "key", ",", "resp", ".", "<mask>", ".", "Revision", ",", "[", "]", "mvccpb", ".", "Event_EventType", "{", "mvccpb", ".", "PUT", ",", "mvccpb", ".", "DELETE", "}", ")", "\n", "return", "err", "\n", "}" ]
20,427
all-20428
[ "Run", "user", "error", "code", "and", "return", "the", "combined", "output", "of", "stdout", "and", "stderr", "." ]
[ "func", "(", "a", "*", "APIServer", ")", "runUserErrorHandlingCode", "(", "ctx", "context", ".", "Context", ",", "logger", "*", "taggedLogger", ",", "environ", "[", "]", "string", ",", "stats", "*", "pps", ".", "ProcessStats", ",", "rawDatumTimeout", "*", "<mask>", ".", "Duration", ")", "(", "retErr", "error", ")", "{", "logger", ".", "Logf", "(", "\"", "\"", ")", "\n", "defer", "func", "(", "start", "time", ".", "Time", ")", "{", "if", "retErr", "!=", "nil", "{", "logger", ".", "Logf", "(", "\"", "\"", ",", "time", ".", "Since", "(", "start", ")", ",", "retErr", ")", "\n", "}", "else", "{", "logger", ".", "Logf", "(", "\"", "\"", ",", "time", ".", "Since", "(", "start", ")", ")", "\n", "}", "\n", "}", "(", "time", ".", "Now", "(", ")", ")", "\n\n", "cmd", ":=", "exec", ".", "CommandContext", "(", "ctx", ",", "a", ".", "pipelineInfo", ".", "Transform", ".", "ErrCmd", "[", "0", "]", ",", "a", ".", "pipelineInfo", ".", "Transform", ".", "ErrCmd", "[", "1", ":", "]", "...", ")", "\n", "if", "a", ".", "pipelineInfo", ".", "Transform", ".", "ErrStdin", "!=", "nil", "{", "cmd", ".", "Stdin", "=", "strings", ".", "NewReader", "(", "strings", ".", "Join", "(", "a", ".", "pipelineInfo", ".", "Transform", ".", "ErrStdin", ",", "\"", "\\n", "\"", ")", "+", "\"", "\\n", "\"", ")", "\n", "}", "\n", "cmd", ".", "Stdout", "=", "logger", ".", "userLogger", "(", ")", "\n", "cmd", ".", "Stderr", "=", "logger", ".", "userLogger", "(", ")", "\n", "cmd", ".", "Env", "=", "environ", "\n", "if", "a", ".", "uid", "!=", "nil", "&&", "a", ".", "gid", "!=", "nil", "{", "cmd", ".", "SysProcAttr", "=", "&", "syscall", ".", "SysProcAttr", "{", "Credential", ":", "&", "syscall", ".", "Credential", "{", "Uid", ":", "*", "a", ".", "uid", ",", "Gid", ":", "*", "a", ".", "gid", ",", "}", ",", "}", "\n", "}", "\n", "cmd", ".", "Dir", "=", "a", ".", "pipelineInfo", ".", "Transform", ".", "WorkingDir", "\n", "err", ":=", "cmd", ".", "Start", "(", ")", "\n", "if", "err", "!=", "nil", "{", "return", "fmt", ".", "Errorf", "(", "\"", "\"", ",", "err", ")", "\n", "}", "\n", "// A context w a deadline will successfully cancel/kill", "// the running process (minus zombies)", "state", ",", "err", ":=", "cmd", ".", "Process", ".", "Wait", "(", ")", "\n", "if", "err", "!=", "nil", "{", "return", "fmt", ".", "Errorf", "(", "\"", "\"", ",", "err", ")", "\n", "}", "\n", "if", "isDone", "(", "ctx", ")", "{", "if", "err", "=", "ctx", ".", "Err", "(", ")", ";", "err", "!=", "nil", "{", "return", "err", "\n", "}", "\n", "}", "\n", "// Because of this issue: https://github.com/golang/go/issues/18874", "// We forked os/exec so that we can call just the part of cmd.Wait() that", "// happens after blocking on the process. Unfortunately calling", "// cmd.Process.Wait() then cmd.Wait() will produce an error. So instead we", "// close the IO using this helper", "err", "=", "cmd", ".", "WaitIO", "(", "state", ",", "err", ")", "\n", "// We ignore broken pipe errors, these occur very occasionally if a user", "// specifies Stdin but their process doesn't actually read everything from", "// Stdin. This is a fairly common thing to do, bash by default ignores", "// broken pipe errors.", "if", "err", "!=", "nil", "&&", "!", "strings", ".", "Contains", "(", "err", ".", "Error", "(", ")", ",", "\"", "\"", ")", "{", "// (if err is an acceptable return code, don't return err)", "if", "exiterr", ",", "ok", ":=", "err", ".", "(", "*", "exec", ".", "ExitError", ")", ";", "ok", "{", "if", "status", ",", "ok", ":=", "exiterr", ".", "Sys", "(", ")", ".", "(", "syscall", ".", "WaitStatus", ")", ";", "ok", "{", "for", "_", ",", "returnCode", ":=", "range", "a", ".", "pipelineInfo", ".", "Transform", ".", "AcceptReturnCode", "{", "if", "int", "(", "returnCode", ")", "==", "status", ".", "ExitStatus", "(", ")", "{", "return", "nil", "\n", "}", "\n", "}", "\n", "}", "\n", "}", "\n", "return", "fmt", ".", "Errorf", "(", "\"", "\"", ",", "err", ")", "\n", "}", "\n", "return", "nil", "\n", "}" ]
20,428
all-20429
[ "UnmarshalJSON", "implements", "the", "json", ".", "Unmarshaler", "interface", "." ]
[ "func", "(", "pr", "*", "prSignedBaseLayer", ")", "UnmarshalJSON", "(", "data", "[", "]", "byte", ")", "error", "{", "*", "pr", "=", "prSignedBaseLayer", "{", "}", "\n", "var", "tmp", "prSignedBaseLayer", "\n", "<mask>", "baseLayerIdentity", "json", ".", "RawMessage", "\n", "if", "err", ":=", "paranoidUnmarshalJSONObjectExactFields", "(", "data", ",", "map", "[", "string", "]", "interface", "{", "}", "{", "\"", "\"", ":", "&", "tmp", ".", "Type", ",", "\"", "\"", ":", "&", "baseLayerIdentity", ",", "}", ")", ";", "err", "!=", "nil", "{", "return", "err", "\n", "}", "\n\n", "if", "tmp", ".", "Type", "!=", "prTypeSignedBaseLayer", "{", "return", "InvalidPolicyFormatError", "(", "fmt", ".", "Sprintf", "(", "\"", "\\\"", "\\\"", "\"", ",", "tmp", ".", "Type", ")", ")", "\n", "}", "\n", "bli", ",", "err", ":=", "newPolicyReferenceMatchFromJSON", "(", "baseLayerIdentity", ")", "\n", "if", "err", "!=", "nil", "{", "return", "err", "\n", "}", "\n", "res", ",", "err", ":=", "newPRSignedBaseLayer", "(", "bli", ")", "\n", "if", "err", "!=", "nil", "{", "// Coverage: This should never happen, newPolicyReferenceMatchFromJSON has ensured bli is valid.", "return", "err", "\n", "}", "\n", "*", "pr", "=", "*", "res", "\n", "return", "nil", "\n", "}" ]
20,429
all-20430
[ "GetIPV6Addresses", "returns", "a", "list", "of", "ipv6", "addresses", "allocated", "to", "the", "ENI" ]
[ "func", "(", "eni", "*", "ENI", ")", "GetIPV6Addresses", "(", ")", "[", "]", "string", "{", "var", "addresses", "[", "]", "string", "\n", "for", "_", ",", "addr", ":=", "range", "eni", ".", "IPV6Addresses", "{", "addresses", "=", "<mask>", "(", "addresses", ",", "addr", ".", "Address", ")", "\n", "}", "\n\n", "return", "addresses", "\n", "}" ]
20,430
all-20431
[ "Returns", "true", "if", "x", "runes", "would", "fit", "into", "RV", "." ]
[ "func", "(", "w", "*", "SnowballWord", ")", "FitsInRV", "(", "x", "int", ")", "bool", "{", "<mask>", "w", ".", "RVstart", "<=", "len", "(", "w", ".", "RS", ")", "-", "x", "\n", "}" ]
20,431
all-20432
[ "To", "returns", "a", "copy", "of", "MailBuilder", "with", "this", "name", "&", "address", "appended", "to", "the", "To", "header", ".", "name", "may", "be", "empty", "." ]
[ "func", "(", "p", "MailBuilder", ")", "To", "(", "name", ",", "addr", "string", ")", "MailBuilder", "{", "p", ".", "to", "=", "append", "(", "p", ".", "to", ",", "mail", ".", "Address", "{", "Name", ":", "<mask>", ",", "Address", ":", "addr", "}", ")", "\n", "return", "p", "\n", "}" ]
20,432
all-20433
[ "BuildPathHelper", "Builds", "a", "routeHelperfunc", "for", "a", "particular", "RouteInfo" ]
[ "func", "(", "ri", "*", "RouteInfo", ")", "BuildPathHelper", "(", ")", "RouteHelperFunc", "{", "cRoute", ":=", "ri", "\n", "return", "func", "(", "opts", "map", "[", "string", "]", "interface", "{", "}", ")", "(", "template", ".", "HTML", ",", "error", ")", "{", "pairs", ":=", "[", "]", "string", "{", "}", "\n", "for", "k", ",", "v", ":=", "range", "opts", "{", "pairs", "=", "append", "(", "pairs", ",", "k", ")", "\n", "pairs", "=", "append", "(", "pairs", ",", "fmt", ".", "Sprintf", "(", "\"", "\"", ",", "v", ")", ")", "\n", "}", "\n\n", "url", ",", "err", ":=", "cRoute", ".", "MuxRoute", ".", "URL", "(", "pairs", "...", ")", "\n", "if", "err", "!=", "nil", "{", "return", "\"", "\"", ",", "<mask>", ".", "Wrapf", "(", "err", ",", "\"", "\"", ",", "cRoute", ".", "Path", ")", "\n", "}", "\n\n", "result", ":=", "url", ".", "Path", "\n", "result", "=", "addExtraParamsTo", "(", "result", ",", "opts", ")", "\n\n", "return", "template", ".", "HTML", "(", "result", ")", ",", "nil", "\n", "}", "\n", "}" ]
20,433
all-20434
[ "retrieve", "the", "name", "of", "an", "active", "uniform", "block" ]
[ "func", "GetActiveUniformBlockName", "(", "program", "uint32", ",", "uniformBlockIndex", "uint32", ",", "bufSize", "int32", ",", "length", "*", "int32", ",", "uniformBlockName", "*", "uint8", ")", "{", "C", ".", "glowGetActiveUniformBlockName", "(", "gpGetActiveUniformBlockName", ",", "(", "C", ".", "GLuint", ")", "(", "<mask>", ")", ",", "(", "C", ".", "GLuint", ")", "(", "uniformBlockIndex", ")", ",", "(", "C", ".", "GLsizei", ")", "(", "bufSize", ")", ",", "(", "*", "C", ".", "GLsizei", ")", "(", "unsafe", ".", "Pointer", "(", "length", ")", ")", ",", "(", "*", "C", ".", "GLchar", ")", "(", "unsafe", ".", "Pointer", "(", "uniformBlockName", ")", ")", ")", "\n", "}" ]
20,434
all-20435
[ "WaitIO", "is", "a", "helper", "function", "and", "the", "reason", "we", "forked", "this", "package", "from", "stdlib", ".", "This", "way", "we", "can", "manually", "close", "IO", "when", "c", ".", "Process", ".", "Wait", "()", "has", "already", "been", "called", "once" ]
[ "func", "(", "c", "*", "Cmd", ")", "WaitIO", "(", "<mask>", "*", "os", ".", "ProcessState", ",", "err", "error", ")", "(", "retErr", "error", ")", "{", "if", "c", ".", "waitDone", "!=", "nil", "{", "close", "(", "c", ".", "waitDone", ")", "\n", "}", "\n", "c", ".", "ProcessState", "=", "state", "\n", "if", "err", "!=", "nil", "{", "return", "err", "\n", "}", "else", "if", "!", "state", ".", "Success", "(", ")", "{", "return", "&", "ExitError", "{", "ProcessState", ":", "state", "}", "\n", "}", "\n", "for", "range", "c", ".", "goroutine", "{", "if", "err", ":=", "<-", "c", ".", "errch", ";", "err", "!=", "nil", "&&", "retErr", "==", "nil", "{", "retErr", "=", "err", "\n", "}", "\n", "}", "\n", "c", ".", "closeDescriptors", "(", "c", ".", "closeAfterWait", ")", "\n", "return", "retErr", "\n", "}" ]
20,435
all-20436
[ "CanAuthenticate", "makes", "a", "test", "request", "to", "CM", "1", ".", "5", "and", "returns", "true", "if", "it", "is", "successful", "." ]
[ "func", "(", "s", "*", "cookieSigner", ")", "CanAuthenticate", "(", "host", "string", ")", "error", "{", "_", ",", "<mask>", ":=", "s", ".", "builder", ".", "(", "*", "instanceLoginRequestBuilder", ")", "\n", "return", "testAuth", "(", "s", ",", "s", ".", "client", ",", "host", ",", "instance", ")", "\n", "}" ]
20,436
all-20437
[ "Constructs", "a", "*", "TypeInfo", "automatically", "not", "from", "registration", "." ]
[ "func", "(", "cdc", "*", "Codec", ")", "newTypeInfoUnregistered", "(", "rt", "reflect", ".", "Type", ")", "*", "TypeInfo", "{", "if", "rt", ".", "Kind", "(", ")", "==", "reflect", ".", "Ptr", "{", "panic", "(", "\"", "\"", ")", "// should not happen.", "\n", "}", "\n", "if", "rt", ".", "Kind", "(", ")", "==", "reflect", ".", "Interface", "{", "panic", "(", "\"", "\"", ")", "// should not happen.", "\n", "}", "\n\n", "<mask>", "info", "=", "new", "(", "TypeInfo", ")", "\n", "info", ".", "Type", "=", "rt", "\n", "info", ".", "PtrToType", "=", "reflect", ".", "PtrTo", "(", "rt", ")", "\n", "info", ".", "ZeroValue", "=", "reflect", ".", "Zero", "(", "rt", ")", "\n", "info", ".", "ZeroProto", "=", "reflect", ".", "Zero", "(", "rt", ")", ".", "Interface", "(", ")", "\n", "if", "rt", ".", "Kind", "(", ")", "==", "reflect", ".", "Struct", "{", "info", ".", "StructInfo", "=", "cdc", ".", "parseStructInfo", "(", "rt", ")", "\n", "}", "\n", "if", "rm", ",", "ok", ":=", "rt", ".", "MethodByName", "(", "\"", "\"", ")", ";", "ok", "{", "info", ".", "ConcreteInfo", ".", "IsAminoMarshaler", "=", "true", "\n", "info", ".", "ConcreteInfo", ".", "AminoMarshalReprType", "=", "marshalAminoReprType", "(", "rm", ")", "\n", "}", "\n", "if", "rm", ",", "ok", ":=", "reflect", ".", "PtrTo", "(", "rt", ")", ".", "MethodByName", "(", "\"", "\"", ")", ";", "ok", "{", "info", ".", "ConcreteInfo", ".", "IsAminoUnmarshaler", "=", "true", "\n", "info", ".", "ConcreteInfo", ".", "AminoUnmarshalReprType", "=", "unmarshalAminoReprType", "(", "rm", ")", "\n", "}", "\n", "return", "info", "\n", "}" ]
20,437
all-20438
[ "Discrete", "implements", "instruments", ".", "Reporter" ]
[ "func", "(", "r", "*", "Reporter", ")", "Discrete", "(", "name", "string", ",", "tags", "[", "]", "string", ",", "val", "float64", ")", "error", "{", "metricID", ":=", "instruments", ".", "MetricID", "(", "<mask>", ",", "tags", ")", "\n", "r", ".", "refs", "[", "metricID", "]", "=", "2", "\n", "r", ".", "Metric", "(", "name", ",", "tags", ",", "float32", "(", "val", ")", ")", "\n", "return", "nil", "\n", "}" ]
20,438
all-20439
[ "Merge", "will", "fill", "any", "empty", "for", "value", "type", "attributes", "on", "the", "dst", "struct", "using", "corresponding", "src", "attributes", "if", "they", "themselves", "are", "not", "empty", ".", "dst", "and", "src", "must", "be", "valid", "same", "-", "type", "structs", "and", "dst", "must", "be", "a", "pointer", "to", "struct", ".", "It", "won", "t", "merge", "unexported", "(", "private", ")", "fields", "and", "will", "do", "recursively", "any", "exported", "field", "." ]
[ "func", "Merge", "(", "dst", ",", "src", "<mask>", "{", "}", ",", "opts", "...", "func", "(", "*", "Config", ")", ")", "error", "{", "return", "merge", "(", "dst", ",", "src", ",", "opts", "...", ")", "\n", "}" ]
20,439
all-20440
[ "FromRawSeed", "creates", "a", "new", "keypair", "from", "the", "provided", "raw", "ED25519", "seed", ":", "w" ]
[ "func", "FromRawSeed", "(", "rawSeed", "[", "32", "]", "<mask>", ")", "(", "*", "Full", ",", "error", ")", "{", "seed", ",", "err", ":=", "strkey", ".", "Encode", "(", "strkey", ".", "VersionByteSeed", ",", "rawSeed", "[", ":", "]", ")", "\n", "if", "err", "!=", "nil", "{", "return", "nil", ",", "err", "\n", "}", "\n\n", "return", "&", "Full", "{", "seed", "}", ",", "nil", "\n", "}" ]
20,440
all-20441
[ "AssignChildren", "assigns", "the", "list", "of", "given", "child", "Identifiables", "to", "the", "given", "Identifiable", "parent", "in", "the", "server", "." ]
[ "func", "(", "s", "*", "Session", ")", "AssignChildren", "(", "parent", "Identifiable", ",", "children", "[", "]", "Identifiable", ",", "identity", "Identity", ")", "*", "Error", "{", "url", ",", "berr", ":=", "s", ".", "getURLForChildrenIdentity", "(", "parent", ",", "identity", ")", "\n", "if", "berr", "!=", "nil", "{", "return", "berr", "\n", "}", "\n\n", "var", "ids", "[", "]", "string", "\n", "for", "_", ",", "c", ":=", "<mask>", "children", "{", "if", "i", ":=", "c", ".", "Identifier", "(", ")", ";", "i", "!=", "\"", "\"", "{", "ids", "=", "append", "(", "ids", ",", "c", ".", "Identifier", "(", ")", ")", "\n", "}", "else", "{", "return", "NewBambouError", "(", "\"", "\"", ",", "\"", "\"", ")", "\n", "}", "\n", "}", "\n\n", "buffer", ":=", "&", "bytes", ".", "Buffer", "{", "}", "\n", "json", ".", "NewEncoder", "(", "buffer", ")", ".", "Encode", "(", "ids", ")", "\n\n", "request", ",", "err", ":=", "http", ".", "NewRequest", "(", "\"", "\"", ",", "url", ",", "buffer", ")", "\n", "if", "err", "!=", "nil", "{", "return", "NewBambouError", "(", "\"", "\"", ",", "err", ".", "Error", "(", ")", ")", "\n", "}", "\n\n", "response", ",", "berr", ":=", "s", ".", "send", "(", "request", ",", "nil", ")", "\n", "if", "berr", "!=", "nil", "{", "return", "berr", "\n", "}", "\n", "defer", "response", ".", "Body", ".", "Close", "(", ")", "\n\n", "return", "nil", "\n", "}" ]
20,441
all-20442
[ "DeleteCheckoutKey", "fetches", "the", "checkout", "key", "for", "the", "given", "project", "by", "fingerprint" ]
[ "func", "(", "c", "*", "Client", ")", "DeleteCheckoutKey", "(", "account", ",", "repo", ",", "fingerprint", "string", ")", "error", "{", "return", "c", ".", "<mask>", "(", "\"", "\"", ",", "fmt", ".", "Sprintf", "(", "\"", "\"", ",", "account", ",", "repo", ",", "fingerprint", ")", ",", "nil", ",", "nil", ",", "nil", ")", "\n", "}" ]
20,442
all-20443
[ "HasSizing", "returns", "a", "boolean", "if", "a", "field", "has", "been", "set", "." ]
[ "func", "(", "i", "*", "ImageDefinition", ")", "HasSizing", "(", ")", "bool", "{", "if", "i", "!=", "nil", "&&", "i", ".", "Sizing", "!=", "nil", "{", "return", "<mask>", "\n", "}", "\n\n", "return", "false", "\n", "}" ]
20,443
all-20444
[ "Do", "executes", "Overlay", ".", "setShowDebugBorders", "against", "the", "provided", "context", "." ]
[ "func", "(", "p", "*", "SetShowDebugBordersParams", ")", "Do", "(", "ctx", "context", ".", "<mask>", ")", "(", "err", "error", ")", "{", "return", "cdp", ".", "Execute", "(", "ctx", ",", "CommandSetShowDebugBorders", ",", "p", ",", "nil", ")", "\n", "}" ]
20,444
all-20445
[ "IsFatal", "implements", "the", "driver", ".", "Error", "interface", "." ]
[ "func", "(", "e", "*", "hdbErrors", ")", "IsFatal", "(", ")", "bool", "{", "return", "e", ".", "<mask>", "[", "e", ".", "idx", "]", ".", "errorLevel", "==", "errorLevelFatalError", "\n", "}" ]
20,445
all-20446
[ "Offset", "returns", "the", "byte", "offset", "for", "the", "given", "field" ]
[ "func", "(", "t", "*", "Tuple", ")", "Offset", "(", "field", "string", ")", "(", "int", ",", "error", ")", "{", "index", ",", "exists", ":=", "t", ".", "Header", ".", "Type", ".", "Offset", "(", "field", ")", "\n", "if", "!", "exists", "{", "return", "0", ",", "ErrFieldDoesNotExist", "\n", "}", "\n\n", "// Tuple type and tuple header do not agree on fields", "if", "index", "<", "0", "||", "index", ">=", "int", "(", "t", ".", "Header", ".", "FieldCount", ")", "{", "return", "0", ",", "ErrInvalidFieldIndex", "\n", "}", "\n", "return", "int", "(", "t", ".", "Header", ".", "Offsets", "[", "<mask>", "]", ")", ",", "nil", "\n", "}" ]
20,446
all-20447
[ "UnmarshalJSON", "supports", "json", ".", "Unmarshaler", "interface" ]
[ "func", "(", "v", "*", "GetCurrentTimeReturns", ")", "UnmarshalJSON", "(", "<mask>", "[", "]", "byte", ")", "error", "{", "r", ":=", "jlexer", ".", "Lexer", "{", "Data", ":", "data", "}", "\n", "easyjsonC5a4559bDecodeGithubComChromedpCdprotoAnimation11", "(", "&", "r", ",", "v", ")", "\n", "return", "r", ".", "Error", "(", ")", "\n", "}" ]
20,447
all-20448
[ "AppendEntriesPipeline", "returns", "an", "interface", "that", "can", "be", "used", "to", "pipeline", "AppendEntries", "requests", "." ]
[ "func", "(", "t", "*", "transport", ")", "AppendEntriesPipeline", "(", "id", "raft", ".", "ServerID", ",", "target", "raft", ".", "ServerAddress", ")", "(", "raft", ".", "AppendPipeline", ",", "error", ")", "{", "p", ":=", "&", "pipeline", "{", "t", ":", "t", ",", "id", ":", "id", ",", "target", ":", "target", ",", "work", ":", "make", "(", "chan", "*", "appendEntry", ",", "100", ")", ",", "consumer", ":", "make", "(", "chan", "raft", ".", "AppendFuture", ",", "100", ")", ",", "}", "\n", "go", "p", ".", "<mask>", "(", ")", "\n", "return", "p", ",", "nil", "\n", "}" ]
20,448
all-20449
[ "Actual", "returns", "the", "actual", "resource", "group", "in", "Azure", "if", "it", "exists", "." ]
[ "func", "(", "r", "*", "ResourceGroup", ")", "Actual", "(", "immutable", "*", "cluster", ".", "Cluster", ")", "(", "*", "cluster", ".", "Cluster", ",", "cloud", ".", "Resource", ",", "error", ")", "{", "logger", ".", "Debug", "(", "\"", "\"", ")", "\n", "newResource", ":=", "&", "ResourceGroup", "{", "Shared", ":", "Shared", "{", "Name", ":", "r", ".", "Name", ",", "Tags", ":", "r", ".", "Tags", ",", "Identifier", ":", "immutable", ".", "ProviderConfig", "(", ")", ".", "GroupIdentifier", ",", "}", ",", "Location", ":", "r", ".", "Location", ",", "}", "\n\n", "if", "r", ".", "Identifier", "!=", "\"", "\"", "{", "group", ",", "err", ":=", "Sdk", ".", "ResourceGroup", ".", "Get", "(", "immutable", ".", "Name", ")", "\n", "if", "err", "!=", "nil", "{", "return", "nil", ",", "nil", ",", "err", "\n", "}", "\n", "newResource", ".", "<mask>", "=", "*", "group", ".", "Location", "\n", "newResource", ".", "Name", "=", "*", "group", ".", "Name", "\n", "newResource", ".", "Identifier", "=", "*", "group", ".", "ID", "\n", "}", "\n\n", "newCluster", ":=", "r", ".", "immutableRender", "(", "newResource", ",", "immutable", ")", "\n", "return", "newCluster", ",", "newResource", ",", "nil", "\n", "}" ]
20,449
all-20450
[ "synchronizeState", "goes", "through", "all", "the", "containers", "on", "the", "instance", "to", "synchronize", "the", "state", "on", "agent", "start" ]
[ "func", "(", "engine", "*", "DockerStatsEngine", ")", "synchronizeState", "(", ")", "error", "{", "listContainersResponse", ":=", "<mask>", ".", "client", ".", "ListContainers", "(", "engine", ".", "ctx", ",", "false", ",", "dockerclient", ".", "ListContainersTimeout", ")", "\n", "if", "listContainersResponse", ".", "Error", "!=", "nil", "{", "return", "listContainersResponse", ".", "Error", "\n", "}", "\n\n", "for", "_", ",", "containerID", ":=", "range", "listContainersResponse", ".", "DockerIDs", "{", "engine", ".", "addAndStartStatsContainer", "(", "containerID", ")", "\n", "}", "\n", "return", "nil", "\n", "}" ]
20,450
all-20451
[ "MarshalJSON", "supports", "json", ".", "Marshaler", "interface" ]
[ "func", "(", "v", "GetRealtimeDataReturns", ")", "MarshalJSON", "(", ")", "(", "[", "]", "<mask>", ",", "error", ")", "{", "w", ":=", "jwriter", ".", "Writer", "{", "}", "\n", "easyjsonC5a4559bEncodeGithubComChromedpCdprotoWebaudio", "(", "&", "w", ",", "v", ")", "\n", "return", "w", ".", "Buffer", ".", "BuildBytes", "(", ")", ",", "w", ".", "Error", "\n", "}" ]
20,451
all-20452
[ "IsBlocked", "returns", "a", "boolean", "value", "indicating", "whether", "there", "is", "a", "block", "at", "position", "(", "x", "y", ")", "on", "the", "field", "." ]
[ "func", "(", "f", "*", "Field", ")", "IsBlocked", "(", "x", ",", "y", "int", ")", "bool", "{", "if", "x", "<", "0", "||", "fieldBlockNumX", "<=", "x", "{", "return", "true", "\n", "}", "\n", "if", "y", "<", "0", "{", "return", "false", "\n", "}", "\n", "if", "fieldBlockNumY", "<=", "y", "{", "return", "true", "\n", "}", "\n", "return", "f", ".", "<mask>", "[", "x", "]", "[", "y", "]", "!=", "BlockTypeNone", "\n", "}" ]
20,452
all-20453
[ "exprN", "lowers", "a", "multi", "-", "result", "expression", "e", "to", "SSA", "form", "emitting", "code", "to", "fn", "and", "returning", "a", "single", "Value", "whose", "type", "is", "a", "*", "types", ".", "Tuple", ".", "The", "caller", "must", "access", "the", "components", "via", "Extract", ".", "Multi", "-", "result", "expressions", "include", "CallExprs", "in", "a", "multi", "-", "value", "assignment", "or", "return", "statement", "and", "value", "ok", "uses", "of", "TypeAssertExpr", "IndexExpr", "(", "when", "X", "is", "a", "map", ")", "and", "UnaryExpr", "(", "when", "Op", "is", "token", ".", "ARROW", ")", "." ]
[ "func", "(", "b", "*", "builder", ")", "exprN", "(", "fn", "*", "Function", ",", "e", "ast", ".", "Expr", ")", "Value", "{", "typ", ":=", "fn", ".", "Pkg", ".", "typeOf", "(", "e", ")", ".", "(", "*", "types", ".", "Tuple", ")", "\n", "switch", "e", ":=", "e", ".", "(", "type", ")", "{", "case", "*", "ast", ".", "ParenExpr", ":", "return", "b", ".", "exprN", "(", "fn", ",", "e", ".", "X", ")", "\n\n", "case", "*", "ast", ".", "CallExpr", ":", "// Currently, no built-in function nor type conversion", "// has multiple results, so we can avoid some of the", "// cases for single-valued CallExpr.", "var", "c", "Call", "\n", "b", ".", "setCall", "(", "fn", ",", "e", ",", "&", "c", ".", "Call", ")", "\n", "c", ".", "typ", "=", "typ", "\n", "return", "fn", ".", "emit", "(", "&", "c", ")", "\n\n", "case", "*", "ast", ".", "IndexExpr", ":", "mapt", ":=", "fn", ".", "Pkg", ".", "typeOf", "(", "e", ".", "X", ")", ".", "Underlying", "(", ")", ".", "(", "*", "<mask>", ".", "Map", ")", "\n", "lookup", ":=", "&", "Lookup", "{", "X", ":", "b", ".", "expr", "(", "fn", ",", "e", ".", "X", ")", ",", "Index", ":", "emitConv", "(", "fn", ",", "b", ".", "expr", "(", "fn", ",", "e", ".", "Index", ")", ",", "mapt", ".", "Key", "(", ")", ")", ",", "CommaOk", ":", "true", ",", "}", "\n", "lookup", ".", "setType", "(", "typ", ")", "\n", "lookup", ".", "setPos", "(", "e", ".", "Lbrack", ")", "\n", "return", "fn", ".", "emit", "(", "lookup", ")", "\n\n", "case", "*", "ast", ".", "TypeAssertExpr", ":", "return", "emitTypeTest", "(", "fn", ",", "b", ".", "expr", "(", "fn", ",", "e", ".", "X", ")", ",", "typ", ".", "At", "(", "0", ")", ".", "Type", "(", ")", ",", "e", ".", "Lparen", ")", "\n\n", "case", "*", "ast", ".", "UnaryExpr", ":", "// must be receive <-", "unop", ":=", "&", "UnOp", "{", "Op", ":", "token", ".", "ARROW", ",", "X", ":", "b", ".", "expr", "(", "fn", ",", "e", ".", "X", ")", ",", "CommaOk", ":", "true", ",", "}", "\n", "unop", ".", "setType", "(", "typ", ")", "\n", "unop", ".", "setPos", "(", "e", ".", "OpPos", ")", "\n", "return", "fn", ".", "emit", "(", "unop", ")", "\n", "}", "\n", "panic", "(", "fmt", ".", "Sprintf", "(", "\"", "\"", ",", "e", ",", "fn", ")", ")", "\n", "}" ]
20,453
all-20454
[ "IsFailure", "means", "the", "job", "completed", "with", "problems", "." ]
[ "func", "(", "jb", "*", "Build", ")", "IsFailure", "(", ")", "bool", "{", "return", "jb", ".", "Result", "!=", "nil", "&&", "(", "*", "jb", ".", "<mask>", "==", "failure", "||", "*", "jb", ".", "Result", "==", "unstable", ")", "\n", "}" ]
20,454
all-20455
[ "Also", "for", "arrays", ".", "TODO", ":", "Create", "special", "function", "for", "arrays?" ]
[ "func", "copyTableToSlice", "(", "L", "*", "lua", ".", "State", ",", "idx", "int", ",", "v", "reflect", ".", "Value", ",", "visited", "map", "[", "uintptr", "]", "reflect", ".", "Value", ")", "(", "status", "error", ")", "{", "t", ":=", "v", ".", "Type", "(", ")", "\n", "n", ":=", "int", "(", "L", ".", "ObjLen", "(", "idx", ")", ")", "\n\n", "// Adjust the length of the array/slice.", "if", "n", ">", "v", ".", "Len", "(", ")", "{", "if", "t", ".", "Kind", "(", ")", "==", "reflect", ".", "Array", "{", "n", "=", "v", ".", "Len", "(", ")", "\n", "}", "else", "{", "// Slice", "v", ".", "Set", "(", "reflect", ".", "MakeSlice", "(", "t", ",", "n", ",", "n", ")", ")", "\n", "}", "\n", "}", "else", "if", "n", "<", "v", ".", "Len", "(", ")", "{", "if", "t", ".", "Kind", "(", ")", "==", "reflect", ".", "<mask>", "{", "// Nullify remaining elements.", "for", "i", ":=", "n", ";", "i", "<", "v", ".", "Len", "(", ")", ";", "i", "++", "{", "v", ".", "Index", "(", "i", ")", ".", "Set", "(", "reflect", ".", "Zero", "(", "t", ".", "Elem", "(", ")", ")", ")", "\n", "}", "\n", "}", "else", "{", "// Slice", "v", ".", "SetLen", "(", "n", ")", "\n", "}", "\n", "}", "\n\n", "// Do not add empty slices to the list of visited elements.", "// The empty Lua table is a single instance object and gets re-used across maps, slices and others.", "// Arrays cannot be cyclic since the interface type will ask for slices.", "if", "n", ">", "0", "&&", "t", ".", "Kind", "(", ")", "!=", "reflect", ".", "Array", "{", "ptr", ":=", "L", ".", "ToPointer", "(", "idx", ")", "\n", "visited", "[", "ptr", "]", "=", "v", "\n", "}", "\n\n", "te", ":=", "t", ".", "Elem", "(", ")", "\n", "for", "i", ":=", "1", ";", "i", "<=", "n", ";", "i", "++", "{", "L", ".", "RawGeti", "(", "idx", ",", "i", ")", "\n", "val", ":=", "reflect", ".", "New", "(", "te", ")", ".", "Elem", "(", ")", "\n", "err", ":=", "luaToGo", "(", "L", ",", "-", "1", ",", "val", ",", "visited", ")", "\n", "if", "err", "!=", "nil", "{", "status", "=", "ErrTableConv", "\n", "L", ".", "Pop", "(", "1", ")", "\n", "continue", "\n", "}", "\n", "v", ".", "Index", "(", "i", "-", "1", ")", ".", "Set", "(", "val", ")", "\n", "L", ".", "Pop", "(", "1", ")", "\n", "}", "\n\n", "return", "\n", "}" ]
20,455
all-20456
[ "UnmarshalJSON", "supports", "json", ".", "Unmarshaler", "interface" ]
[ "func", "(", "v", "*", "SetBypassCSPParams", ")", "UnmarshalJSON", "(", "<mask>", "[", "]", "byte", ")", "error", "{", "r", ":=", "jlexer", ".", "Lexer", "{", "Data", ":", "data", "}", "\n", "easyjsonC5a4559bDecodeGithubComChromedpCdprotoPage13", "(", "&", "r", ",", "v", ")", "\n", "return", "r", ".", "Error", "(", ")", "\n", "}" ]
20,456
all-20457
[ "Deny", "deny", "permission", "mode", "for", "roles" ]
[ "func", "Deny", "(", "<mask>", "PermissionMode", ",", "roles", "...", "string", ")", "*", "Permission", "{", "return", "Global", ".", "Deny", "(", "mode", ",", "roles", "...", ")", "\n", "}" ]
20,457
all-20458
[ "An", "instance", "will", "report", "in", "by", "giving", "its", "instance", "id", "as", "well", "as", "its", "security", "token", ".", "The", "token", "is", "given", "and", "checked", "to", "ensure", "that", "it", "matches", "a", "real", "token", "that", "exists", "to", "ensure", "that", "random", "machines", "do", "not", "check", "in", ".", "We", "could", "generate", "a", "different", "token", "but", "that", "seems", "like", "overkill", "See", "https", ":", "//", "docs", ".", "taskcluster", ".", "net", "/", "reference", "/", "core", "/", "aws", "-", "provisioner", "/", "api", "-", "docs#instanceStarted" ]
[ "func", "(", "awsProvisioner", "*", "AwsProvisioner", ")", "InstanceStarted", "(", "instanceId", ",", "token", "string", ")", "error", "{", "cd", ":=", "tcclient", ".", "Client", "(", "*", "awsProvisioner", ")", "\n", "_", ",", "_", ",", "err", ":=", "(", "&", "cd", ")", ".", "APICall", "(", "nil", ",", "\"", "\"", ",", "\"", "\"", "+", "<mask>", ".", "QueryEscape", "(", "instanceId", ")", "+", "\"", "\"", "+", "url", ".", "QueryEscape", "(", "token", ")", ",", "nil", ",", "nil", ")", "\n", "return", "err", "\n", "}" ]
20,458
all-20459
[ "When", "the", "request", "entered", "the", "timer", "middleware", "." ]
[ "func", "(", "u", "*", "accessLogUtil", ")", "StartTime", "(", ")", "*", "time", ".", "Time", "{", "if", "u", ".", "R", ".", "Env", "[", "\"", "\"", "]", "!=", "nil", "{", "return", "u", ".", "R", ".", "Env", "[", "\"", "\"", "]", ".", "(", "*", "<mask>", ".", "Time", ")", "\n", "}", "\n", "return", "nil", "\n", "}" ]
20,459
all-20460
[ "vAppSubresourceSchema", "represents", "the", "schema", "for", "the", "vApp", "sub", "-", "resource", ".", "This", "sub", "-", "resource", "allows", "the", "customization", "of", "vApp", "properties", "on", "cloned", "VMs", "." ]
[ "func", "vAppSubresourceSchema", "(", ")", "map", "[", "string", "]", "*", "schema", ".", "Schema", "{", "return", "map", "[", "string", "]", "*", "schema", ".", "Schema", "{", "\"", "\"", ":", "{", "Type", ":", "schema", ".", "TypeMap", ",", "Optional", ":", "true", ",", "<mask>", ":", "\"", "\"", ",", "Elem", ":", "&", "schema", ".", "Schema", "{", "Type", ":", "schema", ".", "TypeString", "}", ",", "}", ",", "}", "\n", "}" ]
20,460
all-20461
[ "UnmarshalJSON", "overrides", "the", "logic", "for", "parsing", "the", "JSON", "-", "encoded", "ContainerStatus", "data" ]
[ "func", "(", "cs", "*", "ContainerStatus", ")", "UnmarshalJSON", "(", "b", "[", "]", "byte", ")", "error", "{", "if", "strings", ".", "ToLower", "(", "string", "(", "b", ")", ")", "==", "\"", "\"", "{", "*", "cs", "=", "ContainerStatusNone", "\n", "return", "nil", "\n", "}", "\n", "if", "b", "[", "0", "]", "!=", "'\"'", "||", "b", "[", "len", "(", "b", ")", "-", "1", "]", "!=", "'\"'", "{", "*", "cs", "=", "ContainerStatusNone", "\n", "return", "errors", ".", "New", "(", "\"", "\"", "+", "string", "(", "b", ")", ")", "\n", "}", "\n", "strStatus", ":=", "string", "(", "b", "[", "1", ":", "len", "(", "b", ")", "-", "1", "]", ")", "\n", "// 'UNKNOWN' and 'DEAD' for Compatibility with v1.0.0 state files", "if", "strStatus", "==", "\"", "\"", "{", "*", "cs", "=", "ContainerStatusNone", "\n", "return", "nil", "\n", "}", "\n", "if", "strStatus", "==", "\"", "\"", "{", "*", "cs", "=", "ContainerStopped", "\n", "return", "nil", "\n", "}", "\n\n", "stat", ",", "<mask>", ":=", "containerStatusMap", "[", "strStatus", "]", "\n", "if", "!", "ok", "{", "*", "cs", "=", "ContainerStatusNone", "\n", "return", "errors", ".", "New", "(", "\"", "\"", ")", "\n", "}", "\n", "*", "cs", "=", "stat", "\n", "return", "nil", "\n", "}" ]
20,461
all-20462
[ "LayerInfosForCopy", "()", "returns", "the", "list", "of", "layer", "blobs", "that", "make", "up", "the", "root", "filesystem", "of", "the", "image", "after", "they", "ve", "been", "decompressed", "." ]
[ "func", "(", "s", "*", "storageImageSource", ")", "LayerInfosForCopy", "(", "ctx", "context", ".", "Context", ")", "(", "[", "]", "types", ".", "BlobInfo", ",", "error", ")", "{", "manifestBlob", ",", "manifestType", ",", "err", ":=", "s", ".", "GetManifest", "(", "ctx", ",", "nil", ")", "\n", "if", "err", "!=", "nil", "{", "return", "nil", ",", "errors", ".", "Wrapf", "(", "err", ",", "\"", "\"", ",", "s", ".", "image", ".", "ID", ")", "\n", "}", "\n", "man", ",", "err", ":=", "manifest", ".", "FromBlob", "(", "manifestBlob", ",", "manifestType", ")", "\n", "if", "err", "!=", "nil", "{", "return", "nil", ",", "errors", ".", "Wrapf", "(", "err", ",", "\"", "\"", ",", "s", ".", "image", ".", "ID", ")", "\n", "}", "\n\n", "uncompressedLayerType", ":=", "\"", "\"", "\n", "switch", "manifestType", "{", "case", "imgspecv1", ".", "MediaTypeImageManifest", ":", "uncompressedLayerType", "=", "imgspecv1", ".", "MediaTypeImageLayer", "\n", "case", "manifest", ".", "DockerV2Schema1MediaType", ",", "manifest", ".", "DockerV2Schema1SignedMediaType", ",", "manifest", ".", "DockerV2Schema2MediaType", ":", "// This is actually a compressed type, but there's no uncompressed type defined", "uncompressedLayerType", "=", "manifest", ".", "DockerV2Schema2LayerMediaType", "\n", "}", "\n\n", "physicalBlobInfos", ":=", "[", "]", "types", ".", "BlobInfo", "{", "}", "\n", "layerID", ":=", "s", ".", "image", ".", "TopLayer", "\n", "for", "layerID", "!=", "\"", "\"", "{", "layer", ",", "err", ":=", "s", ".", "imageRef", ".", "transport", ".", "store", ".", "Layer", "(", "layerID", ")", "\n", "if", "err", "!=", "nil", "{", "return", "nil", ",", "errors", ".", "Wrapf", "(", "err", ",", "\"", "\"", ",", "layerID", ",", "s", ".", "image", ".", "ID", ")", "\n", "}", "\n", "if", "layer", ".", "UncompressedDigest", "==", "\"", "\"", "{", "return", "nil", ",", "errors", ".", "Errorf", "(", "\"", "\"", ",", "layerID", ")", "\n", "}", "\n", "if", "layer", ".", "UncompressedSize", "<", "0", "{", "return", "nil", ",", "<mask>", ".", "Errorf", "(", "\"", "\"", ",", "layerID", ")", "\n", "}", "\n", "blobInfo", ":=", "types", ".", "BlobInfo", "{", "Digest", ":", "layer", ".", "UncompressedDigest", ",", "Size", ":", "layer", ".", "UncompressedSize", ",", "MediaType", ":", "uncompressedLayerType", ",", "}", "\n", "physicalBlobInfos", "=", "append", "(", "[", "]", "types", ".", "BlobInfo", "{", "blobInfo", "}", ",", "physicalBlobInfos", "...", ")", "\n", "layerID", "=", "layer", ".", "Parent", "\n", "}", "\n\n", "res", ",", "err", ":=", "buildLayerInfosForCopy", "(", "man", ".", "LayerInfos", "(", ")", ",", "physicalBlobInfos", ")", "\n", "if", "err", "!=", "nil", "{", "return", "nil", ",", "errors", ".", "Wrapf", "(", "err", ",", "\"", "\"", ",", "s", ".", "image", ".", "ID", ")", "\n", "}", "\n", "return", "res", ",", "nil", "\n", "}" ]
20,462
all-20463
[ "get", "IP", "type", "and", "calculate", "IP", "number", ";", "calculates", "index", "too", "if", "exists" ]
[ "func", "checkip", "(", "ip", "string", ")", "(", "iptype", "uint32", ",", "ipnum", "*", "big", ".", "Int", ",", "ipindex", "uint32", ")", "{", "iptype", "=", "0", "\n", "ipnum", "=", "big", ".", "NewInt", "(", "0", ")", "\n", "ipnumtmp", ":=", "big", ".", "NewInt", "(", "0", ")", "\n", "ipindex", "=", "0", "\n", "ipaddress", ":=", "<mask>", ".", "ParseIP", "(", "ip", ")", "\n", "if", "ipaddress", "!=", "nil", "{", "v4", ":=", "ipaddress", ".", "To4", "(", ")", "\n", "if", "v4", "!=", "nil", "{", "iptype", "=", "4", "\n", "ipnum", ".", "SetBytes", "(", "v4", ")", "\n", "}", "else", "{", "v6", ":=", "ipaddress", ".", "To16", "(", ")", "\n", "if", "v6", "!=", "nil", "{", "iptype", "=", "6", "\n", "ipnum", ".", "SetBytes", "(", "v6", ")", "\n", "}", "\n", "}", "\n", "}", "\n", "if", "iptype", "==", "4", "{", "if", "meta", ".", "ipv4indexbaseaddr", ">", "0", "{", "ipnumtmp", ".", "Rsh", "(", "ipnum", ",", "16", ")", "\n", "ipnumtmp", ".", "Lsh", "(", "ipnumtmp", ",", "3", ")", "\n", "ipindex", "=", "uint32", "(", "ipnumtmp", ".", "Add", "(", "ipnumtmp", ",", "big", ".", "NewInt", "(", "int64", "(", "meta", ".", "ipv4indexbaseaddr", ")", ")", ")", ".", "Uint64", "(", ")", ")", "\n", "}", "\n", "}", "else", "if", "iptype", "==", "6", "{", "if", "meta", ".", "ipv6indexbaseaddr", ">", "0", "{", "ipnumtmp", ".", "Rsh", "(", "ipnum", ",", "112", ")", "\n", "ipnumtmp", ".", "Lsh", "(", "ipnumtmp", ",", "3", ")", "\n", "ipindex", "=", "uint32", "(", "ipnumtmp", ".", "Add", "(", "ipnumtmp", ",", "big", ".", "NewInt", "(", "int64", "(", "meta", ".", "ipv6indexbaseaddr", ")", ")", ")", ".", "Uint64", "(", ")", ")", "\n", "}", "\n", "}", "\n", "return", "\n", "}" ]
20,463
all-20464
[ "New", "generates", "a", "new", "AccessToken", "with", "the", "specified", "properties", ".", "identity", "is", "a", "unique", "ID", "for", "a", "particular", "user", ".", "To", "generate", "an", "apiKey", "and", "apiSecret", "follow", "this", "instructions", ":", "https", ":", "//", "www", ".", "twilio", ".", "com", "/", "docs", "/", "api", "/", "rest", "/", "access", "-", "tokens#jwt", "-", "format" ]
[ "func", "New", "(", "accountSid", ",", "apiKey", ",", "apiSecret", ",", "identity", "string", ",", "ttl", "time", ".", "Duration", ")", "*", "AccessToken", "{", "return", "&", "AccessToken", "{", "accountSid", ":", "accountSid", ",", "apiKey", ":", "apiKey", ",", "apiSecret", ":", "[", "]", "byte", "(", "apiSecret", ")", ",", "identity", ":", "identity", ",", "ttl", ":", "ttl", ",", "grants", ":", "make", "(", "map", "[", "string", "]", "<mask>", "{", "}", ")", ",", "}", "\n", "}" ]
20,464
all-20465
[ "Next", "advances", "the", "parser", "to", "the", "next", "sample", ".", "It", "returns", "false", "if", "no", "more", "samples", "were", "read", "or", "an", "error", "occurred", "." ]
[ "func", "(", "p", "*", "PromParser", ")", "Next", "(", ")", "(", "Entry", ",", "error", ")", "{", "var", "err", "error", "\n\n", "p", ".", "start", "=", "p", ".", "l", ".", "i", "\n", "p", ".", "offsets", "=", "p", ".", "offsets", "[", ":", "0", "]", "\n\n", "switch", "t", ":=", "p", ".", "nextToken", "(", ")", ";", "t", "{", "case", "tEOF", ":", "return", "EntryInvalid", ",", "io", ".", "EOF", "\n", "case", "tLinebreak", ":", "// Allow full blank lines.", "return", "p", ".", "Next", "(", ")", "\n\n", "case", "tHelp", ",", "tType", ":", "switch", "t", ":=", "p", ".", "nextToken", "(", ")", ";", "t", "{", "case", "tMName", ":", "p", ".", "offsets", "=", "append", "(", "p", ".", "offsets", ",", "p", ".", "l", ".", "start", ",", "p", ".", "l", ".", "i", ")", "\n", "default", ":", "return", "EntryInvalid", ",", "parseError", "(", "\"", "\"", ",", "t", ")", "\n", "}", "\n", "switch", "t", ":=", "p", ".", "nextToken", "(", ")", ";", "t", "{", "case", "tText", ":", "if", "len", "(", "p", ".", "l", ".", "buf", "(", ")", ")", ">", "1", "{", "p", ".", "text", "=", "p", ".", "l", ".", "buf", "(", ")", "[", "1", ":", "]", "\n", "}", "else", "{", "p", ".", "text", "=", "[", "]", "byte", "{", "}", "\n", "}", "\n", "default", ":", "return", "EntryInvalid", ",", "parseError", "(", "\"", "\"", ",", "t", ")", "\n", "}", "\n", "switch", "t", "{", "<mask>", "tType", ":", "switch", "s", ":=", "yoloString", "(", "p", ".", "text", ")", ";", "s", "{", "case", "\"", "\"", ":", "p", ".", "mtype", "=", "MetricTypeCounter", "\n", "case", "\"", "\"", ":", "p", ".", "mtype", "=", "MetricTypeGauge", "\n", "case", "\"", "\"", ":", "p", ".", "mtype", "=", "MetricTypeHistogram", "\n", "case", "\"", "\"", ":", "p", ".", "mtype", "=", "MetricTypeSummary", "\n", "case", "\"", "\"", ":", "p", ".", "mtype", "=", "MetricTypeUnknown", "\n", "default", ":", "return", "EntryInvalid", ",", "errors", ".", "Errorf", "(", "\"", "\"", ",", "s", ")", "\n", "}", "\n", "case", "tHelp", ":", "if", "!", "utf8", ".", "Valid", "(", "p", ".", "text", ")", "{", "return", "EntryInvalid", ",", "errors", ".", "Errorf", "(", "\"", "\"", ")", "\n", "}", "\n", "}", "\n", "if", "t", ":=", "p", ".", "nextToken", "(", ")", ";", "t", "!=", "tLinebreak", "{", "return", "EntryInvalid", ",", "parseError", "(", "\"", "\"", ",", "t", ")", "\n", "}", "\n", "switch", "t", "{", "case", "tHelp", ":", "return", "EntryHelp", ",", "nil", "\n", "case", "tType", ":", "return", "EntryType", ",", "nil", "\n", "}", "\n", "case", "tComment", ":", "p", ".", "text", "=", "p", ".", "l", ".", "buf", "(", ")", "\n", "if", "t", ":=", "p", ".", "nextToken", "(", ")", ";", "t", "!=", "tLinebreak", "{", "return", "EntryInvalid", ",", "parseError", "(", "\"", "\"", ",", "t", ")", "\n", "}", "\n", "return", "EntryComment", ",", "nil", "\n\n", "case", "tMName", ":", "p", ".", "offsets", "=", "append", "(", "p", ".", "offsets", ",", "p", ".", "l", ".", "i", ")", "\n", "p", ".", "series", "=", "p", ".", "l", ".", "b", "[", "p", ".", "start", ":", "p", ".", "l", ".", "i", "]", "\n\n", "t2", ":=", "p", ".", "nextToken", "(", ")", "\n", "if", "t2", "==", "tBraceOpen", "{", "if", "err", ":=", "p", ".", "parseLVals", "(", ")", ";", "err", "!=", "nil", "{", "return", "EntryInvalid", ",", "err", "\n", "}", "\n", "p", ".", "series", "=", "p", ".", "l", ".", "b", "[", "p", ".", "start", ":", "p", ".", "l", ".", "i", "]", "\n", "t2", "=", "p", ".", "nextToken", "(", ")", "\n", "}", "\n", "if", "t2", "!=", "tValue", "{", "return", "EntryInvalid", ",", "parseError", "(", "\"", "\"", ",", "t", ")", "\n", "}", "\n", "if", "p", ".", "val", ",", "err", "=", "strconv", ".", "ParseFloat", "(", "yoloString", "(", "p", ".", "l", ".", "buf", "(", ")", ")", ",", "64", ")", ";", "err", "!=", "nil", "{", "return", "EntryInvalid", ",", "err", "\n", "}", "\n", "// Ensure canonical NaN value.", "if", "math", ".", "IsNaN", "(", "p", ".", "val", ")", "{", "p", ".", "val", "=", "math", ".", "Float64frombits", "(", "value", ".", "NormalNaN", ")", "\n", "}", "\n", "p", ".", "hasTS", "=", "false", "\n", "switch", "p", ".", "nextToken", "(", ")", "{", "case", "tLinebreak", ":", "break", "\n", "case", "tTimestamp", ":", "p", ".", "hasTS", "=", "true", "\n", "if", "p", ".", "ts", ",", "err", "=", "strconv", ".", "ParseInt", "(", "yoloString", "(", "p", ".", "l", ".", "buf", "(", ")", ")", ",", "10", ",", "64", ")", ";", "err", "!=", "nil", "{", "return", "EntryInvalid", ",", "err", "\n", "}", "\n", "if", "t2", ":=", "p", ".", "nextToken", "(", ")", ";", "t2", "!=", "tLinebreak", "{", "return", "EntryInvalid", ",", "parseError", "(", "\"", "\"", ",", "t", ")", "\n", "}", "\n", "default", ":", "return", "EntryInvalid", ",", "parseError", "(", "\"", "\"", ",", "t", ")", "\n", "}", "\n", "return", "EntrySeries", ",", "nil", "\n\n", "default", ":", "err", "=", "errors", ".", "Errorf", "(", "\"", "\"", ",", "t", ")", "\n", "}", "\n", "return", "EntryInvalid", ",", "err", "\n", "}" ]
20,465
all-20466
[ "Handle", "the", "transition", "between", "net", "/", "http", "and", "go", "-", "json", "-", "rest", "objects", ".", "It", "intanciates", "the", "rest", ".", "Request", "and", "rest", ".", "ResponseWriter", "..." ]
[ "func", "adapterFunc", "(", "handler", "HandlerFunc", ")", "http", ".", "HandlerFunc", "{", "return", "func", "(", "origWriter", "http", ".", "ResponseWriter", ",", "origRequest", "*", "http", ".", "<mask>", ")", "{", "// instantiate the rest objects", "request", ":=", "&", "Request", "{", "origRequest", ",", "nil", ",", "map", "[", "string", "]", "interface", "{", "}", "{", "}", ",", "}", "\n\n", "writer", ":=", "&", "responseWriter", "{", "origWriter", ",", "false", ",", "}", "\n\n", "// call the wrapped handler", "handler", "(", "writer", ",", "request", ")", "\n", "}", "\n", "}" ]
20,466
all-20467
[ "RequireHTTPMethods", "wraps", "a", "given", "handler", "function", "inside", "an", "HTTP", "method", "validating", "handler", "." ]
[ "func", "(", "s", "*", "Server", ")", "RequireHTTPMethods", "(", "logger", "log", ".", "Logger", ",", "handler", "HandlerFunc", ",", "methods", "...", "string", ")", "HandlerFunc", "{", "l", ":=", "logger", ".", "Add", "(", "\"", "\"", ",", "\"", "\"", ")", "\n", "return", "func", "(", "w", "http", ".", "ResponseWriter", ",", "r", "*", "<mask>", ".", "Request", ",", "ctx", "*", "Context", ")", "{", "for", "_", ",", "v", ":=", "range", "methods", "{", "if", "v", "==", "r", ".", "Method", "{", "handler", "(", "w", ",", "r", ",", "ctx", ")", "\n", "return", "\n", "}", "\n", "}", "\n\n", "l", ".", "Add", "(", "\"", "\"", ",", "r", ".", "RemoteAddr", ")", ".", "Warn", "(", "\"", "\"", ")", "\n", "s", ".", "RespondError", "(", "logger", ",", "w", ",", "ErrMethodNotAllowed", ")", "\n", "}", "\n", "}" ]
20,467
all-20468
[ "See", "bcd", ".", "Tracer", ".", "AddFaultedThread", "()", "." ]
[ "func", "(", "t", "*", "BTTracer", ")", "AddFaultedThread", "(", "options", "[", "]", "string", ",", "tid", "int", ")", "[", "]", "string", "{", "return", "t", ".", "AddOptions", "(", "<mask>", ",", "\"", "\"", ",", "strconv", ".", "Itoa", "(", "tid", ")", ")", "\n", "}" ]
20,468
all-20469
[ "UnmarshalJSON", "supports", "json", ".", "Unmarshaler", "interface" ]
[ "func", "(", "v", "*", "TraceConfig", ")", "UnmarshalJSON", "(", "data", "[", "]", "byte", ")", "error", "{", "r", ":=", "jlexer", ".", "Lexer", "{", "Data", ":", "data", "}", "\n", "easyjsonC5a4559bDecodeGithubComChromedpCdprotoTracing", "(", "&", "r", ",", "v", ")", "\n", "return", "r", ".", "<mask>", "(", ")", "\n", "}" ]
20,469
all-20470
[ "newApplySource", "will", "create", "a", "new", "source", "any", "source", "created", "with", "the", "same", "seed", "will", "generate", "the", "same", "sequence", "of", "data", "." ]
[ "func", "newApplySource", "(", "<mask>", "string", ")", "*", "applySource", "{", "h", ":=", "fnv", ".", "New32", "(", ")", "\n", "h", ".", "Write", "(", "[", "]", "byte", "(", "seed", ")", ")", "\n", "s", ":=", "&", "applySource", "{", "seed", ":", "int64", "(", "h", ".", "Sum32", "(", ")", ")", "}", "\n", "s", ".", "reset", "(", ")", "\n", "return", "s", "\n", "}" ]
20,470
all-20471
[ "Cast", "the", "region", "to", "the", "given", "type", "." ]
[ "func", "(", "r", "<mask>", ")", "Cast", "(", "typ", "string", ")", "region", "{", "return", "region", "{", "p", ":", "r", ".", "p", ",", "a", ":", "r", ".", "a", ",", "typ", ":", "r", ".", "p", ".", "findType", "(", "typ", ")", "}", "\n", "}" ]
20,471
all-20472
[ "computeID", "computes", "a", "recommended", "image", "ID", "based", "on", "information", "we", "have", "so", "far", ".", "If", "the", "manifest", "is", "not", "of", "a", "type", "that", "we", "recognize", "we", "return", "an", "empty", "value", "indicating", "that", "since", "we", "don", "t", "have", "a", "recommendation", "a", "random", "ID", "should", "be", "used", "if", "one", "needs", "to", "be", "allocated", "." ]
[ "func", "(", "s", "*", "storageImageDestination", ")", "computeID", "(", "m", "manifest", ".", "Manifest", ")", "string", "{", "// Build the diffID list. We need the decompressed sums that we've been calculating to", "// fill in the DiffIDs. It's expected (but not enforced by us) that the number of", "// diffIDs corresponds to the number of non-EmptyLayer entries in the history.", "var", "diffIDs", "[", "]", "digest", ".", "Digest", "\n", "switch", "m", ":=", "m", ".", "(", "type", ")", "{", "case", "*", "manifest", ".", "Schema1", ":", "// Build a list of the diffIDs we've generated for the non-throwaway FS layers,", "// in reverse of the order in which they were originally listed.", "for", "i", ",", "compat", ":=", "range", "m", ".", "ExtractedV1Compatibility", "{", "if", "compat", ".", "ThrowAway", "{", "continue", "\n", "}", "\n", "blobSum", ":=", "m", ".", "FSLayers", "[", "i", "]", ".", "BlobSum", "\n", "diffID", ",", "ok", ":=", "s", ".", "blobDiffIDs", "[", "blobSum", "]", "\n", "if", "!", "ok", "{", "logrus", ".", "Infof", "(", "\"", "\"", ",", "blobSum", ".", "String", "(", ")", ")", "\n", "return", "\"", "\"", "\n", "}", "\n", "diffIDs", "=", "<mask>", "(", "[", "]", "digest", ".", "Digest", "{", "diffID", "}", ",", "diffIDs", "...", ")", "\n", "}", "\n", "case", "*", "manifest", ".", "Schema2", ",", "*", "manifest", ".", "OCI1", ":", "// We know the ID calculation for these formats doesn't actually use the diffIDs,", "// so we don't need to populate the diffID list.", "default", ":", "return", "\"", "\"", "\n", "}", "\n", "id", ",", "err", ":=", "m", ".", "ImageID", "(", "diffIDs", ")", "\n", "if", "err", "!=", "nil", "{", "return", "\"", "\"", "\n", "}", "\n", "return", "id", "\n", "}" ]
20,472
all-20473
[ "WithKey", "unique", "DOM", "defined", "string", "value", "describing", "the", "meaning", "of", "the", "key", "in", "the", "context", "of", "active", "modifiers", "keyboard", "layout", "etc", "(", "e", ".", "g", ".", "AltGr", ")", "(", "default", ":", ")", "." ]
[ "func", "(", "p", "DispatchKeyEventParams", ")", "WithKey", "(", "<mask>", "string", ")", "*", "DispatchKeyEventParams", "{", "p", ".", "Key", "=", "key", "\n", "return", "&", "p", "\n", "}" ]
20,473
all-20474
[ "ages", "return", "the", "age", "of", "each", "active", "states" ]
[ "func", "(", "b", "BundledStates", ")", "ages", "(", "t", "time", ".", "Time", ")", "map", "[", "string", "]", "time", ".", "Duration", "{", "ages", ":=", "map", "[", "string", "]", "time", ".", "Duration", "{", "}", "\n\n", "for", "id", ",", "state", ":=", "range", "b", ".", "states", "{", "if", "!", "state", ".", "Active", "(", ")", "{", "continue", "\n", "}", "\n", "ages", "[", "<mask>", "]", "=", "state", ".", "Age", "(", "t", ")", "\n", "}", "\n", "return", "ages", "\n", "}" ]
20,474
all-20475
[ "GetEventSizeOk", "returns", "a", "tuple", "with", "the", "EventSize", "field", "if", "it", "s", "non", "-", "nil", "zero", "value", "otherwise", "and", "a", "boolean", "to", "check", "if", "the", "value", "has", "been", "set", "." ]
[ "func", "(", "e", "*", "EventStreamDefinition", ")", "GetEventSizeOk", "(", ")", "(", "string", ",", "bool", ")", "{", "if", "e", "==", "nil", "||", "e", ".", "EventSize", "==", "nil", "{", "return", "\"", "\"", ",", "false", "\n", "}", "\n", "return", "*", "e", ".", "EventSize", ",", "<mask>", "\n", "}" ]
20,475
all-20476
[ "openSnapshotBackend", "renames", "a", "snapshot", "db", "to", "the", "current", "etcd", "db", "and", "opens", "it", "." ]
[ "func", "openSnapshotBackend", "(", "cfg", "ServerConfig", ",", "ss", "*", "snap", ".", "Snapshotter", ",", "snapshot", "raftpb", ".", "Snapshot", ")", "(", "backend", ".", "Backend", ",", "error", ")", "{", "snapPath", ",", "err", ":=", "<mask>", ".", "DBFilePath", "(", "snapshot", ".", "Metadata", ".", "Index", ")", "\n", "if", "err", "!=", "nil", "{", "return", "nil", ",", "fmt", ".", "Errorf", "(", "\"", "\"", ",", "err", ")", "\n", "}", "\n", "if", "err", ":=", "os", ".", "Rename", "(", "snapPath", ",", "cfg", ".", "backendPath", "(", ")", ")", ";", "err", "!=", "nil", "{", "return", "nil", ",", "fmt", ".", "Errorf", "(", "\"", "\"", ",", "err", ")", "\n", "}", "\n", "return", "openBackend", "(", "cfg", ")", ",", "nil", "\n", "}" ]
20,476
all-20477
[ "hardStopPipeline", "does", "essentially", "the", "same", "thing", "as", "StopPipeline", "(", "deletes", "the", "pipeline", "s", "branch", "provenance", "deletes", "any", "open", "commits", "deletes", "any", "k8s", "workers", ")", "but", "does", "it", "immediately", ".", "This", "is", "to", "avoid", "races", "between", "operations", "that", "will", "do", "subsequent", "work", "(", "e", ".", "g", ".", "UpdatePipeline", "and", "DeletePipeline", ")", "and", "the", "PPS", "master" ]
[ "func", "(", "a", "*", "apiServer", ")", "hardStopPipeline", "(", "pachClient", "*", "client", ".", "APIClient", ",", "pipelineInfo", "*", "pps", ".", "PipelineInfo", ")", "error", "{", "// Remove the output branch's provenance so that no new jobs can be created", "if", "err", ":=", "pachClient", ".", "CreateBranch", "(", "pipelineInfo", ".", "Pipeline", ".", "Name", ",", "pipelineInfo", ".", "OutputBranch", ",", "pipelineInfo", ".", "OutputBranch", ",", "nil", ",", ")", ";", "err", "!=", "nil", "&&", "!", "isNotFoundErr", "(", "err", ")", "{", "return", "fmt", ".", "Errorf", "(", "\"", "\"", ",", "err", ")", "\n", "}", "\n\n", "// Now that new commits won't be created on the master branch, enumerate", "// existing commits and close any open ones.", "iter", ",", "err", ":=", "pachClient", ".", "ListCommitStream", "(", "pachClient", ".", "Ctx", "(", ")", ",", "&", "pfs", ".", "ListCommitRequest", "{", "Repo", ":", "client", ".", "NewRepo", "(", "pipelineInfo", ".", "Pipeline", ".", "Name", ")", ",", "To", ":", "client", ".", "NewCommit", "(", "pipelineInfo", ".", "Pipeline", ".", "Name", ",", "pipelineInfo", ".", "OutputBranch", ")", ",", "}", ")", "\n", "if", "err", "!=", "nil", "{", "return", "fmt", ".", "Errorf", "(", "\"", "\"", ",", "pipelineInfo", ".", "OutputBranch", ",", "err", ")", "\n", "}", "\n", "// Finish all open commits, most recent first (so that we finish the", "// current job's output commit--the oldest--last, and unblock the master", "// only after all other commits are also finished, preventing any new jobs)", "for", "{", "ci", ",", "err", ":=", "iter", ".", "Recv", "(", ")", "\n", "if", "err", "==", "<mask>", ".", "EOF", "{", "break", "\n", "}", "else", "if", "err", "!=", "nil", "{", "return", "err", "\n", "}", "\n", "if", "ci", ".", "Finished", "==", "nil", "{", "// Finish the commit and don't pass a tree", "pachClient", ".", "PfsAPIClient", ".", "FinishCommit", "(", "pachClient", ".", "Ctx", "(", ")", ",", "&", "pfs", ".", "FinishCommitRequest", "{", "Commit", ":", "ci", ".", "Commit", ",", "Empty", ":", "true", ",", "}", ")", "\n", "}", "\n", "}", "\n", "return", "nil", "\n", "}" ]
20,477
all-20478
[ "EndUserLocator", "builds", "a", "locator", "from", "the", "given", "href", "." ]
[ "func", "(", "api", "*", "API", ")", "EndUserLocator", "(", "href", "<mask>", ")", "*", "EndUserLocator", "{", "return", "&", "EndUserLocator", "{", "Href", "(", "href", ")", ",", "api", "}", "\n", "}" ]
20,478
all-20479
[ "GenerateRandomBytes", "..." ]
[ "func", "GenerateRandomBytes", "(", "length", "int", ")", "(", "[", "]", "byte", ",", "error", ")", "{", "b", ":=", "make", "(", "[", "]", "byte", ",", "length", ")", "\n\n", "_", ",", "err", ":=", "<mask>", ".", "Read", "(", "b", ")", "\n\n", "return", "b", ",", "err", "\n", "}" ]
20,479
all-20480
[ "NewReader", "returns", "a", "new", "LZ4", "frame", "decoder", ".", "No", "access", "to", "the", "underlying", "io", ".", "Reader", "is", "performed", "." ]
[ "func", "NewReader", "(", "src", "<mask>", ".", "Reader", ")", "*", "Reader", "{", "r", ":=", "&", "Reader", "{", "src", ":", "src", "}", "\n", "return", "r", "\n", "}" ]
20,480
all-20481
[ "Stop", "-", "signal", "for", "the", "service", "to", "stop", "serving" ]
[ "func", "(", "server", "*", "Server", ")", "Stop", "(", ")", "{", "service", ":=", "server", ".", "service", "\n", "if", "service", ".", "<mask>", "{", "service", ".", "wg", ".", "Done", "(", ")", "\n", "service", ".", "started", "=", "false", "\n", "}", "\n", "}" ]
20,481
all-20482
[ "MarshalJSON", "supports", "json", ".", "Marshaler", "interface" ]
[ "func", "(", "v", "EventPseudoElementRemoved", ")", "MarshalJSON", "(", ")", "(", "[", "]", "<mask>", ",", "error", ")", "{", "w", ":=", "jwriter", ".", "Writer", "{", "}", "\n", "easyjsonC5a4559bEncodeGithubComChromedpCdprotoDom58", "(", "&", "w", ",", "v", ")", "\n", "return", "w", ".", "Buffer", ".", "BuildBytes", "(", ")", ",", "w", ".", "Error", "\n", "}" ]
20,482
all-20483
[ "title", ":", "rollback", "platform", "path", ":", "/", "platforms", "/", "{", "name", "}", "/", "rollback", "method", ":", "POST", "produce", ":", "application", "/", "x", "-", "json", "-", "stream", "responses", ":", "200", ":", "OK", "400", ":", "BadRequest", "401", ":", "Unauthorized", "404", ":", "Not", "found" ]
[ "func", "platformRollback", "(", "w", "http", ".", "ResponseWriter", ",", "r", "*", "http", ".", "Request", ",", "t", "auth", ".", "Token", ")", "(", "err", "error", ")", "{", "name", ":=", "r", ".", "URL", ".", "Query", "(", ")", ".", "Get", "(", "\"", "\"", ")", "\n", "image", ":=", "InputValue", "(", "r", ",", "\"", "\"", ")", "\n", "if", "image", "==", "\"", "\"", "{", "return", "&", "tErrors", ".", "HTTP", "{", "Code", ":", "http", ".", "StatusBadRequest", ",", "Message", ":", "\"", "\"", ",", "}", "\n", "}", "\n", "canUpdatePlatform", ":=", "permission", ".", "Check", "(", "t", ",", "permission", ".", "PermPlatformUpdate", ")", "\n", "if", "!", "canUpdatePlatform", "{", "return", "permission", ".", "ErrUnauthorized", "\n", "}", "\n", "w", ".", "Header", "(", ")", ".", "<mask>", "(", "\"", "\"", ",", "\"", "\"", ")", "\n", "keepAliveWriter", ":=", "io", ".", "NewKeepAliveWriter", "(", "w", ",", "30", "*", "time", ".", "Second", ",", "\"", "\"", ")", "\n", "defer", "keepAliveWriter", ".", "Stop", "(", ")", "\n", "writer", ":=", "&", "io", ".", "SimpleJsonMessageEncoderWriter", "{", "Encoder", ":", "json", ".", "NewEncoder", "(", "keepAliveWriter", ")", "}", "\n", "evt", ",", "err", ":=", "event", ".", "New", "(", "&", "event", ".", "Opts", "{", "Target", ":", "event", ".", "Target", "{", "Type", ":", "event", ".", "TargetTypePlatform", ",", "Value", ":", "name", "}", ",", "Kind", ":", "permission", ".", "PermPlatformUpdate", ",", "Owner", ":", "t", ",", "CustomData", ":", "event", ".", "FormToCustomData", "(", "InputFields", "(", "r", ")", ")", ",", "Allowed", ":", "event", ".", "Allowed", "(", "permission", ".", "PermPlatformReadEvents", ")", ",", "}", ")", "\n", "if", "err", "!=", "nil", "{", "return", "err", "\n", "}", "\n", "defer", "func", "(", ")", "{", "evt", ".", "Done", "(", "err", ")", "}", "(", ")", "\n", "evt", ".", "SetLogWriter", "(", "writer", ")", "\n", "ctx", ",", "cancel", ":=", "evt", ".", "CancelableContext", "(", "context", ".", "Background", "(", ")", ")", "\n", "err", "=", "servicemanager", ".", "Platform", ".", "Rollback", "(", "appTypes", ".", "PlatformOptions", "{", "Name", ":", "name", ",", "ImageName", ":", "image", ",", "Output", ":", "evt", ",", "Ctx", ":", "ctx", ",", "}", ")", "\n", "cancel", "(", ")", "\n", "if", "err", "==", "appTypes", ".", "ErrPlatformNotFound", "{", "return", "&", "tErrors", ".", "HTTP", "{", "Code", ":", "http", ".", "StatusNotFound", ",", "Message", ":", "err", ".", "Error", "(", ")", "}", "\n", "}", "\n", "if", "err", "!=", "nil", "{", "return", "err", "\n", "}", "\n", "writer", ".", "Write", "(", "[", "]", "byte", "(", "\"", "\\n", "\"", ")", ")", "\n", "return", "nil", "\n", "}" ]
20,483
all-20484
[ "/", "*", ".", "db", "a", "reference", "to", "a", "sql", ".", "DB", "instance", ".", "q", "is", "the", "database", "query", ".", "inargs", "is", "an", "array", "of", "interfaces", "containing", "the", "query", "arguments", ".", "outfmt", "is", "an", "array", "of", "interfaces", "containing", "the", "right", "types", "of", "output", "arguments", "i", ".", "e", ".", "var", "arg1", "string", "var", "arg2", "int", "outfmt", ":", "=", "{}", "interface", "{}", "{", "arg1", "arg2", "}", "The", "result", "will", "be", "an", "array", "(", "one", "per", "output", "row", ")", "of", "arrays", "(", "one", "per", "output", "argument", ")", "of", "interfaces", "containing", "pointers", "to", "the", "actual", "output", "arguments", "." ]
[ "func", "queryScan", "(", "<mask>", "*", "sql", ".", "DB", ",", "q", "string", ",", "inargs", "[", "]", "interface", "{", "}", ",", "outfmt", "[", "]", "interface", "{", "}", ")", "(", "[", "]", "[", "]", "interface", "{", "}", ",", "error", ")", "{", "return", "doDbQueryScan", "(", "db", ",", "q", ",", "inargs", ",", "outfmt", ")", "\n", "}" ]
20,484
all-20485
[ "UnmarshalJSON", "supports", "json", ".", "Unmarshaler", "interface" ]
[ "func", "(", "v", "*", "FontFace", ")", "UnmarshalJSON", "(", "<mask>", "[", "]", "byte", ")", "error", "{", "r", ":=", "jlexer", ".", "Lexer", "{", "Data", ":", "data", "}", "\n", "easyjsonC5a4559bDecodeGithubComChromedpCdprotoCss50", "(", "&", "r", ",", "v", ")", "\n", "return", "r", ".", "Error", "(", ")", "\n", "}" ]
20,485
all-20486
[ "New", "returns", "a", "instance", "of", "oort", ".", "Server", "for", "a", "given", "serviceName", "workingDir", "and", "buildVersion", ".", "if", "workingDir", "is", "empty", "the", "default", "dir", "of", "/", "var", "/", "lib", "/", "<servicename", ">", "is", "used", ".", "if", "buildVersion", "is", "empty", "the", "default", "version", "of", "DEV", "will", "be", "passed", "on", "to", "the", "self", "-", "upgrade", "service", "." ]
[ "func", "New", "(", "serviceName", ",", "workingDir", "string", ",", "binaryUpdater", "*", "cmdctrl", ".", "GithubUpdater", ")", "(", "*", "Server", ",", "error", ")", "{", "if", "workingDir", "==", "\"", "\"", "{", "workingDir", "=", "fmt", ".", "Sprintf", "(", "\"", "\"", ",", "DefaultBaseDir", ",", "serviceName", ")", "\n", "}", "\n", "o", ":=", "&", "Server", "{", "serviceName", ":", "serviceName", ",", "cwd", ":", "workingDir", ",", "ch", ":", "make", "(", "chan", "bool", ")", ",", "ShutdownComplete", ":", "<mask>", "(", "chan", "bool", ")", ",", "waitGroup", ":", "&", "sync", ".", "WaitGroup", "{", "}", ",", "stopped", ":", "false", ",", "}", "\n", "err", ":=", "o", ".", "ObtainConfig", "(", ")", "\n", "if", "err", "!=", "nil", "{", "return", "o", ",", "err", "\n", "}", "\n", "o", ".", "binaryUpgrade", "=", "binaryUpdater", "\n", "return", "o", ",", "err", "\n", "}" ]
20,486
all-20487
[ "SetKnownExitCode", "sets", "exit", "code", "field", "in", "container", "struct" ]
[ "func", "(", "c", "*", "Container", ")", "SetKnownExitCode", "(", "i", "*", "int", ")", "{", "c", ".", "<mask>", ".", "Lock", "(", ")", "\n", "defer", "c", ".", "lock", ".", "Unlock", "(", ")", "\n\n", "c", ".", "KnownExitCodeUnsafe", "=", "i", "\n", "}" ]
20,487
all-20488
[ "newAuthTokenFileRoundTripper", "adds", "the", "auth", "token", "read", "from", "the", "file", "to", "a", "request", "." ]
[ "func", "newAuthTokenFileRoundTripper", "(", "tokenFile", "string", ",", "rt", "http", ".", "RoundTripper", ")", "(", "http", ".", "RoundTripper", ",", "error", ")", "{", "// fail-fast if we can't read the file.", "_", ",", "err", ":=", "ioutil", ".", "ReadFile", "(", "tokenFile", ")", "\n", "if", "err", "!=", "nil", "{", "return", "nil", ",", "<mask>", ".", "Wrapf", "(", "err", ",", "\"", "\"", ",", "tokenFile", ")", "\n", "}", "\n", "return", "&", "authTokenFileRoundTripper", "{", "tokenFile", ",", "rt", "}", ",", "nil", "\n", "}" ]
20,488
all-20489
[ "StringIn", "is", "a", "convenience", "function", "that", "returns", "true", "if", "str", "matches", "any", "of", "the", "values", "." ]
[ "func", "StringIn", "(", "str", "string", ",", "<mask>", "...", "string", ")", "bool", "{", "for", "_", ",", "val", ":=", "range", "values", "{", "if", "str", "==", "val", "{", "return", "true", "\n", "}", "\n", "}", "\n", "return", "false", "\n", "}" ]
20,489
all-20490
[ "VisitInput", "visits", "each", "input", "recursively", "in", "ascending", "order", "(", "root", "last", ")" ]
[ "func", "VisitInput", "(", "input", "*", "Input", ",", "f", "func", "(", "*", "Input", ")", ")", "{", "<mask>", "{", "case", "input", "==", "nil", ":", "return", "// Spouts may have nil input", "\n", "case", "input", ".", "Cross", "!=", "nil", ":", "for", "_", ",", "input", ":=", "range", "input", ".", "Cross", "{", "VisitInput", "(", "input", ",", "f", ")", "\n", "}", "\n", "case", "input", ".", "Union", "!=", "nil", ":", "for", "_", ",", "input", ":=", "range", "input", ".", "Union", "{", "VisitInput", "(", "input", ",", "f", ")", "\n", "}", "\n", "}", "\n", "f", "(", "input", ")", "\n", "}" ]
20,490
all-20491
[ "getMostRecentCommit", "gets", "the", "hash", "of", "the", "most", "recent", "commit", "to", "the", "repository", ".", "Useful", "for", "checking", "if", "changes", "occur", "." ]
[ "func", "(", "r", "*", "Repo", ")", "mostRecentCommit", "(", ")", "(", "string", ",", "error", ")", "{", "<mask>", ":=", "gitBinary", "+", "` --no-pager log -n 1 --pretty=format:\"%H\"`", "\n", "c", ",", "args", ",", "err", ":=", "caddy", ".", "SplitCommandAndArgs", "(", "command", ")", "\n", "if", "err", "!=", "nil", "{", "return", "\"", "\"", ",", "err", "\n", "}", "\n", "return", "runCmdOutput", "(", "c", ",", "args", ",", "r", ".", "Path", ")", "\n", "}" ]
20,491
all-20492
[ "removeClosedConn", "removes", "a", "connection", "if", "it", "s", "closed", ".", "Until", "a", "connection", "is", "fully", "closed", "the", "channel", "must", "keep", "track", "of", "it", "." ]
[ "func", "(", "ch", "*", "Channel", ")", "removeClosedConn", "(", "c", "*", "<mask>", ")", "{", "if", "c", ".", "readState", "(", ")", "!=", "connectionClosed", "{", "return", "\n", "}", "\n\n", "ch", ".", "mutable", ".", "Lock", "(", ")", "\n", "delete", "(", "ch", ".", "mutable", ".", "conns", ",", "c", ".", "connID", ")", "\n", "ch", ".", "mutable", ".", "Unlock", "(", ")", "\n", "}" ]
20,492
all-20493
[ "SetPageSet", "()", "is", "a", "wrapper", "around", "gtk_print_settings_set_page_set", "()", "." ]
[ "func", "(", "ps", "*", "PrintSettings", ")", "SetPageSet", "(", "pageSet", "PageSet", ")", "{", "C", ".", "gtk_print_settings_set_page_set", "(", "<mask>", ".", "native", "(", ")", ",", "C", ".", "GtkPageSet", "(", "pageSet", ")", ")", "\n", "}" ]
20,493
all-20494
[ "Close", "implements", "y", ".", "Interface", "." ]
[ "func", "(", "s", "*", "ConcatIterator", ")", "Close", "(", ")", "error", "{", "for", "_", ",", "<mask>", ":=", "range", "s", ".", "iters", "{", "if", "err", ":=", "it", ".", "Close", "(", ")", ";", "err", "!=", "nil", "{", "return", "errors", ".", "Wrap", "(", "err", ",", "\"", "\"", ")", "\n", "}", "\n", "}", "\n", "return", "nil", "\n", "}" ]
20,494
all-20495
[ "UpdateSettings", "updates", "settings", "." ]
[ "func", "(", "h", "*", "Handler", ")", "UpdateSettings", "(", "tkn", "string", ",", "items", "map", "[", "string", "]", "string", ")", "error", "{", "logger", ":=", "h", ".", "logger", ".", "Add", "(", "\"", "\"", ",", "\"", "\"", ")", "\n\n", "if", "!", "h", ".", "token", ".", "Check", "(", "tkn", ")", "{", "logger", ".", "Warn", "(", "\"", "\"", ")", "\n", "return", "ErrAccessDenied", "\n", "}", "\n\n", "err", ":=", "h", ".", "db", ".", "InTransaction", "(", "func", "(", "tx", "*", "reform", ".", "TX", ")", "error", "{", "for", "k", ",", "v", ":=", "range", "items", "{", "if", "err", ":=", "h", ".", "validateSetting", "(", "logger", ",", "k", ",", "v", ")", ";", "err", "!=", "nil", "{", "logger", ".", "Add", "(", "\"", "\"", ",", "k", ",", "\"", "\"", ",", "v", ")", ".", "Error", "(", "err", ".", "Error", "(", ")", ")", "\n", "return", "err", "\n", "}", "\n", "}", "\n\n", "for", "k", ",", "v", ":=", "range", "items", "{", "logger", "=", "logger", ".", "Add", "(", "\"", "\"", ",", "k", ",", "\"", "\"", ",", "v", ")", "\n\n", "var", "settingFromDB", "data", ".", "Setting", "\n\n", "// gets setting from database", "err", ":=", "tx", ".", "FindByPrimaryKeyTo", "(", "&", "settingFromDB", ",", "k", ")", "\n", "if", "err", "!=", "nil", "{", "logger", ".", "Error", "(", "err", ".", "Error", "(", ")", ")", "\n", "return", "ErrInternal", "\n", "}", "\n\n", "// if settings.permissions != data.ReadWrite", "// then setting ignored", "if", "settingFromDB", ".", "Permissions", "!=", "data", ".", "ReadWrite", "{", "continue", "\n", "}", "\n\n", "setting", ":=", "settingFromDB", "\n", "setting", ".", "Value", "=", "v", "\n\n", "err", "=", "tx", ".", "Update", "(", "&", "setting", ")", "\n", "if", "err", "!=", "nil", "{", "logger", ".", "<mask>", "(", "err", ".", "Error", "(", ")", ")", "\n", "return", "ErrInternal", "\n", "}", "\n", "}", "\n", "return", "nil", "\n", "}", ")", "\n\n", "if", "err", "!=", "nil", "{", "return", "h", ".", "catchError", "(", "logger", ",", "err", ")", "\n", "}", "\n", "return", "nil", "\n", "}" ]
20,495
all-20496
[ "UnmarshalJSON", "supports", "json", ".", "Unmarshaler", "interface" ]
[ "func", "(", "v", "*", "SetPausedParams", ")", "UnmarshalJSON", "(", "data", "[", "]", "byte", ")", "error", "{", "r", ":=", "jlexer", ".", "Lexer", "{", "Data", ":", "data", "}", "\n", "easyjsonC5a4559bDecodeGithubComChromedpCdprotoAnimation2", "(", "&", "r", ",", "v", ")", "\n", "return", "r", ".", "<mask>", "(", ")", "\n", "}" ]
20,496
all-20497
[ "SetOutputBin", "()", "is", "a", "wrapper", "around", "gtk_print_settings_set_output_bin", "()", "." ]
[ "func", "(", "ps", "*", "PrintSettings", ")", "SetOutputBin", "(", "bin", "string", ")", "{", "cstr", ":=", "C", ".", "CString", "(", "bin", ")", "\n", "defer", "C", ".", "<mask>", "(", "unsafe", ".", "Pointer", "(", "cstr", ")", ")", "\n", "C", ".", "gtk_print_settings_set_output_bin", "(", "ps", ".", "native", "(", ")", ",", "(", "*", "C", ".", "gchar", ")", "(", "cstr", ")", ")", "\n", "}" ]
20,497
all-20498
[ "AddHandler", "adds", "a", "new", "error", "handler", "with", "a", "code", "to", "the", "registry", ".", "It", "there", "already", "is", "an", "error", "or", "handler", "with", "the", "same", "code", "ErrErrorAlreadyRegistered", "will", "be", "returned", "." ]
[ "func", "(", "r", "*", "MapErrorRegistry", ")", "AddHandler", "(", "code", "int", ",", "handler", "func", "(", "body", "[", "]", "byte", ")", "error", ")", "error", "{", "if", "_", ",", "<mask>", ":=", "r", ".", "errors", "[", "code", "]", ";", "ok", "{", "return", "ErrErrorAlreadyRegistered", "\n", "}", "\n", "if", "_", ",", "ok", ":=", "r", ".", "handlers", "[", "code", "]", ";", "ok", "{", "return", "ErrErrorAlreadyRegistered", "\n", "}", "\n", "r", ".", "handlers", "[", "code", "]", "=", "handler", "\n", "return", "nil", "\n", "}" ]
20,498
all-20499
[ "/", "*", "BooleanFromSection", "looks", "for", "the", "specified", "key", "and", "returns", "it", "as", "a", "boolean", ".", "If", "not", "found", "the", "default", "value", "def", "is", "returned", "." ]
[ "func", "(", "config", "*", "Config", ")", "BooleanFromSection", "(", "sectionName", "string", ",", "key", "string", ",", "def", "bool", ")", "bool", "{", "section", ":=", "config", ".", "sectionForName", "(", "sectionName", ")", "\n\n", "if", "section", "!=", "nil", "{", "return", "getBoolean", "(", "<mask>", ".", "values", ",", "key", ",", "def", ")", "\n", "}", "\n\n", "return", "def", "\n", "}" ]
20,499
all-20500
[ "SetAssetFS", "set", "asset", "fs", "for", "render" ]
[ "func", "(", "<mask>", "*", "Render", ")", "SetAssetFS", "(", "assetFS", "assetfs", ".", "Interface", ")", "{", "for", "_", ",", "viewPath", ":=", "range", "render", ".", "ViewPaths", "{", "assetFS", ".", "RegisterPath", "(", "viewPath", ")", "\n", "}", "\n\n", "render", ".", "AssetFileSystem", "=", "assetFS", "\n", "}" ]