id
int32
0
25.3k
idx
stringlengths
5
9
nl_tokens
sequencelengths
1
418
pl_tokens
sequencelengths
22
4.98k
7,800
all-7801
[ "GetRequestIDFromTaskResponse", "-", "a", "function", "to", "get", "a", "request", "id", "from", "a", "taskresponse", "object" ]
[ "func", "GetRequestIDFromTaskResponse", "(", "taskResponse", "TaskResponse", ")", "(", "requestID", "string", ",", "err", "error", ")", "{", "var", "provisionHostInfoBytes", "[", "]", "byte", "\n", "firstRecordIndex", ":=", "0", "\n", "meta", ":=", "taskResponse", ".", "MetaData", "\n", "provisionHostInfo", ":=", "ProvisionHostInfo", "{", "}", "\n", "lo", ".", "G", ".", "Debug", "(", "\"", "\"", ",", "taskResponse", ")", "\n", "lo", ".", "G", ".", "Debug", "(", "\"", "\"", ",", "meta", ")", "\n\n", "if", "provisionHostInfoBytes", ",", "err", "=", "json", ".", "Marshal", "(", "meta", "[", "ProvisionHostInformationFieldname", "]", ")", ";", "err", "==", "nil", "{", "if", "err", "=", "json", ".", "Unmarshal", "(", "provisionHostInfoBytes", ",", "&", "provisionHostInfo", ")", ";", "err", "==", "nil", "{", "if", "len", "(", "provisionHostInfo", ".", "Data", ")", ">", "firstRecordIndex", "{", "requestID", "=", "provisionHostInfo", ".", "Data", "[", "firstRecordIndex", "]", ".", "RequestID", "\n\n", "}", "else", "{", "lo", ".", "G", ".", "Error", "(", "\"", "\"", ",", "provisionHostInfo", ")", "\n", "}", "\n\n", "}", "else", "{", "lo", ".", "G", ".", "<mask>", "(", "\"", "\"", ",", "err", ",", "meta", ")", "\n", "lo", ".", "G", ".", "Error", "(", "\"", "\"", ",", "meta", ")", "\n", "}", "\n\n", "}", "else", "{", "lo", ".", "G", ".", "Error", "(", "\"", "\"", ",", "err", ")", "\n", "}", "\n", "return", "\n", "}" ]
7,801
all-7802
[ "ValidEnum", "validates", "a", "proposed", "value", "for", "this", "enum", ".", "Implements", "the", "Enum", "interface", "for", "AssetType" ]
[ "func", "(", "e", "AssetType", ")", "ValidEnum", "(", "v", "int32", ")", "bool", "{", "_", ",", "<mask>", ":=", "assetTypeMap", "[", "v", "]", "\n", "return", "ok", "\n", "}" ]
7,802
all-7803
[ "Env", "calculates", "and", "returns", "the", "finalized", "environment", "for", "this", "exec", "configuration", ".", "It", "takes", "into", "account", "pristine", "custom", "environment", "whitelist", "and", "blacklist", "values", "." ]
[ "func", "(", "c", "*", "EnvConfig", ")", "Env", "(", ")", "[", "]", "string", "{", "// In pristine mode, just return the custom environment. If the user did not", "// specify a custom environment, just return the empty slice to force an", "// empty environment. We cannot return nil here because the later call to", "// os/exec will think we want to inherit the parent.", "if", "BoolVal", "(", "c", ".", "Pristine", ")", "{", "if", "len", "(", "c", ".", "Custom", ")", ">", "0", "{", "return", "c", ".", "Custom", "\n", "}", "\n", "return", "[", "]", "string", "{", "}", "\n", "}", "\n\n", "// Pull all the key-value pairs out of the environment", "environ", ":=", "<mask>", ".", "Environ", "(", ")", "\n", "keys", ":=", "make", "(", "[", "]", "string", ",", "len", "(", "environ", ")", ")", "\n", "env", ":=", "make", "(", "map", "[", "string", "]", "string", ",", "len", "(", "environ", ")", ")", "\n", "for", "i", ",", "v", ":=", "range", "environ", "{", "list", ":=", "strings", ".", "SplitN", "(", "v", ",", "\"", "\"", ",", "2", ")", "\n", "keys", "[", "i", "]", "=", "list", "[", "0", "]", "\n", "env", "[", "list", "[", "0", "]", "]", "=", "list", "[", "1", "]", "\n", "}", "\n\n", "// anyGlobMatch is a helper function which checks if any of the given globs", "// match the string.", "anyGlobMatch", ":=", "func", "(", "s", "string", ",", "patterns", "[", "]", "string", ")", "bool", "{", "for", "_", ",", "pattern", ":=", "range", "patterns", "{", "if", "matched", ",", "_", ":=", "filepath", ".", "Match", "(", "pattern", ",", "s", ")", ";", "matched", "{", "return", "true", "\n", "}", "\n", "}", "\n", "return", "false", "\n", "}", "\n\n", "// Pull out any envvars that match the whitelist.", "if", "len", "(", "c", ".", "Whitelist", ")", ">", "0", "{", "newKeys", ":=", "make", "(", "[", "]", "string", ",", "0", ",", "len", "(", "keys", ")", ")", "\n", "for", "_", ",", "k", ":=", "range", "keys", "{", "if", "anyGlobMatch", "(", "k", ",", "c", ".", "Whitelist", ")", "{", "newKeys", "=", "append", "(", "newKeys", ",", "k", ")", "\n", "}", "\n", "}", "\n", "keys", "=", "newKeys", "\n", "}", "\n\n", "// Remove any envvars that match the blacklist.", "if", "len", "(", "c", ".", "Blacklist", ")", ">", "0", "{", "newKeys", ":=", "make", "(", "[", "]", "string", ",", "0", ",", "len", "(", "keys", ")", ")", "\n", "for", "_", ",", "k", ":=", "range", "keys", "{", "if", "!", "anyGlobMatch", "(", "k", ",", "c", ".", "Blacklist", ")", "{", "newKeys", "=", "append", "(", "newKeys", ",", "k", ")", "\n", "}", "\n", "}", "\n", "keys", "=", "newKeys", "\n", "}", "\n\n", "// Build the final list using only the filtered keys.", "finalEnv", ":=", "make", "(", "[", "]", "string", ",", "0", ",", "len", "(", "keys", ")", "+", "len", "(", "c", ".", "Custom", ")", ")", "\n", "for", "_", ",", "k", ":=", "range", "keys", "{", "finalEnv", "=", "append", "(", "finalEnv", ",", "k", "+", "\"", "\"", "+", "env", "[", "k", "]", ")", "\n", "}", "\n\n", "// Append remaining custom environment.", "finalEnv", "=", "append", "(", "finalEnv", ",", "c", ".", "Custom", "...", ")", "\n\n", "return", "finalEnv", "\n", "}" ]
7,803
all-7804
[ "Fetch", "the", "binary", "from", "the", "provided", "URL" ]
[ "func", "(", "h", "*", "HTTP", ")", "Fetch", "(", ")", "(", "io", ".", "Reader", ",", "error", ")", "{", "//delay fetches after first", "if", "h", ".", "delay", "{", "time", ".", "Sleep", "(", "h", ".", "Interval", ")", "\n", "}", "\n", "h", ".", "delay", "=", "true", "\n", "//status check using HEAD", "resp", ",", "err", ":=", "http", ".", "Head", "(", "h", ".", "URL", ")", "\n", "if", "err", "!=", "nil", "{", "return", "nil", ",", "fmt", ".", "Errorf", "(", "\"", "\"", ",", "err", ")", "\n", "}", "\n", "resp", ".", "Body", ".", "Close", "(", ")", "\n", "if", "resp", ".", "StatusCode", "!=", "http", ".", "StatusOK", "{", "return", "nil", ",", "fmt", ".", "Errorf", "(", "\"", "\"", ",", "resp", ".", "StatusCode", ")", "\n", "}", "\n", "//if all headers match, skip update", "matches", ",", "total", ":=", "0", ",", "0", "\n", "for", "_", ",", "header", ":=", "range", "h", ".", "CheckHeaders", "{", "if", "curr", ":=", "resp", ".", "Header", ".", "Get", "(", "header", ")", ";", "curr", "!=", "\"", "\"", "{", "if", "last", ",", "ok", ":=", "h", ".", "lasts", "[", "header", "]", ";", "ok", "&&", "last", "==", "curr", "{", "matches", "++", "\n", "}", "\n", "h", ".", "lasts", "[", "header", "]", "=", "curr", "\n", "total", "++", "\n", "}", "\n", "}", "\n", "if", "matches", "==", "<mask>", "{", "return", "nil", ",", "nil", "//skip, file match", "\n", "}", "\n", "//binary fetch using GET", "resp", ",", "err", "=", "http", ".", "Get", "(", "h", ".", "URL", ")", "\n", "if", "err", "!=", "nil", "{", "return", "nil", ",", "fmt", ".", "Errorf", "(", "\"", "\"", ",", "err", ")", "\n", "}", "\n", "if", "resp", ".", "StatusCode", "!=", "http", ".", "StatusOK", "{", "return", "nil", ",", "fmt", ".", "Errorf", "(", "\"", "\"", ",", "resp", ".", "StatusCode", ")", "\n", "}", "\n", "//extract gz files", "if", "strings", ".", "HasSuffix", "(", "h", ".", "URL", ",", "\"", "\"", ")", "&&", "resp", ".", "Header", ".", "Get", "(", "\"", "\"", ")", "!=", "\"", "\"", "{", "return", "gzip", ".", "NewReader", "(", "resp", ".", "Body", ")", "\n", "}", "\n", "//success!", "return", "resp", ".", "Body", ",", "nil", "\n", "}" ]
7,804
all-7805
[ "SetNick", "sets", "the", "bots", "nick", "on", "the", "irc", "server" ]
[ "func", "(", "<mask>", "*", "Bot", ")", "SetNick", "(", "nick", "string", ")", "{", "bot", ".", "Nick", "=", "nick", "\n", "bot", ".", "Send", "(", "fmt", ".", "Sprintf", "(", "\"", "\"", ",", "nick", ")", ")", "\n", "}" ]
7,805
all-7806
[ "MarshalJSON", "supports", "json", ".", "Marshaler", "interface" ]
[ "func", "(", "v", "EventDomContentEventFired", ")", "MarshalJSON", "(", ")", "(", "[", "]", "byte", ",", "error", ")", "{", "w", ":=", "jwriter", ".", "Writer", "{", "}", "\n", "easyjsonC5a4559bEncodeGithubComChromedpCdprotoPage68", "(", "&", "w", ",", "v", ")", "\n", "return", "w", ".", "Buffer", ".", "BuildBytes", "(", ")", ",", "w", ".", "<mask>", "\n", "}" ]
7,806
all-7807
[ "FieldValueUnmarshaller", "is", "a", "function", "which", "creates", "a", "Record", "from", "a", "CSV", "file", "line", "with", "value", "data", "." ]
[ "func", "FieldValueUnmarshaller", "(", "format", "Format", ")", "RecordUnmarshaller", "{", "return", "func", "(", "text", "string", ")", "(", "pilosa", ".", "Record", ",", "error", ")", "{", "parts", ":=", "strings", ".", "Split", "(", "text", ",", "\"", "\"", ")", "\n", "if", "len", "(", "parts", ")", "<", "2", "{", "return", "nil", ",", "errors", ".", "New", "(", "\"", "\"", ")", "\n", "}", "\n", "value", ",", "err", ":=", "strconv", ".", "ParseInt", "(", "parts", "[", "1", "]", ",", "10", ",", "64", ")", "\n", "if", "err", "!=", "nil", "{", "return", "nil", ",", "<mask>", ".", "New", "(", "\"", "\"", ")", "\n", "}", "\n", "switch", "format", "{", "case", "ColumnID", ":", "columnID", ",", "err", ":=", "strconv", ".", "ParseUint", "(", "parts", "[", "0", "]", ",", "10", ",", "64", ")", "\n", "if", "err", "!=", "nil", "{", "return", "nil", ",", "errors", ".", "New", "(", "\"", "\"", ")", "\n", "}", "\n", "return", "pilosa", ".", "FieldValue", "{", "ColumnID", ":", "uint64", "(", "columnID", ")", ",", "Value", ":", "value", ",", "}", ",", "nil", "\n", "case", "ColumnKey", ":", "return", "pilosa", ".", "FieldValue", "{", "ColumnKey", ":", "parts", "[", "0", "]", ",", "Value", ":", "value", ",", "}", ",", "nil", "\n", "default", ":", "return", "nil", ",", "fmt", ".", "Errorf", "(", "\"", "\"", ",", "format", ")", "\n", "}", "\n", "}", "\n", "}" ]
7,807
all-7808
[ "buildImage", "builds", "a", "new", "docker", "image", "." ]
[ "func", "buildImage", "(", "client", "*", "docker", ".", "Client", ",", "repo", "string", ",", "contextDir", "string", ",", "dockerfile", "string", ",", "destTag", "string", ")", "error", "{", "destImage", ":=", "fmt", ".", "Sprintf", "(", "\"", "\"", ",", "repo", ",", "destTag", ")", "\n\n", "fmt", ".", "Printf", "(", "\"", "\\n", "\"", ",", "destImage", ")", "\n\n", "err", ":=", "<mask>", ".", "BuildImage", "(", "docker", ".", "BuildImageOptions", "{", "Name", ":", "destImage", ",", "ContextDir", ":", "contextDir", ",", "Dockerfile", ":", "dockerfile", ",", "OutputStream", ":", "os", ".", "Stdout", ",", "}", ")", "\n\n", "if", "err", "!=", "nil", "{", "return", "fmt", ".", "Errorf", "(", "\"", "\"", ",", "err", ")", "\n", "}", "\n\n", "return", "nil", "\n", "}" ]
7,808
all-7809
[ "RmDir", "deletes", "a", "directory", "in", "the", "guest", "operating", "system", ".", "Any", "files", "or", "subdirectories", "in", "the", "specified", "directory", "will", "also", "be", "deleted", ".", "Parameters", ":", "path", ":", "Directory", "path", "to", "be", "deleted", "in", "the", "guest", "OS", "Remarks", ":", "*", "Only", "absolute", "paths", "should", "be", "used", "for", "files", "in", "the", "guest", ";", "the", "resolution", "of", "relative", "paths", "is", "not", "specified", ".", "Since", "VMware", "Workstation", "6", ".", "0", "Minimum", "Supported", "Guest", "OS", ":", "Microsoft", "Windows", "NT", "Series", "Linux" ]
[ "func", "(", "g", "*", "Guest", ")", "RmDir", "(", "path", "string", ")", "error", "{", "var", "jobHandle", "C", ".", "VixHandle", "=", "C", ".", "VIX_INVALID_HANDLE", "\n", "var", "err", "C", ".", "VixError", "=", "C", ".", "VIX_OK", "\n\n", "cpath", ":=", "C", ".", "CString", "(", "path", ")", "\n", "defer", "C", ".", "free", "(", "unsafe", ".", "Pointer", "(", "cpath", ")", ")", "\n\n", "jobHandle", "=", "C", ".", "VixVM_DeleteDirectoryInGuest", "(", "g", ".", "<mask>", ",", "cpath", ",", "// path name", "0", ",", "// options", "nil", ",", "// callbackProc", "nil", ")", "// clientData", "\n\n", "defer", "C", ".", "Vix_ReleaseHandle", "(", "jobHandle", ")", "\n\n", "err", "=", "C", ".", "vix_job_wait", "(", "jobHandle", ")", "\n", "if", "C", ".", "VIX_OK", "!=", "err", "{", "return", "&", "Error", "{", "Operation", ":", "\"", "\"", ",", "Code", ":", "int", "(", "err", "&", "0xFFFF", ")", ",", "Text", ":", "C", ".", "GoString", "(", "C", ".", "Vix_GetErrorText", "(", "err", ",", "nil", ")", ")", ",", "}", "\n", "}", "\n\n", "return", "nil", "\n", "}" ]
7,809
all-7810
[ "Error", "logs", "a", "message", "(", "with", "optional", "context", ")", "at", "the", "ERROR", "log", "level" ]
[ "func", "Error", "(", "msg", "string", ",", "ctx", "...", "interface", "{", "}", ")", "{", "if", "<mask>", "!=", "nil", "{", "Log", ".", "Error", "(", "msg", ",", "ctx", "...", ")", "\n", "}", "\n", "}" ]
7,810
all-7811
[ "ProfilesExpandConfig", "expands", "the", "given", "container", "config", "with", "the", "config", "values", "of", "the", "given", "profiles", "." ]
[ "func", "ProfilesExpandConfig", "(", "config", "map", "[", "string", "]", "string", ",", "profiles", "[", "]", "api", ".", "Profile", ")", "map", "[", "string", "]", "string", "{", "expandedConfig", ":=", "map", "[", "string", "]", "string", "{", "}", "\n\n", "// Apply all the profiles", "profileConfigs", ":=", "make", "(", "[", "]", "map", "[", "string", "]", "string", ",", "len", "(", "profiles", ")", ")", "\n", "for", "i", ",", "profile", ":=", "range", "profiles", "{", "profileConfigs", "[", "i", "]", "=", "profile", ".", "Config", "\n", "}", "\n\n", "for", "i", ":=", "range", "profileConfigs", "{", "for", "k", ",", "v", ":=", "<mask>", "profileConfigs", "[", "i", "]", "{", "expandedConfig", "[", "k", "]", "=", "v", "\n", "}", "\n", "}", "\n\n", "// Stick the given config on top", "for", "k", ",", "v", ":=", "range", "config", "{", "expandedConfig", "[", "k", "]", "=", "v", "\n", "}", "\n\n", "return", "expandedConfig", "\n", "}" ]
7,811
all-7812
[ "MarshalJSON", "supports", "json", ".", "Marshaler", "interface" ]
[ "func", "(", "v", "StopTypeProfileParams", ")", "MarshalJSON", "(", ")", "(", "[", "]", "byte", ",", "error", ")", "{", "w", ":=", "jwriter", ".", "Writer", "{", "}", "\n", "easyjsonC5a4559bEncodeGithubComChromedpCdprotoProfiler6", "(", "&", "w", ",", "v", ")", "\n", "return", "w", ".", "Buffer", ".", "BuildBytes", "(", ")", ",", "w", ".", "<mask>", "\n", "}" ]
7,812
all-7813
[ "GetCurrentFolder", "is", "a", "wrapper", "around", "gtk_file_chooser_get_current_folder", "()", "." ]
[ "func", "(", "v", "*", "FileChooser", ")", "GetCurrentFolder", "(", ")", "(", "string", ",", "error", ")", "{", "c", ":=", "C", ".", "gtk_file_chooser_get_current_folder", "(", "v", ".", "native", "(", ")", ")", "\n", "if", "c", "==", "nil", "{", "return", "\"", "\"", ",", "nilPtrErr", "\n", "}", "\n", "defer", "C", ".", "<mask>", "(", "unsafe", ".", "Pointer", "(", "c", ")", ")", "\n", "return", "goString", "(", "c", ")", ",", "nil", "\n", "}" ]
7,813
all-7814
[ "AppendText", "is", "a", "wrapper", "around", "gtk_combo_box_text_append_text", "()", "." ]
[ "func", "(", "v", "*", "ComboBoxText", ")", "AppendText", "(", "text", "string", ")", "{", "cstr", ":=", "C", ".", "CString", "(", "<mask>", ")", "\n", "defer", "C", ".", "free", "(", "unsafe", ".", "Pointer", "(", "cstr", ")", ")", "\n", "C", ".", "gtk_combo_box_text_append_text", "(", "v", ".", "native", "(", ")", ",", "(", "*", "C", ".", "gchar", ")", "(", "cstr", ")", ")", "\n", "}" ]
7,814
all-7815
[ "Save", "the", "cache", "s", "items", "to", "the", "given", "filename", "creating", "the", "file", "if", "it", "doesn", "t", "exist", "and", "overwriting", "it", "if", "it", "does", ".", "NOTE", ":", "This", "method", "is", "deprecated", "in", "favor", "of", "c", ".", "Items", "()", "and", "NewFrom", "()", "(", "see", "the", "documentation", "for", "NewFrom", "()", ".", ")" ]
[ "func", "(", "c", "*", "<mask>", ")", "SaveFile", "(", "fname", "string", ")", "error", "{", "fp", ",", "err", ":=", "os", ".", "Create", "(", "fname", ")", "\n", "if", "err", "!=", "nil", "{", "return", "err", "\n", "}", "\n", "err", "=", "c", ".", "Save", "(", "fp", ")", "\n", "if", "err", "!=", "nil", "{", "fp", ".", "Close", "(", ")", "\n", "return", "err", "\n", "}", "\n", "return", "fp", ".", "Close", "(", ")", "\n", "}" ]
7,815
all-7816
[ "flattenHostVirtualSwitchBondBridge", "reads", "various", "fields", "from", "a", "HostVirtualSwitchBondBridge", "into", "the", "passed", "in", "ResourceData", "." ]
[ "func", "flattenHostVirtualSwitchBondBridge", "(", "d", "*", "schema", ".", "ResourceData", ",", "obj", "*", "<mask>", ".", "HostVirtualSwitchBondBridge", ")", "error", "{", "if", "err", ":=", "d", ".", "Set", "(", "\"", "\"", ",", "structure", ".", "SliceStringsToInterfaces", "(", "obj", ".", "NicDevice", ")", ")", ";", "err", "!=", "nil", "{", "return", "err", "\n", "}", "\n", "if", "err", ":=", "flattenHostVirtualSwitchBeaconConfig", "(", "d", ",", "obj", ".", "Beacon", ")", ";", "err", "!=", "nil", "{", "return", "err", "\n", "}", "\n", "if", "err", ":=", "flattenLinkDiscoveryProtocolConfig", "(", "d", ",", "obj", ".", "LinkDiscoveryProtocolConfig", ")", ";", "err", "!=", "nil", "{", "return", "err", "\n", "}", "\n", "return", "nil", "\n", "}" ]
7,816
all-7817
[ "HasEnv", "returns", "a", "boolean", "if", "a", "field", "has", "been", "set", "." ]
[ "func", "(", "w", "*", "Widget", ")", "HasEnv", "(", ")", "bool", "{", "if", "w", "!=", "nil", "&&", "w", ".", "Env", "!=", "nil", "{", "return", "<mask>", "\n", "}", "\n\n", "return", "false", "\n", "}" ]
7,817
all-7818
[ "jitterUp", "adds", "random", "jitter", "to", "the", "duration", ".", "This", "adds", "or", "subtracts", "time", "from", "the", "duration", "within", "a", "given", "jitter", "fraction", ".", "For", "example", "for", "10s", "and", "jitter", "0", ".", "1", "it", "will", "return", "a", "time", "within", "[", "9s", "11s", "]", ")", "Reference", ":", "https", ":", "//", "godoc", ".", "org", "/", "github", ".", "com", "/", "grpc", "-", "ecosystem", "/", "go", "-", "grpc", "-", "middleware", "/", "util", "/", "backoffutils" ]
[ "func", "jitterUp", "(", "duration", "time", ".", "Duration", ",", "jitter", "float64", ")", "time", ".", "Duration", "{", "multiplier", ":=", "jitter", "*", "(", "rand", ".", "Float64", "(", ")", "*", "2", "-", "1", ")", "\n", "return", "<mask>", ".", "Duration", "(", "float64", "(", "duration", ")", "*", "(", "1", "+", "multiplier", ")", ")", "\n", "}" ]
7,818
all-7819
[ "expandHostNicOrderPolicy", "reads", "certain", "ResourceData", "keys", "and", "returns", "a", "HostNicOrderPolicy", "." ]
[ "func", "expandHostNicOrderPolicy", "(", "d", "*", "schema", ".", "ResourceData", ")", "*", "types", ".", "HostNicOrderPolicy", "{", "obj", ":=", "&", "types", ".", "HostNicOrderPolicy", "{", "}", "\n", "activeNics", ",", "activeOk", ":=", "d", ".", "GetOkExists", "(", "\"", "\"", ")", "\n", "standbyNics", ",", "standbyOk", ":=", "d", ".", "GetOkExists", "(", "\"", "\"", ")", "\n", "if", "!", "activeOk", "&&", "!", "standbyOk", "{", "return", "nil", "\n", "}", "\n", "obj", ".", "ActiveNic", "=", "structure", ".", "SliceInterfacesToStrings", "(", "activeNics", ".", "(", "[", "]", "<mask>", "{", "}", ")", ")", "\n", "obj", ".", "StandbyNic", "=", "structure", ".", "SliceInterfacesToStrings", "(", "standbyNics", ".", "(", "[", "]", "interface", "{", "}", ")", ")", "\n", "return", "obj", "\n", "}" ]
7,819
all-7820
[ "DescribeMessage", "returns", "a", "concise", "human", "-", "readable", "description", "of", "a", "Message", "for", "debugging", "." ]
[ "func", "DescribeMessage", "(", "m", "pb", ".", "<mask>", ",", "f", "EntryFormatter", ")", "string", "{", "var", "buf", "bytes", ".", "Buffer", "\n", "fmt", ".", "Fprintf", "(", "&", "buf", ",", "\"", "\"", ",", "m", ".", "From", ",", "m", ".", "To", ",", "m", ".", "Type", ",", "m", ".", "Term", ",", "m", ".", "LogTerm", ",", "m", ".", "Index", ")", "\n", "if", "m", ".", "Reject", "{", "fmt", ".", "Fprintf", "(", "&", "buf", ",", "\"", "\"", ",", "m", ".", "RejectHint", ")", "\n", "}", "\n", "if", "m", ".", "Commit", "!=", "0", "{", "fmt", ".", "Fprintf", "(", "&", "buf", ",", "\"", "\"", ",", "m", ".", "Commit", ")", "\n", "}", "\n", "if", "len", "(", "m", ".", "Entries", ")", ">", "0", "{", "fmt", ".", "Fprintf", "(", "&", "buf", ",", "\"", "\"", ")", "\n", "for", "i", ",", "e", ":=", "range", "m", ".", "Entries", "{", "if", "i", "!=", "0", "{", "buf", ".", "WriteString", "(", "\"", "\"", ")", "\n", "}", "\n", "buf", ".", "WriteString", "(", "DescribeEntry", "(", "e", ",", "f", ")", ")", "\n", "}", "\n", "fmt", ".", "Fprintf", "(", "&", "buf", ",", "\"", "\"", ")", "\n", "}", "\n", "if", "!", "IsEmptySnap", "(", "m", ".", "Snapshot", ")", "{", "fmt", ".", "Fprintf", "(", "&", "buf", ",", "\"", "\"", ",", "m", ".", "Snapshot", ")", "\n", "}", "\n", "return", "buf", ".", "String", "(", ")", "\n", "}" ]
7,820
all-7821
[ "walkFields", "calls", "a", "function", "for", "each", "field", "of", "a", "struct", "recursively", "expanding", "struct", "fields", "." ]
[ "func", "walkFields", "(", "v", "reflect", ".", "Value", ",", "visit", "func", "(", "<mask>", "reflect", ".", "StructField", ",", "val", "reflect", ".", "Value", ",", "owner", "reflect", ".", "Type", ")", "bool", ")", "{", "t", ":=", "v", ".", "Type", "(", ")", "\n", "for", "i", ":=", "0", ";", "i", "<", "t", ".", "NumField", "(", ")", ";", "i", "++", "{", "field", ":=", "t", ".", "Field", "(", "i", ")", "\n", "val", ":=", "v", ".", "Field", "(", "i", ")", "\n", "expand", ":=", "visit", "(", "field", ",", "val", ",", "t", ")", "\n", "if", "expand", "&&", "field", ".", "Type", ".", "Kind", "(", ")", "==", "reflect", ".", "Struct", "{", "walkFields", "(", "val", ",", "visit", ")", "\n", "}", "\n", "}", "\n", "}" ]
7,821
all-7822
[ "Trace", "adds", "the", "route", "pattern", "that", "matches", "a", "TRACE", "http", "method", "to", "execute", "the", "handlerFn", "http", ".", "HandlerFunc", "." ]
[ "func", "(", "mx", "*", "Mux", ")", "Trace", "(", "pattern", "string", ",", "handlerFn", "http", ".", "HandlerFunc", ")", "{", "mx", ".", "handle", "(", "mTRACE", ",", "<mask>", ",", "handlerFn", ")", "\n", "}" ]
7,822
all-7823
[ "MarshalEasyJSON", "writes", "the", "Duration", "to", "a", "easyjson", ".", "Writer" ]
[ "func", "(", "d", "Duration", ")", "MarshalEasyJSON", "(", "w", "*", "jwriter", ".", "Writer", ")", "{", "w", ".", "<mask>", "(", "time", ".", "Duration", "(", "d", ")", ".", "String", "(", ")", ")", "\n", "}" ]
7,823
all-7824
[ "CreateSecretWithContext", "mocks", "base", "method" ]
[ "func", "(", "m", "*", "MockSecretsManagerAPI", ")", "CreateSecretWithContext", "(", "arg0", "aws", ".", "Context", ",", "arg1", "*", "secretsmanager", ".", "CreateSecretInput", ",", "arg2", "...", "request", ".", "Option", ")", "(", "*", "secretsmanager", ".", "CreateSecretOutput", ",", "error", ")", "{", "varargs", ":=", "[", "]", "interface", "{", "}", "{", "arg0", ",", "arg1", "}", "\n", "for", "_", ",", "a", ":=", "range", "arg2", "{", "varargs", "=", "append", "(", "varargs", ",", "a", ")", "\n", "}", "\n", "ret", ":=", "m", ".", "ctrl", ".", "Call", "(", "m", ",", "\"", "\"", ",", "varargs", "...", ")", "\n", "ret0", ",", "_", ":=", "<mask>", "[", "0", "]", ".", "(", "*", "secretsmanager", ".", "CreateSecretOutput", ")", "\n", "ret1", ",", "_", ":=", "ret", "[", "1", "]", ".", "(", "error", ")", "\n", "return", "ret0", ",", "ret1", "\n", "}" ]
7,824
all-7825
[ "submitFirstEvent", "submits", "the", "first", "event", "for", "the", "task", "from", "the", "event", "list", ".", "It", "returns", "true", "if", "the", "list", "became", "empty", "after", "submitting", "the", "event", ".", "Else", "it", "returns", "false", ".", "An", "error", "is", "returned", "if", "there", "was", "an", "error", "with", "submitting", "the", "state", "change", "to", "ECS", ".", "The", "error", "is", "used", "by", "the", "backoff", "handler", "to", "backoff", "before", "retrying", "the", "state", "change", "submission", "for", "the", "first", "event" ]
[ "func", "(", "taskEvents", "*", "taskSendableEvents", ")", "submitFirstEvent", "(", "handler", "*", "TaskHandler", ",", "backoff", "retry", ".", "Backoff", ")", "(", "bool", ",", "error", ")", "{", "seelog", ".", "Debug", "(", "\"", "\"", ")", "\n", "taskEvents", ".", "<mask>", ".", "Lock", "(", ")", "\n", "defer", "taskEvents", ".", "lock", ".", "Unlock", "(", ")", "\n\n", "seelog", ".", "Debugf", "(", "\"", "\"", ",", "taskEvents", ".", "toStringUnsafe", "(", ")", ")", "\n\n", "if", "taskEvents", ".", "events", ".", "Len", "(", ")", "==", "0", "{", "seelog", ".", "Debug", "(", "\"", "\"", ")", "\n", "taskEvents", ".", "sending", "=", "false", "\n", "return", "true", ",", "nil", "\n", "}", "\n\n", "eventToSubmit", ":=", "taskEvents", ".", "events", ".", "Front", "(", ")", "\n", "// Extract the wrapped event from the list element", "event", ":=", "eventToSubmit", ".", "Value", ".", "(", "*", "sendableEvent", ")", "\n\n", "if", "event", ".", "containerShouldBeSent", "(", ")", "{", "if", "err", ":=", "event", ".", "send", "(", "sendContainerStatusToECS", ",", "setContainerChangeSent", ",", "\"", "\"", ",", "handler", ".", "client", ",", "eventToSubmit", ",", "handler", ".", "stateSaver", ",", "backoff", ",", "taskEvents", ")", ";", "err", "!=", "nil", "{", "return", "false", ",", "err", "\n", "}", "\n", "}", "else", "if", "event", ".", "taskShouldBeSent", "(", ")", "{", "if", "err", ":=", "event", ".", "send", "(", "sendTaskStatusToECS", ",", "setTaskChangeSent", ",", "\"", "\"", ",", "handler", ".", "client", ",", "eventToSubmit", ",", "handler", ".", "stateSaver", ",", "backoff", ",", "taskEvents", ")", ";", "err", "!=", "nil", "{", "handleInvalidParamException", "(", "err", ",", "taskEvents", ".", "events", ",", "eventToSubmit", ")", "\n", "return", "false", ",", "err", "\n", "}", "\n", "}", "else", "if", "event", ".", "taskAttachmentShouldBeSent", "(", ")", "{", "if", "err", ":=", "event", ".", "send", "(", "sendTaskStatusToECS", ",", "setTaskAttachmentSent", ",", "\"", "\"", ",", "handler", ".", "client", ",", "eventToSubmit", ",", "handler", ".", "stateSaver", ",", "backoff", ",", "taskEvents", ")", ";", "err", "!=", "nil", "{", "handleInvalidParamException", "(", "err", ",", "taskEvents", ".", "events", ",", "eventToSubmit", ")", "\n", "return", "false", ",", "err", "\n", "}", "\n", "}", "else", "{", "// Shouldn't be sent as either a task or container change event; must have been already sent", "seelog", ".", "Infof", "(", "\"", "\"", ",", "event", ".", "toString", "(", ")", ")", "\n", "taskEvents", ".", "events", ".", "Remove", "(", "eventToSubmit", ")", "\n", "}", "\n\n", "if", "taskEvents", ".", "events", ".", "Len", "(", ")", "==", "0", "{", "seelog", ".", "Debug", "(", "\"", "\"", ")", "\n", "taskEvents", ".", "sending", "=", "false", "\n", "return", "true", ",", "nil", "\n", "}", "\n\n", "return", "false", ",", "nil", "\n", "}" ]
7,825
all-7826
[ "Connect", "middleware", "clones", "the", "database", "session", "for", "each", "request", "and", "makes", "the", "db", "object", "available", "for", "each", "handler" ]
[ "func", "Connect", "(", "c", "*", "gin", ".", "Context", ")", "{", "s", ":=", "db", ".", "Session", ".", "Clone", "(", ")", "\n\n", "defer", "s", ".", "Close", "(", ")", "\n\n", "c", ".", "<mask>", "(", "\"", "\"", ",", "s", ".", "DB", "(", "db", ".", "Mongo", ".", "Database", ")", ")", "\n", "c", ".", "Next", "(", ")", "\n", "}" ]
7,826
all-7827
[ "GetIconSensitive", "()", "is", "a", "wrapper", "around", "gtk_entry_get_icon_sensitive", "()", "." ]
[ "func", "(", "v", "*", "<mask>", ")", "GetIconSensitive", "(", "iconPos", "EntryIconPosition", ")", "bool", "{", "c", ":=", "C", ".", "gtk_entry_get_icon_sensitive", "(", "v", ".", "native", "(", ")", ",", "C", ".", "GtkEntryIconPosition", "(", "iconPos", ")", ")", "\n", "return", "gobool", "(", "c", ")", "\n", "}" ]
7,827
all-7828
[ "AcquireWait", "blocks", "until", "Acquire", "returns", "the", "specified", "resource", "or", "the", "provided", "context", "is", "cancelled", "or", "its", "deadline", "exceeded", "." ]
[ "func", "(", "c", "*", "Client", ")", "AcquireWait", "(", "ctx", "context", ".", "Context", ",", "rtype", ",", "state", ",", "dest", "string", ")", "(", "*", "common", ".", "Resource", ",", "error", ")", "{", "if", "ctx", "==", "nil", "{", "return", "nil", ",", "ErrContextRequired", "\n", "}", "\n", "// Try to acquire the resource until available or the context is", "// cancelled or its deadline exceeded.", "for", "{", "r", ",", "err", ":=", "c", ".", "Acquire", "(", "rtype", ",", "state", ",", "<mask>", ")", "\n", "if", "err", "!=", "nil", "{", "if", "err", "==", "ErrAlreadyInUse", "||", "err", "==", "ErrNotFound", "{", "select", "{", "case", "<-", "ctx", ".", "Done", "(", ")", ":", "return", "nil", ",", "err", "\n", "case", "<-", "time", ".", "After", "(", "3", "*", "time", ".", "Second", ")", ":", "continue", "\n", "}", "\n", "}", "\n", "return", "nil", ",", "err", "\n", "}", "\n", "return", "r", ",", "nil", "\n", "}", "\n", "}" ]
7,828
all-7829
[ "List", "all", "Service", "PIDs", "." ]
[ "func", "(", "s", "*", "ServiceManager", ")", "<mask>", "(", ")", "map", "[", "int", "]", "*", "exec", ".", "Cmd", "{", "log", ".", "Println", "(", "\"", "\"", ")", "\n", "return", "s", ".", "processMap", ".", "processes", "\n", "}" ]
7,829
all-7830
[ "StoreLogs", "implements", "the", "LogStore", "interface", "." ]
[ "func", "(", "i", "*", "InmemStore", ")", "StoreLogs", "(", "logs", "[", "]", "*", "Log", ")", "error", "{", "i", ".", "l", ".", "Lock", "(", ")", "\n", "defer", "i", ".", "l", ".", "Unlock", "(", ")", "\n", "for", "_", ",", "l", ":=", "range", "logs", "{", "i", ".", "logs", "[", "l", ".", "<mask>", "]", "=", "l", "\n", "if", "i", ".", "lowIndex", "==", "0", "{", "i", ".", "lowIndex", "=", "l", ".", "Index", "\n", "}", "\n", "if", "l", ".", "Index", ">", "i", ".", "highIndex", "{", "i", ".", "highIndex", "=", "l", ".", "Index", "\n", "}", "\n", "}", "\n", "return", "nil", "\n", "}" ]
7,830
all-7831
[ "SetBytesKNoValue", "sets", "key", "argument", "." ]
[ "func", "(", "a", "*", "Args", ")", "SetBytesKNoValue", "(", "key", "[", "]", "<mask>", ")", "{", "a", ".", "args", "=", "setArg", "(", "a", ".", "args", ",", "b2s", "(", "key", ")", ",", "\"", "\"", ",", "argsNoValue", ")", "\n", "}" ]
7,831
all-7832
[ "InitI18n", "initializes", "the", "i18n", "subsystem", "." ]
[ "func", "InitI18n", "(", "domain", "string", ",", "dir", "string", ")", "{", "domainStr", ":=", "C", ".", "CString", "(", "<mask>", ")", "\n", "defer", "C", ".", "free", "(", "unsafe", ".", "Pointer", "(", "domainStr", ")", ")", "\n\n", "dirStr", ":=", "C", ".", "CString", "(", "dir", ")", "\n", "defer", "C", ".", "free", "(", "unsafe", ".", "Pointer", "(", "dirStr", ")", ")", "\n\n", "C", ".", "init_i18n", "(", "domainStr", ",", "dirStr", ")", "\n", "}" ]
7,832
all-7833
[ "GetStatus", "--" ]
[ "func", "(", "s", "*", "IkClient", ")", "GetStatus", "(", "requestID", "string", ")", "(", "resp", "*", "GetStatusResponse", ",", "err", "error", ")", "{", "resp", "=", "<mask>", "(", "GetStatusResponse", ")", "\n", "qp", ":=", "url", ".", "Values", "{", "}", "\n", "qp", ".", "Add", "(", "requestIDGetParam", ",", "requestID", ")", "\n", "err", "=", "s", ".", "Call", "(", "RouteGetStatus", ",", "qp", ",", "resp", ")", "\n", "return", "\n", "}" ]
7,833
all-7834
[ "ContentForGitHubPost", "constructs", "the", "message", "covbot", "posts" ]
[ "func", "ContentForGitHubPost", "(", "baseProfiles", ",", "newProfiles", "[", "]", "*", "cover", ".", "Profile", ",", "jobName", "string", ",", "coverageThreshold", "float32", ")", "(", "string", ",", "bool", ")", "{", "rows", ":=", "[", "]", "string", "{", "\"", "\"", ",", "fmt", ".", "Sprintf", "(", "\"", "\"", ",", "jobName", ")", ",", "\"", "\"", ",", "\"", "\"", ",", "\"", "\"", ",", "}", "\n\n", "table", ",", "isCoverageLow", ":=", "makeTable", "(", "calculation", ".", "ProduceCovList", "(", "baseProfiles", ")", ",", "calculation", ".", "ProduceCovList", "(", "newProfiles", ")", ",", "coverageThreshold", ")", "\n\n", "if", "table", "==", "\"", "\"", "{", "return", "\"", "\"", ",", "false", "\n", "}", "\n\n", "<mask>", "=", "append", "(", "rows", ",", "table", ")", "\n", "rows", "=", "append", "(", "rows", ",", "\"", "\"", ")", "\n\n", "return", "strings", ".", "Join", "(", "rows", ",", "\"", "\\n", "\"", ")", ",", "isCoverageLow", "\n", "}" ]
7,834
all-7835
[ "ArmForSwitch", "returns", "which", "field", "name", "should", "be", "used", "for", "storing", "the", "value", "for", "an", "instance", "of", "AllowTrustOpAsset" ]
[ "func", "(", "u", "AllowTrustOpAsset", ")", "ArmForSwitch", "(", "sw", "int32", ")", "(", "string", ",", "bool", ")", "{", "<mask>", "AssetType", "(", "sw", ")", "{", "case", "AssetTypeAssetTypeCreditAlphanum4", ":", "return", "\"", "\"", ",", "true", "\n", "case", "AssetTypeAssetTypeCreditAlphanum12", ":", "return", "\"", "\"", ",", "true", "\n", "}", "\n", "return", "\"", "\"", ",", "false", "\n", "}" ]
7,835
all-7836
[ "export", "FrameSet_Invert" ]
[ "func", "FrameSet_Invert", "(", "id", "FrameSetId", ")", "FrameSetId", "{", "fs", ",", "ok", ":=", "sFrameSets", ".", "Get", "(", "id", ")", "\n", "if", "!", "<mask>", "{", "return", "0", "\n", "}", "\n", "inverted", ":=", "fs", ".", "Invert", "(", ")", "\n", "invertedId", ":=", "sFrameSets", ".", "Add", "(", "*", "inverted", ")", "\n", "return", "invertedId", "\n", "}" ]
7,836
all-7837
[ "newFlash", "creates", "a", "new", "Flash", "and", "loads", "the", "session", "data", "inside", "its", "data", "." ]
[ "func", "newFlash", "(", "session", "*", "Session", ")", "*", "Flash", "{", "result", ":=", "&", "Flash", "{", "data", ":", "map", "[", "string", "]", "[", "]", "string", "{", "}", ",", "}", "\n\n", "if", "session", ".", "Session", "!=", "nil", "{", "if", "f", ":=", "<mask>", ".", "Get", "(", "flashKey", ")", ";", "f", "!=", "nil", "{", "json", ".", "Unmarshal", "(", "f", ".", "(", "[", "]", "byte", ")", ",", "&", "result", ".", "data", ")", "\n", "}", "\n", "}", "\n", "return", "result", "\n", "}" ]
7,837
all-7838
[ "FasthttpSocksDialer", "returns", "a", "fasthttp", ".", "DialFunc", "that", "dials", "using", "the", "provided", "SOCKS5", "proxy", ".", "Example", "usage", ":", "c", ":", "=", "&fasthttp", ".", "Client", "{", "Dial", ":", "fasthttpproxy", ".", "FasthttpSocksDialer", "(", "localhost", ":", "9050", ")", "}" ]
[ "func", "FasthttpSocksDialer", "(", "proxyAddr", "string", ")", "fasthttp", ".", "DialFunc", "{", "return", "func", "(", "addr", "string", ")", "(", "net", ".", "Conn", ",", "error", ")", "{", "dialer", ",", "err", ":=", "proxy", ".", "SOCKS5", "(", "\"", "\"", ",", "proxyAddr", ",", "nil", ",", "<mask>", ".", "Direct", ")", "\n", "if", "err", "!=", "nil", "{", "return", "nil", ",", "err", "\n", "}", "\n", "return", "dialer", ".", "Dial", "(", "\"", "\"", ",", "addr", ")", "\n", "}", "\n", "}" ]
7,838
all-7839
[ "MutateSetOptions", "for", "SetFlag", "sets", "the", "SetOptionsOp", "s", "SetFlags", "field" ]
[ "func", "(", "m", "SetFlag", ")", "MutateSetOptions", "(", "o", "*", "xdr", ".", "SetOptionsOp", ")", "(", "err", "error", ")", "{", "if", "!", "isFlagValid", "(", "xdr", ".", "AccountFlags", "(", "m", ")", ")", "{", "return", "<mask>", ".", "New", "(", "\"", "\"", ")", "\n", "}", "\n\n", "var", "val", "xdr", ".", "Uint32", "\n", "if", "o", ".", "SetFlags", "==", "nil", "{", "val", "=", "xdr", ".", "Uint32", "(", "m", ")", "\n", "}", "else", "{", "val", "=", "xdr", ".", "Uint32", "(", "m", ")", "|", "*", "o", ".", "SetFlags", "\n", "}", "\n", "o", ".", "SetFlags", "=", "&", "val", "\n", "return", "\n", "}" ]
7,839
all-7840
[ "SetScopeCmd", "returns", "a", "cobra", "command", "that", "lets", "a", "user", "set", "the", "level", "of", "access", "that", "another", "user", "has", "to", "a", "repo" ]
[ "func", "SetScopeCmd", "(", "noMetrics", ",", "noPortForwarding", "*", "bool", ")", "*", "cobra", ".", "Command", "{", "setScope", ":=", "&", "cobra", ".", "Command", "{", "Use", ":", "\"", "\"", ",", "Short", ":", "\"", "\"", ",", "Long", ":", "\"", "\"", "+", "\"", "\"", "+", "\"", "\\\"", "\\\"", "\\\"", "\\\"", "\"", "+", "\"", "\"", "+", "\"", "\\\"", "\\\"", "\\\"", "\\\"", "\"", "+", "\"", "\"", "+", "\"", "\"", "+", "\"", "\"", ",", "Run", ":", "cmdutil", ".", "RunFixedArgs", "(", "3", ",", "func", "(", "args", "[", "]", "string", ")", "error", "{", "scope", ",", "err", ":=", "auth", ".", "ParseScope", "(", "args", "[", "1", "]", ")", "\n", "if", "err", "!=", "nil", "{", "return", "err", "\n", "}", "\n", "username", ",", "repo", ":=", "args", "[", "0", "]", ",", "args", "[", "2", "]", "\n", "c", ",", "err", ":=", "client", ".", "NewOnUserMachine", "(", "!", "*", "noMetrics", ",", "!", "*", "noPortForwarding", ",", "\"", "\"", ")", "\n", "if", "err", "!=", "nil", "{", "return", "fmt", ".", "Errorf", "(", "\"", "\"", ",", "err", ")", "\n", "}", "\n", "defer", "c", ".", "Close", "(", ")", "\n", "_", ",", "err", "=", "c", ".", "SetScope", "(", "c", ".", "Ctx", "(", ")", ",", "&", "auth", ".", "SetScopeRequest", "{", "Repo", ":", "repo", ",", "Scope", ":", "<mask>", ",", "Username", ":", "username", ",", "}", ")", "\n", "return", "grpcutil", ".", "ScrubGRPC", "(", "err", ")", "\n", "}", ")", ",", "}", "\n", "return", "cmdutil", ".", "CreateAlias", "(", "setScope", ",", "\"", "\"", ")", "\n", "}" ]
7,840
all-7841
[ "Group", "calls", "the", "specified", "function", "with", "the", "subrouter", "for", "the", "given", "pattern" ]
[ "func", "(", "r", "*", "Router", ")", "Group", "(", "pattern", "string", ",", "group", "func", "(", "*", "Router", ")", ")", "{", "c", ":=", "r", ".", "pattern", "(", "pattern", ")", "\n", "group", "(", "r", ".", "<mask>", "(", "c", ")", ")", "\n", "}" ]
7,841
all-7842
[ "StopEmission", "is", "a", "wrapper", "around", "g_signal_stop_emission_by_name", "()", "." ]
[ "func", "(", "v", "*", "<mask>", ")", "StopEmission", "(", "s", "string", ")", "{", "cstr", ":=", "C", ".", "CString", "(", "s", ")", "\n", "defer", "C", ".", "free", "(", "unsafe", ".", "Pointer", "(", "cstr", ")", ")", "\n", "C", ".", "g_signal_stop_emission_by_name", "(", "(", "C", ".", "gpointer", ")", "(", "v", ".", "GObject", ")", ",", "(", "*", "C", ".", "gchar", ")", "(", "cstr", ")", ")", "\n", "}" ]
7,842
all-7843
[ "native", "returns", "a", "pointer", "to", "the", "underlying", "GSource", "." ]
[ "func", "(", "v", "*", "<mask>", ")", "native", "(", ")", "*", "C", ".", "GSource", "{", "if", "v", "==", "nil", "{", "return", "nil", "\n", "}", "\n", "return", "(", "*", "C", ".", "GSource", ")", "(", "v", ")", "\n", "}" ]
7,843
all-7844
[ "addFile", "adds", "the", "file", "described", "by", "info", "to", "a", "target", "in", "the", "package", "p", "if", "the", "file", "is", "buildable", ".", "cgo", "tells", "whether", "any", ".", "go", "file", "in", "the", "package", "contains", "cgo", "code", ".", "This", "affects", "whether", "C", "files", "are", "added", "to", "targets", ".", "An", "error", "is", "returned", "if", "a", "file", "is", "buildable", "but", "invalid", "(", "for", "example", "a", "test", ".", "go", "file", "containing", "cgo", "code", ")", ".", "Files", "that", "are", "not", "buildable", "will", "not", "be", "added", "to", "any", "target", "(", "for", "example", ".", "txt", "files", ")", "." ]
[ "func", "(", "pkg", "*", "goPackage", ")", "addFile", "(", "c", "*", "config", ".", "Config", ",", "info", "fileInfo", ",", "cgo", "bool", ")", "error", "{", "switch", "{", "case", "info", ".", "ext", "==", "unknownExt", "||", "!", "cgo", "&&", "(", "info", ".", "ext", "==", "cExt", "||", "info", ".", "ext", "==", "csExt", ")", ":", "return", "nil", "\n", "case", "info", ".", "ext", "==", "protoExt", ":", "if", "pcMode", ":=", "getProtoMode", "(", "c", ")", ";", "pcMode", "==", "proto", ".", "LegacyMode", "{", "// Only add files in legacy mode. This is used to generate a filegroup", "// that contains all protos. In order modes, we get the .proto files", "// from information emitted by the proto language extension.", "pkg", ".", "proto", ".", "addFile", "(", "c", ",", "info", ")", "\n", "}", "\n", "case", "info", ".", "isTest", ":", "if", "info", ".", "isCgo", "{", "return", "fmt", ".", "Errorf", "(", "\"", "\"", ",", "<mask>", ".", "path", ")", "\n", "}", "\n", "pkg", ".", "test", ".", "addFile", "(", "c", ",", "info", ")", "\n", "default", ":", "pkg", ".", "library", ".", "addFile", "(", "c", ",", "info", ")", "\n", "}", "\n\n", "return", "nil", "\n", "}" ]
7,844
all-7845
[ "Int", "adds", "an", "int", "-", "valued", "key", ":", "value", "pair", "to", "a", "Span", ".", "LogFields", "()", "record" ]
[ "func", "Int", "(", "<mask>", "string", ",", "val", "int", ")", "Field", "{", "return", "Field", "{", "key", ":", "key", ",", "fieldType", ":", "intType", ",", "numericVal", ":", "int64", "(", "val", ")", ",", "}", "\n", "}" ]
7,845
all-7846
[ "WriteLines", "prints", "each", "input", "item", "s", "followed", "by", "a", "newline", "to", "writer", ";", "and", "in", "addition", "it", "emits", "s", ".", "Therefore", "WriteLines", "()", "can", "be", "used", "like", "the", "tee", "command", "which", "can", "often", "be", "useful", "for", "debugging", "." ]
[ "func", "WriteLines", "(", "writer", "io", ".", "Writer", ")", "<mask>", "{", "return", "FilterFunc", "(", "func", "(", "arg", "Arg", ")", "error", "{", "for", "s", ":=", "range", "arg", ".", "In", "{", "if", "_", ",", "err", ":=", "writer", ".", "Write", "(", "append", "(", "[", "]", "byte", "(", "s", ")", ",", "'\\n'", ")", ")", ";", "err", "!=", "nil", "{", "return", "err", "\n", "}", "\n", "arg", ".", "Out", "<-", "s", "\n", "}", "\n", "return", "nil", "\n", "}", ")", "\n", "}" ]
7,846
all-7847
[ "SetPoolLimit", "sets", "the", "maximum", "number", "of", "sockets", "in", "use", "in", "a", "single", "server", "before", "this", "session", "will", "block", "waiting", "for", "a", "socket", "to", "be", "available", ".", "The", "default", "limit", "is", "4096", ".", "This", "limit", "must", "be", "set", "to", "cover", "more", "than", "any", "expected", "workload", "of", "the", "application", ".", "It", "is", "a", "bad", "practice", "and", "an", "unsupported", "use", "case", "to", "use", "the", "database", "driver", "to", "define", "the", "concurrency", "limit", "of", "an", "application", ".", "Prevent", "such", "concurrency", "at", "the", "door", "instead", "by", "properly", "restricting", "the", "amount", "of", "used", "resources", "and", "number", "of", "goroutines", "before", "they", "are", "created", "." ]
[ "func", "(", "s", "*", "<mask>", ")", "SetPoolLimit", "(", "limit", "int", ")", "{", "s", ".", "m", ".", "Lock", "(", ")", "\n", "s", ".", "poolLimit", "=", "limit", "\n", "s", ".", "m", ".", "Unlock", "(", ")", "\n", "}" ]
7,847
all-7848
[ "FromFirst", "returns", "a", "function", "that", "runs", "multiple", "token", "extractors", "and", "takes", "the", "first", "token", "it", "finds" ]
[ "func", "FromFirst", "(", "extractors", "...", "TokenExtractor", ")", "TokenExtractor", "{", "return", "func", "(", "r", "*", "<mask>", ".", "Request", ")", "(", "string", ",", "error", ")", "{", "for", "_", ",", "ex", ":=", "range", "extractors", "{", "token", ",", "err", ":=", "ex", "(", "r", ")", "\n", "if", "err", "!=", "nil", "{", "return", "\"", "\"", ",", "err", "\n", "}", "\n", "if", "token", "!=", "\"", "\"", "{", "return", "token", ",", "nil", "\n", "}", "\n", "}", "\n", "return", "\"", "\"", ",", "nil", "\n", "}", "\n", "}" ]
7,848
all-7849
[ "Store", "stores", "an", "error", "into", "the", "request", "s", "context", ".", "It", "panics", "if", "the", "request", "was", "not", "configured", "to", "store", "errors", "." ]
[ "func", "<mask>", "(", "r", "*", "http", ".", "Request", ",", "err", "error", ")", "{", "errptr", ",", "ok", ":=", "r", ".", "Context", "(", ")", ".", "Value", "(", "errorKey", ")", ".", "(", "*", "error", ")", "\n", "if", "!", "ok", "{", "panic", "(", "\"", "\"", ")", "\n", "}", "\n", "// check err after checking context to fail fast if unconfigured", "if", "err", "!=", "nil", "{", "*", "errptr", "=", "err", "\n", "}", "\n", "}" ]
7,849
all-7850
[ "/", "*", "GtkDialog", "GetActionArea", "()", "is", "a", "wrapper", "around", "gtk_dialog_get_action_area", "()", "." ]
[ "func", "(", "v", "*", "Dialog", ")", "GetActionArea", "(", ")", "(", "*", "Widget", ",", "<mask>", ")", "{", "c", ":=", "C", ".", "gtk_dialog_get_action_area", "(", "v", ".", "native", "(", ")", ")", "\n", "if", "c", "==", "nil", "{", "return", "nil", ",", "nilPtrErr", "\n", "}", "\n", "return", "wrapWidget", "(", "glib", ".", "Take", "(", "unsafe", ".", "Pointer", "(", "c", ")", ")", ")", ",", "nil", "\n", "}" ]
7,850
all-7851
[ "NewDAG", "creates", "a", "DAG", "and", "populates", "it", "with", "the", "given", "nodes", "." ]
[ "func", "NewDAG", "(", "nodes", "map", "[", "string", "]", "[", "]", "string", ")", "*", "DAG", "{", "result", ":=", "&", "DAG", "{", "parents", ":", "make", "(", "map", "[", "string", "]", "[", "]", "string", ")", ",", "children", ":", "make", "(", "map", "[", "string", "]", "[", "]", "string", ")", ",", "leaves", ":", "make", "(", "map", "[", "string", "]", "bool", ")", ",", "}", "\n", "for", "id", ",", "parents", ":=", "range", "nodes", "{", "<mask>", ".", "NewNode", "(", "id", ",", "parents", ")", "\n", "}", "\n", "return", "result", "\n", "}" ]
7,851
all-7852
[ "WithScreenshot", "if", "set", "a", "screenshot", "of", "the", "frame", "will", "be", "captured", "and", "returned", "in", "the", "response", ".", "Otherwise", "no", "screenshot", "will", "be", "captured", ".", "Note", "that", "capturing", "a", "screenshot", "can", "fail", "for", "example", "during", "renderer", "initialization", ".", "In", "such", "a", "case", "no", "screenshot", "data", "will", "be", "returned", "." ]
[ "func", "(", "p", "BeginFrameParams", ")", "WithScreenshot", "(", "screenshot", "*", "ScreenshotParams", ")", "*", "BeginFrameParams", "{", "p", ".", "Screenshot", "=", "screenshot", "\n", "<mask>", "&", "p", "\n", "}" ]
7,852
all-7853
[ "Initialize", "GenMetadata", "from", "each", "SS", "API", "generated", "metadata" ]
[ "func", "setupMetadata", "(", ")", "(", "<mask>", "map", "[", "string", "]", "*", "metadata", ".", "Resource", ")", "{", "result", "=", "make", "(", "map", "[", "string", "]", "*", "metadata", ".", "Resource", ")", "\n", "for", "n", ",", "r", ":=", "range", "ssd", ".", "GenMetadata", "{", "result", "[", "n", "]", "=", "r", "\n", "for", "_", ",", "a", ":=", "range", "r", ".", "Actions", "{", "for", "_", ",", "p", ":=", "range", "a", ".", "PathPatterns", "{", "// remove \"/api/designer\" prefix", "p", ".", "Regexp", "=", "removePrefixes", "(", "p", ".", "Regexp", ",", "2", ")", "\n", "}", "\n", "}", "\n", "}", "\n", "for", "n", ",", "r", ":=", "range", "ssc", ".", "GenMetadata", "{", "result", "[", "n", "]", "=", "r", "\n", "for", "_", ",", "a", ":=", "range", "r", ".", "Actions", "{", "for", "_", ",", "p", ":=", "range", "a", ".", "PathPatterns", "{", "// remove \"/api/catalog\" prefix", "p", ".", "Regexp", "=", "removePrefixes", "(", "p", ".", "Regexp", ",", "2", ")", "\n", "}", "\n", "}", "\n", "}", "\n", "for", "n", ",", "r", ":=", "range", "ssm", ".", "GenMetadata", "{", "result", "[", "n", "]", "=", "r", "\n", "for", "_", ",", "a", ":=", "range", "r", ".", "Actions", "{", "for", "_", ",", "p", ":=", "range", "a", ".", "PathPatterns", "{", "// remove \"/api/manager\" prefix", "p", ".", "Regexp", "=", "removePrefixes", "(", "p", ".", "Regexp", ",", "2", ")", "\n", "}", "\n", "}", "\n", "}", "\n", "return", "\n", "}" ]
7,853
all-7854
[ "MarshalJSON", "supports", "json", ".", "Marshaler", "interface" ]
[ "func", "(", "v", "ReadParams", ")", "MarshalJSON", "(", ")", "(", "[", "]", "byte", ",", "error", ")", "{", "w", ":=", "jwriter", ".", "Writer", "{", "}", "\n", "easyjsonC5a4559bEncodeGithubComChromedpCdprotoIo3", "(", "&", "w", ",", "v", ")", "\n", "return", "w", ".", "Buffer", ".", "BuildBytes", "(", ")", ",", "w", ".", "<mask>", "\n", "}" ]
7,854
all-7855
[ "GetPlaceholderText", "()", "is", "a", "wrapper", "around", "gtk_entry_get_placeholder_text", "()", "." ]
[ "func", "(", "v", "*", "<mask>", ")", "GetPlaceholderText", "(", ")", "(", "string", ",", "error", ")", "{", "c", ":=", "C", ".", "gtk_entry_get_placeholder_text", "(", "v", ".", "native", "(", ")", ")", "\n", "if", "c", "==", "nil", "{", "return", "\"", "\"", ",", "nilPtrErr", "\n", "}", "\n", "return", "goString", "(", "c", ")", ",", "nil", "\n", "}" ]
7,855
all-7856
[ "MarshalJSON", "supports", "json", ".", "Marshaler", "interface" ]
[ "func", "(", "v", "EventRequestPaused", ")", "MarshalJSON", "(", ")", "(", "[", "]", "<mask>", ",", "error", ")", "{", "w", ":=", "jwriter", ".", "Writer", "{", "}", "\n", "easyjsonC5a4559bEncodeGithubComChromedpCdprotoFetch8", "(", "&", "w", ",", "v", ")", "\n", "return", "w", ".", "Buffer", ".", "BuildBytes", "(", ")", ",", "w", ".", "Error", "\n", "}" ]
7,856
all-7857
[ "QueryConfigOptionDescriptor", "returns", "a", "list", "the", "list", "of", "ConfigOption", "keys", "available", "on", "the", "environment", "that", "this", "browser", "targets", ".", "The", "keys", "can", "be", "used", "as", "query", "options", "for", "DefaultDevices", "and", "other", "functions", "facilitating", "the", "specification", "of", "results", "specific", "to", "a", "certain", "VM", "version", "." ]
[ "func", "(", "b", "*", "EnvironmentBrowser", ")", "QueryConfigOptionDescriptor", "(", "ctx", "context", ".", "Context", ")", "(", "[", "]", "types", ".", "VirtualMachineConfigOptionDescriptor", ",", "error", ")", "{", "req", ":=", "<mask>", ".", "QueryConfigOptionDescriptor", "{", "This", ":", "b", ".", "Reference", "(", ")", ",", "}", "\n", "res", ",", "err", ":=", "methods", ".", "QueryConfigOptionDescriptor", "(", "ctx", ",", "b", ".", "Client", "(", ")", ",", "&", "req", ")", "\n", "if", "err", "!=", "nil", "{", "return", "nil", ",", "err", "\n", "}", "\n", "return", "res", ".", "Returnval", ",", "nil", "\n", "}" ]
7,857
all-7858
[ "optionsForRepo", "gets", "the", "plugins", ".", "Lgtm", "struct", "that", "is", "applicable", "to", "the", "indicated", "repo", "." ]
[ "func", "optionsForRepo", "(", "config", "*", "plugins", ".", "Configuration", ",", "org", ",", "repo", "string", ")", "*", "plugins", ".", "Lgtm", "{", "fullName", ":=", "fmt", ".", "Sprintf", "(", "\"", "\"", ",", "org", ",", "repo", ")", "\n", "for", "i", ":=", "range", "config", ".", "Lgtm", "{", "if", "!", "strInSlice", "(", "org", ",", "config", ".", "Lgtm", "[", "i", "]", ".", "Repos", ")", "&&", "!", "strInSlice", "(", "fullName", ",", "config", ".", "Lgtm", "[", "i", "]", ".", "Repos", ")", "{", "<mask>", "\n", "}", "\n", "return", "&", "config", ".", "Lgtm", "[", "i", "]", "\n", "}", "\n", "return", "&", "plugins", ".", "Lgtm", "{", "}", "\n", "}" ]
7,858
all-7859
[ "UpdateDeps", "is", "used", "to", "update", "the", "values", "of", "the", "dependencies", "for", "a", "template" ]
[ "func", "(", "d", "*", "DedupManager", ")", "UpdateDeps", "(", "t", "*", "template", ".", "Template", ",", "deps", "[", "]", "dep", ".", "Dependency", ")", "error", "{", "// Calculate the path to write updates to", "dataPath", ":=", "path", ".", "Join", "(", "*", "d", ".", "config", ".", "Prefix", ",", "t", ".", "ID", "(", ")", ",", "\"", "\"", ")", "\n\n", "// Package up the dependency data", "td", ":=", "templateData", "{", "Version", ":", "version", ".", "Version", ",", "Data", ":", "make", "(", "map", "[", "string", "]", "interface", "{", "}", ")", ",", "}", "\n", "for", "_", ",", "dp", ":=", "range", "deps", "{", "// Skip any dependencies that can't be shared", "if", "!", "dp", ".", "CanShare", "(", ")", "{", "continue", "\n", "}", "\n\n", "// Pull the current value from the brain", "val", ",", "<mask>", ":=", "d", ".", "brain", ".", "Recall", "(", "dp", ")", "\n", "if", "ok", "{", "td", ".", "Data", "[", "dp", ".", "String", "(", ")", "]", "=", "val", "\n", "}", "\n", "}", "\n\n", "// Compute stable hash of the data. Note we don't compute this over the actual", "// encoded value since gob encoding does not guarantee stable ordering for", "// maps so spuriously returns a different hash most times. See", "// https://github.com/hashicorp/consul-template/issues/1099.", "hash", ",", "err", ":=", "hashstructure", ".", "Hash", "(", "td", ",", "nil", ")", "\n", "if", "err", "!=", "nil", "{", "return", "fmt", ".", "Errorf", "(", "\"", "\"", ",", "err", ")", "\n", "}", "\n", "d", ".", "lastWriteLock", ".", "RLock", "(", ")", "\n", "existing", ",", "ok", ":=", "d", ".", "lastWrite", "[", "t", "]", "\n", "d", ".", "lastWriteLock", ".", "RUnlock", "(", ")", "\n", "if", "ok", "&&", "existing", "==", "hash", "{", "log", ".", "Printf", "(", "\"", "\"", ",", "dataPath", ")", "\n", "return", "nil", "\n", "}", "\n\n", "// Encode via GOB and LZW compress", "var", "buf", "bytes", ".", "Buffer", "\n", "compress", ":=", "lzw", ".", "NewWriter", "(", "&", "buf", ",", "lzw", ".", "LSB", ",", "8", ")", "\n", "enc", ":=", "gob", ".", "NewEncoder", "(", "compress", ")", "\n", "if", "err", ":=", "enc", ".", "Encode", "(", "&", "td", ")", ";", "err", "!=", "nil", "{", "return", "fmt", ".", "Errorf", "(", "\"", "\"", ",", "err", ")", "\n", "}", "\n", "compress", ".", "Close", "(", ")", "\n\n", "// Write the KV update", "kvPair", ":=", "consulapi", ".", "KVPair", "{", "Key", ":", "dataPath", ",", "Value", ":", "buf", ".", "Bytes", "(", ")", ",", "Flags", ":", "templateDataFlag", ",", "}", "\n", "client", ":=", "d", ".", "clients", ".", "Consul", "(", ")", "\n", "if", "_", ",", "err", ":=", "client", ".", "KV", "(", ")", ".", "Put", "(", "&", "kvPair", ",", "nil", ")", ";", "err", "!=", "nil", "{", "return", "fmt", ".", "Errorf", "(", "\"", "\"", ",", "dataPath", ",", "err", ")", "\n", "}", "\n", "log", ".", "Printf", "(", "\"", "\"", ",", "dataPath", ")", "\n", "d", ".", "lastWriteLock", ".", "Lock", "(", ")", "\n", "d", ".", "lastWrite", "[", "t", "]", "=", "hash", "\n", "d", ".", "lastWriteLock", ".", "Unlock", "(", ")", "\n", "return", "nil", "\n", "}" ]
7,859
all-7860
[ "UnmarshalJSON", "supports", "json", ".", "Unmarshaler", "interface" ]
[ "func", "(", "v", "*", "ReleaseSnapshotParams", ")", "UnmarshalJSON", "(", "data", "[", "]", "byte", ")", "error", "{", "r", ":=", "jlexer", ".", "Lexer", "{", "Data", ":", "data", "}", "\n", "easyjsonC5a4559bDecodeGithubComChromedpCdprotoLayertree6", "(", "&", "r", ",", "v", ")", "\n", "return", "r", ".", "<mask>", "(", ")", "\n", "}" ]
7,860
all-7861
[ "Next", "returns", "the", "next", "logical", "network", "number", "." ]
[ "func", "(", "n", "NetworkNumber", ")", "Next", "(", ")", "NetworkNumber", "{", "newIP", ":=", "<mask>", "(", "NetworkNumber", ",", "len", "(", "n", ")", ")", "\n", "copy", "(", "newIP", ",", "n", ")", "\n", "for", "i", ":=", "len", "(", "newIP", ")", "-", "1", ";", "i", ">=", "0", ";", "i", "--", "{", "newIP", "[", "i", "]", "++", "\n", "if", "newIP", "[", "i", "]", ">", "0", "{", "break", "\n", "}", "\n", "}", "\n", "return", "newIP", "\n", "}" ]
7,861
all-7862
[ "connect", "establishes", "a", "new", "connection", "using", "the", "specified", "transport", "." ]
[ "func", "(", "f", "*", "Fluent", ")", "connect", "(", ")", "(", "err", "error", ")", "{", "host", ",", "port", ",", "err", ":=", "<mask>", ".", "SplitHostPort", "(", "f", ".", "Server", ")", "\n", "if", "err", "!=", "nil", "{", "return", "err", "\n", "}", "\n", "addrs", ",", "err", ":=", "net", ".", "LookupHost", "(", "host", ")", "\n", "if", "err", "!=", "nil", "||", "len", "(", "addrs", ")", "==", "0", "{", "return", "err", "\n", "}", "\n", "// for DNS round robin", "n", ":=", "Rand", ".", "Intn", "(", "len", "(", "addrs", ")", ")", "\n", "addr", ":=", "addrs", "[", "n", "]", "\n", "var", "format", "string", "\n", "if", "strings", ".", "Contains", "(", "addr", ",", "\"", "\"", ")", "{", "// v6", "format", "=", "\"", "\"", "\n", "}", "else", "{", "// v4", "format", "=", "\"", "\"", "\n", "}", "\n", "resolved", ":=", "fmt", ".", "Sprintf", "(", "format", ",", "addr", ",", "port", ")", "\n", "log", ".", "Printf", "(", "\"", "\"", ",", "f", ".", "Server", ",", "resolved", ")", "\n", "f", ".", "conn", ",", "err", "=", "net", ".", "DialTimeout", "(", "\"", "\"", ",", "resolved", ",", "f", ".", "Config", ".", "Timeout", ")", "\n", "f", ".", "recordError", "(", "err", ")", "\n", "return", "\n", "}" ]
7,862
all-7863
[ "determine", "if", "a", "name", "corresponds", "to", "a", "sampler", "object" ]
[ "func", "IsSampler", "(", "sampler", "uint32", ")", "bool", "{", "ret", ":=", "C", ".", "glowIsSampler", "(", "gpIsSampler", ",", "(", "C", ".", "GLuint", ")", "(", "sampler", ")", ")", "\n", "return", "<mask>", "==", "TRUE", "\n", "}" ]
7,863
all-7864
[ "lz4", ".", "Reader", "fuzz", "function" ]
[ "func", "Fuzz", "(", "data", "[", "]", "byte", ")", "int", "{", "// uncompress some data", "d", ",", "err", ":=", "ioutil", ".", "ReadAll", "(", "lz4", ".", "NewReader", "(", "<mask>", ".", "NewReader", "(", "data", ")", ")", ")", "\n", "if", "err", "!=", "nil", "{", "return", "0", "\n", "}", "\n\n", "// got valid compressed data", "// compress the uncompressed data", "// and compare with the original input", "buf", ":=", "bytes", ".", "NewBuffer", "(", "nil", ")", "\n", "zw", ":=", "lz4", ".", "NewWriter", "(", "buf", ")", "\n", "n", ",", "err", ":=", "zw", ".", "Write", "(", "d", ")", "\n", "if", "err", "!=", "nil", "{", "panic", "(", "err", ")", "\n", "}", "\n", "if", "n", "!=", "len", "(", "d", ")", "{", "panic", "(", "\"", "\"", ")", "\n", "}", "\n", "err", "=", "zw", ".", "Close", "(", ")", "\n", "if", "err", "!=", "nil", "{", "panic", "(", "err", ")", "\n", "}", "\n\n", "// uncompress the newly compressed data", "ud", ",", "err", ":=", "ioutil", ".", "ReadAll", "(", "lz4", ".", "NewReader", "(", "buf", ")", ")", "\n", "if", "err", "!=", "nil", "{", "panic", "(", "err", ")", "\n", "}", "\n", "if", "bytes", ".", "Compare", "(", "d", ",", "ud", ")", "!=", "0", "{", "panic", "(", "\"", "\"", ")", "\n", "}", "\n\n", "return", "1", "\n", "}" ]
7,864
all-7865
[ "WithContext", "adds", "the", "context", "to", "the", "get", "apps", "params" ]
[ "func", "(", "o", "*", "GetAppsParams", ")", "WithContext", "(", "ctx", "<mask>", ".", "Context", ")", "*", "GetAppsParams", "{", "o", ".", "SetContext", "(", "ctx", ")", "\n", "return", "o", "\n", "}" ]
7,865
all-7866
[ "resourceVSphereVAppContainerApplyTags", "processes", "the", "tags", "step", "for", "both", "create", "and", "update", "for", "vsphere_vapp_container", "." ]
[ "func", "resourceVSphereVAppContainerApplyTags", "(", "d", "*", "schema", ".", "ResourceData", ",", "meta", "<mask>", "{", "}", ",", "va", "*", "object", ".", "VirtualApp", ")", "error", "{", "tagsClient", ",", "err", ":=", "tagsClientIfDefined", "(", "d", ",", "meta", ")", "\n", "if", "err", "!=", "nil", "{", "return", "err", "\n", "}", "\n\n", "// Apply any pending tags now.", "if", "tagsClient", "==", "nil", "{", "log", ".", "Printf", "(", "\"", "\"", ",", "resourceVSphereComputeClusterIDString", "(", "d", ")", ")", "\n", "return", "nil", "\n", "}", "\n\n", "log", ".", "Printf", "(", "\"", "\"", ",", "resourceVSphereVAppContainerIDString", "(", "d", ")", ")", "\n", "return", "processTagDiff", "(", "tagsClient", ",", "d", ",", "va", ")", "\n", "}" ]
7,866
all-7867
[ "Recover", "from", "panic", "and", "log", "the", "stack", ".", "If", "notexit", "is", "false", "call", "os", ".", "Exit", "(", "1", ")", "if", "not", "continue", "." ]
[ "func", "Recover", "(", "notexit", "bool", ")", "{", "if", "r", ":=", "recover", "(", ")", ";", "r", "!=", "nil", "{", "buf", ":=", "make", "(", "[", "]", "byte", ",", "RecoverBufferStack", ")", "\n", "n", ":=", "runtime", ".", "Stack", "(", "buf", ",", "true", ")", "\n", "buf", "=", "buf", "[", ":", "n", "]", "\n", "<mask>", ".", "GoPanic", "(", "r", ",", "buf", ",", "notexit", ")", "\n", "}", "\n", "}" ]
7,867
all-7868
[ "TODO", "(", "dsymonds", ")", ":", "Do", "we", "need", "to", "support", "default", "values", "like", "Python?" ]
[ "func", "mustGetMetadata", "(", "key", "string", ")", "[", "]", "byte", "{", "b", ",", "err", ":=", "getMetadata", "(", "key", ")", "\n", "if", "err", "!=", "nil", "{", "panic", "(", "fmt", ".", "Sprintf", "(", "\"", "\"", ",", "<mask>", ",", "err", ")", ")", "\n", "}", "\n", "return", "b", "\n", "}" ]
7,868
all-7869
[ "Transaction", "creates", "a", "new", "NodeTx", "object", "and", "transactionally", "executes", "the", "node", "-", "level", "database", "interactions", "invoked", "by", "the", "given", "function", ".", "If", "the", "function", "returns", "no", "error", "all", "database", "changes", "are", "committed", "to", "the", "node", "-", "level", "database", "otherwise", "they", "are", "rolled", "back", "." ]
[ "func", "(", "n", "*", "Node", ")", "Transaction", "(", "f", "func", "(", "*", "NodeTx", ")", "error", ")", "error", "{", "nodeTx", ":=", "&", "NodeTx", "{", "}", "\n", "return", "query", ".", "Transaction", "(", "n", ".", "<mask>", ",", "func", "(", "tx", "*", "sql", ".", "Tx", ")", "error", "{", "nodeTx", ".", "tx", "=", "tx", "\n", "return", "f", "(", "nodeTx", ")", "\n", "}", ")", "\n", "}" ]
7,869
all-7870
[ "Records", "returns", "the", "list", "of", "endpoints" ]
[ "func", "(", "ep", "*", "ExoscaleProvider", ")", "Records", "(", ")", "(", "[", "]", "*", "endpoint", ".", "Endpoint", ",", "error", ")", "{", "endpoints", ":=", "make", "(", "[", "]", "*", "endpoint", ".", "Endpoint", ",", "0", ")", "\n\n", "domains", ",", "err", ":=", "ep", ".", "client", ".", "GetDomains", "(", ")", "\n", "if", "err", "!=", "nil", "{", "return", "nil", ",", "err", "\n", "}", "\n\n", "for", "_", ",", "d", ":=", "range", "domains", "{", "record", ",", "err", ":=", "ep", ".", "client", ".", "GetRecords", "(", "d", ".", "Name", ")", "\n", "if", "err", "!=", "nil", "{", "return", "nil", ",", "err", "\n", "}", "\n", "for", "_", ",", "r", ":=", "range", "record", "{", "switch", "r", ".", "RecordType", "{", "case", "egoscale", ".", "A", ".", "String", "(", ")", ",", "egoscale", ".", "CNAME", ".", "String", "(", ")", ",", "egoscale", ".", "TXT", ".", "<mask>", "(", ")", ":", "break", "\n", "default", ":", "continue", "\n", "}", "\n", "ep", ":=", "endpoint", ".", "NewEndpointWithTTL", "(", "r", ".", "Name", "+", "\"", "\"", "+", "d", ".", "Name", ",", "r", ".", "RecordType", ",", "endpoint", ".", "TTL", "(", "r", ".", "TTL", ")", ",", "r", ".", "Content", ")", "\n", "endpoints", "=", "append", "(", "endpoints", ",", "ep", ")", "\n", "}", "\n", "}", "\n\n", "log", ".", "Infof", "(", "\"", "\"", ",", "len", "(", "endpoints", ")", ")", "\n", "return", "endpoints", ",", "nil", "\n", "}" ]
7,870
all-7871
[ "GetCountOk", "returns", "a", "tuple", "with", "the", "Count", "field", "if", "it", "s", "non", "-", "nil", "zero", "value", "otherwise", "and", "a", "boolean", "to", "check", "if", "the", "value", "has", "been", "set", "." ]
[ "func", "(", "p", "*", "Params", ")", "GetCountOk", "(", ")", "(", "string", ",", "bool", ")", "{", "if", "p", "==", "nil", "||", "p", ".", "Count", "==", "nil", "{", "return", "\"", "\"", ",", "false", "\n", "}", "\n", "return", "*", "p", ".", "Count", ",", "<mask>", "\n", "}" ]
7,871
all-7872
[ "GetAllProjects", "retrieves", "and", "returns", "all", "of", "the", "projects", "defined", "in", "the", "Rundeck", "server", "." ]
[ "func", "(", "c", "*", "<mask>", ")", "GetAllProjects", "(", ")", "(", "[", "]", "ProjectSummary", ",", "error", ")", "{", "p", ":=", "&", "projects", "{", "}", "\n", "err", ":=", "c", ".", "get", "(", "[", "]", "string", "{", "\"", "\"", "}", ",", "nil", ",", "p", ")", "\n", "return", "p", ".", "Projects", ",", "err", "\n", "}" ]
7,872
all-7873
[ "NewTransactionHistoryEntryExt", "creates", "a", "new", "TransactionHistoryEntryExt", "." ]
[ "func", "NewTransactionHistoryEntryExt", "(", "v", "int32", ",", "value", "interface", "{", "}", ")", "(", "result", "TransactionHistoryEntryExt", ",", "err", "error", ")", "{", "result", ".", "V", "=", "v", "\n", "switch", "int32", "(", "v", ")", "{", "<mask>", "0", ":", "// void", "}", "\n", "return", "\n", "}" ]
7,873
all-7874
[ "ReadBool", "reads", "and", "returns", "a", "boolean", "." ]
[ "func", "(", "r", "*", "Reader", ")", "ReadBool", "(", ")", "bool", "{", "if", "r", ".", "err", "!=", "nil", "{", "return", "<mask>", "\n", "}", "\n", "return", "!", "(", "r", ".", "ReadB", "(", ")", "==", "0", ")", "\n", "}" ]
7,874
all-7875
[ "NewController", "creates", "a", "new", "Controller", "from", "the", "provided", "clients", "." ]
[ "func", "NewController", "(", "kc", "*", "kube", ".", "Client", ",", "pkcs", "map", "[", "string", "]", "*", "kube", ".", "Client", ",", "ghc", "GitHubClient", ",", "logger", "*", "logrus", ".", "Entry", ",", "cfg", "config", ".", "Getter", ",", "totURL", ",", "selector", "string", ",", "skipReport", "bool", ")", "(", "*", "Controller", ",", "error", ")", "{", "if", "logger", "==", "nil", "{", "logger", "=", "logrus", ".", "NewEntry", "(", "logrus", ".", "StandardLogger", "(", ")", ")", "\n", "}", "\n", "buildClusters", ":=", "map", "[", "string", "]", "kubeClient", "{", "}", "\n", "for", "alias", ",", "client", ":=", "range", "pkcs", "{", "buildClusters", "[", "alias", "]", "=", "kubeClient", "(", "client", ")", "\n", "}", "\n", "return", "&", "Controller", "{", "kc", ":", "kc", ",", "pkcs", ":", "buildClusters", ",", "ghc", ":", "ghc", ",", "log", ":", "logger", ",", "config", ":", "cfg", ",", "pendingJobs", ":", "make", "(", "<mask>", "[", "string", "]", "int", ")", ",", "totURL", ":", "totURL", ",", "selector", ":", "selector", ",", "skipReport", ":", "skipReport", ",", "}", ",", "nil", "\n", "}" ]
7,875
all-7876
[ "/", "*", "PangoFontDescription" ]
[ "func", "marshalFontDescription", "(", "p", "uintptr", ")", "(", "<mask>", "{", "}", ",", "error", ")", "{", "c", ":=", "C", ".", "g_value_get_boxed", "(", "(", "*", "C", ".", "GValue", ")", "(", "unsafe", ".", "Pointer", "(", "p", ")", ")", ")", "\n", "c2", ":=", "(", "*", "C", ".", "PangoFontDescription", ")", "(", "unsafe", ".", "Pointer", "(", "c", ")", ")", "\n", "return", "wrapFontDescription", "(", "c2", ")", ",", "nil", "\n", "}" ]
7,876
all-7877
[ "VisitUserValues", "calls", "visitor", "for", "each", "existing", "userValue", ".", "visitor", "must", "not", "retain", "references", "to", "key", "and", "value", "after", "returning", ".", "Make", "key", "and", "/", "or", "value", "copies", "if", "you", "need", "storing", "them", "after", "returning", "." ]
[ "func", "(", "ctx", "*", "RequestCtx", ")", "VisitUserValues", "(", "visitor", "func", "(", "[", "]", "byte", ",", "interface", "{", "}", ")", ")", "{", "for", "i", ",", "n", ":=", "0", ",", "len", "(", "ctx", ".", "userValues", ")", ";", "i", "<", "n", ";", "i", "++", "{", "kv", ":=", "&", "ctx", ".", "userValues", "[", "i", "]", "\n", "visitor", "(", "kv", ".", "key", ",", "kv", ".", "<mask>", ")", "\n", "}", "\n", "}" ]
7,877
all-7878
[ "MarshalJSON", "supports", "json", ".", "Marshaler", "interface" ]
[ "func", "(", "v", "SetKeyframeKeyParams", ")", "MarshalJSON", "(", ")", "(", "[", "]", "byte", ",", "error", ")", "{", "w", ":=", "jwriter", ".", "<mask>", "{", "}", "\n", "easyjsonC5a4559bEncodeGithubComChromedpCdprotoCss20", "(", "&", "w", ",", "v", ")", "\n", "return", "w", ".", "Buffer", ".", "BuildBytes", "(", ")", ",", "w", ".", "Error", "\n", "}" ]
7,878
all-7879
[ "GetIPBlock", "gets", "an", "IP", "blocks" ]
[ "func", "(", "c", "*", "Client", ")", "GetIPBlock", "(", "ipblockid", "string", ")", "(", "*", "IPBlock", ",", "error", ")", "{", "url", ":=", "ipblockPath", "(", "ipblockid", ")", "+", "`?depth=`", "+", "c", ".", "<mask>", ".", "depth", "+", "`&pretty=`", "+", "strconv", ".", "FormatBool", "(", "c", ".", "client", ".", "pretty", ")", "\n", "ret", ":=", "&", "IPBlock", "{", "}", "\n", "err", ":=", "c", ".", "client", ".", "Get", "(", "url", ",", "ret", ",", "http", ".", "StatusOK", ")", "\n", "return", "ret", ",", "err", "\n", "}" ]
7,879
all-7880
[ "GetNamedType", "retrieves", "a", "type", "given", "its", "name", "." ]
[ "func", "(", "reg", "*", "TypeRegistry", ")", "GetNamedType", "(", "<mask>", "string", ")", "*", "gen", ".", "ObjectDataType", "{", "return", "reg", ".", "NamedTypes", "[", "toGoTypeName", "(", "name", ")", "]", "\n", "}" ]
7,880
all-7881
[ "CurveTo", "is", "a", "wrapper", "around", "cairo_curve_to", "()", "." ]
[ "func", "(", "v", "*", "<mask>", ")", "CurveTo", "(", "x1", ",", "y1", ",", "x2", ",", "y2", ",", "x3", ",", "y3", "float64", ")", "{", "C", ".", "cairo_curve_to", "(", "v", ".", "native", "(", ")", ",", "C", ".", "double", "(", "x1", ")", ",", "C", ".", "double", "(", "y1", ")", ",", "C", ".", "double", "(", "x2", ")", ",", "C", ".", "double", "(", "y2", ")", ",", "C", ".", "double", "(", "x3", ")", ",", "C", ".", "double", "(", "y3", ")", ")", "\n", "}" ]
7,881
all-7882
[ "Type", "returns", "the", "type", "and", "repeat", "count", "for", "the", "object", "x", ".", "x", "contains", "at", "least", "repeat", "copies", "of", "the", "returned", "type", "." ]
[ "func", "(", "p", "*", "Process", ")", "Type", "(", "x", "<mask>", ")", "(", "*", "Type", ",", "int64", ")", "{", "p", ".", "typeHeap", "(", ")", "\n\n", "i", ",", "_", ":=", "p", ".", "findObjectIndex", "(", "core", ".", "Address", "(", "x", ")", ")", "\n", "return", "p", ".", "types", "[", "i", "]", ".", "t", ",", "p", ".", "types", "[", "i", "]", ".", "r", "\n", "}" ]
7,882
all-7883
[ "void", "pango_cairo_show_layout_line", "(", "cairo_t", "*", "cr", "PangoLayoutLine", "*", "line", ")", ";" ]
[ "func", "CairoShowLayoutLine", "(", "cr", "*", "cairo", ".", "<mask>", ",", "line", "*", "LayoutLine", ")", "{", "C", ".", "pango_cairo_show_layout_line", "(", "cairo_context", "(", "cr", ")", ",", "line", ".", "native", "(", ")", ")", "\n", "}" ]
7,883
all-7884
[ "copyMetricsMetadata", "creates", "a", "new", "MetricsMetadata", "object", "from", "a", "given", "MetricsMetadata", "object", ".", "It", "copies", "all", "the", "fields", "from", "the", "source", "object", "to", "the", "new", "object", "and", "sets", "the", "Fin", "field", "as", "specified", "by", "the", "argument", "." ]
[ "func", "copyMetricsMetadata", "(", "metadata", "*", "ecstcs", ".", "MetricsMetadata", ",", "fin", "bool", ")", "*", "ecstcs", ".", "MetricsMetadata", "{", "return", "&", "ecstcs", ".", "MetricsMetadata", "{", "Cluster", ":", "aws", ".", "String", "(", "*", "metadata", ".", "Cluster", ")", ",", "ContainerInstance", ":", "aws", ".", "String", "(", "*", "metadata", ".", "ContainerInstance", ")", ",", "Idle", ":", "aws", ".", "Bool", "(", "*", "metadata", ".", "Idle", ")", ",", "MessageId", ":", "aws", ".", "String", "(", "*", "metadata", ".", "MessageId", ")", ",", "Fin", ":", "aws", ".", "Bool", "(", "<mask>", ")", ",", "}", "\n", "}" ]
7,884
all-7885
[ "Wrap", "returns", "the", "underlying", "handler", "wrapped", "in", "a", "LoggingHandler", "which", "will", "write", "to", "the", "given", "Writer", ".", "N", ".", "B", ".", ":", "You", "must", "call", "Start", "()", "on", "the", "result", "before", "using", "it", "." ]
[ "func", "Wrap", "(", "h", "<mask>", ".", "Handler", ",", "w", "io", ".", "Writer", ")", "*", "LoggingHandler", "{", "return", "&", "LoggingHandler", "{", "clock", ":", "time", ".", "Now", ",", "w", ":", "w", ",", "handler", ":", "h", ",", "buffer", ":", "make", "(", "chan", "string", ",", "1000", ")", ",", "quit", ":", "make", "(", "chan", "struct", "{", "}", ")", ",", "}", "\n", "}" ]
7,885
all-7886
[ "title", ":", "updates", "a", "role", "path", ":", "/", "roles", "method", ":", "PUT", "responses", ":", "200", ":", "Ok", "400", ":", "Invalid", "data", "401", ":", "Unauthorized" ]
[ "func", "roleUpdate", "(", "w", "http", ".", "ResponseWriter", ",", "r", "*", "http", ".", "Request", ",", "t", "auth", ".", "Token", ")", "error", "{", "roleName", ":=", "InputValue", "(", "r", ",", "\"", "\"", ")", "\n", "newName", ":=", "InputValue", "(", "r", ",", "\"", "\"", ")", "\n", "contextType", ":=", "InputValue", "(", "r", ",", "\"", "\"", ")", "\n", "<mask>", ":=", "InputValue", "(", "r", ",", "\"", "\"", ")", "\n", "var", "wantedPerms", "[", "]", "*", "permission", ".", "PermissionScheme", "\n", "if", "newName", "!=", "\"", "\"", "{", "wantedPerms", "=", "append", "(", "wantedPerms", ",", "permission", ".", "PermRoleUpdateName", ")", "\n", "}", "\n", "if", "contextType", "!=", "\"", "\"", "{", "wantedPerms", "=", "append", "(", "wantedPerms", ",", "permission", ".", "PermRoleUpdateContextType", ")", "\n", "}", "\n", "if", "description", "!=", "\"", "\"", "{", "wantedPerms", "=", "append", "(", "wantedPerms", ",", "permission", ".", "PermRoleUpdateDescription", ")", "\n", "}", "\n", "if", "len", "(", "wantedPerms", ")", "==", "0", "{", "msg", ":=", "\"", "\"", "\n", "return", "&", "errors", ".", "HTTP", "{", "Code", ":", "http", ".", "StatusBadRequest", ",", "Message", ":", "msg", "}", "\n", "}", "\n", "for", "_", ",", "perm", ":=", "range", "wantedPerms", "{", "if", "!", "permission", ".", "Check", "(", "t", ",", "perm", ")", "{", "return", "permission", ".", "ErrUnauthorized", "\n", "}", "\n", "}", "\n", "evt", ",", "err", ":=", "event", ".", "New", "(", "&", "event", ".", "Opts", "{", "Target", ":", "event", ".", "Target", "{", "Type", ":", "event", ".", "TargetTypeRole", ",", "Value", ":", "roleName", "}", ",", "Kind", ":", "permission", ".", "PermRoleUpdate", ",", "Owner", ":", "t", ",", "CustomData", ":", "event", ".", "FormToCustomData", "(", "InputFields", "(", "r", ")", ")", ",", "Allowed", ":", "event", ".", "Allowed", "(", "permission", ".", "PermRoleUpdate", ")", ",", "}", ")", "\n", "if", "err", "!=", "nil", "{", "return", "err", "\n", "}", "\n", "defer", "func", "(", ")", "{", "evt", ".", "Done", "(", "err", ")", "}", "(", ")", "\n", "err", "=", "auth", ".", "UpdateRoleFromAllUsers", "(", "roleName", ",", "newName", ",", "contextType", ",", "description", ")", "\n", "if", "err", "!=", "nil", "{", "return", "&", "errors", ".", "HTTP", "{", "Code", ":", "http", ".", "StatusBadRequest", ",", "Message", ":", "err", ".", "Error", "(", ")", ",", "}", "\n", "}", "\n", "return", "nil", "\n", "}" ]
7,886
all-7887
[ "AddDeltaJob", "adds", "a", "new", "delta", "for", "a", "specific", "job" ]
[ "func", "(", "r", "*", "<mask>", ")", "AddDeltaJob", "(", "dj", "*", "DeltaJob", ")", "{", "r", ".", "DeltaJob", "=", "append", "(", "r", ".", "DeltaJob", ",", "*", "dj", ")", "\n", "}" ]
7,887
all-7888
[ "IsAddressCovered", "detects", "if", "network", "address1", "is", "actually", "covered", "by", "address2", "in", "the", "sense", "that", "they", "are", "either", "the", "same", "address", "or", "address2", "is", "specified", "using", "a", "wildcard", "with", "the", "same", "port", "of", "address1", "." ]
[ "func", "IsAddressCovered", "(", "address1", ",", "address2", "string", ")", "bool", "{", "if", "address1", "==", "address2", "{", "return", "true", "\n", "}", "\n\n", "host1", ",", "port1", ",", "err", ":=", "net", ".", "SplitHostPort", "(", "address1", ")", "\n", "if", "err", "!=", "nil", "{", "return", "false", "\n", "}", "\n\n", "host2", ",", "port2", ",", "err", ":=", "<mask>", ".", "SplitHostPort", "(", "address2", ")", "\n", "if", "err", "!=", "nil", "{", "return", "false", "\n", "}", "\n\n", "// If the ports are different, then address1 is clearly not covered by", "// address2.", "if", "port2", "!=", "port1", "{", "return", "false", "\n", "}", "\n\n", "// If address2 is using an IPv4 wildcard for the host, then address2 is", "// only covered if it's an IPv4 address.", "if", "host2", "==", "\"", "\"", "{", "ip", ":=", "net", ".", "ParseIP", "(", "host1", ")", "\n", "if", "ip", "!=", "nil", "&&", "ip", ".", "To4", "(", ")", "!=", "nil", "{", "return", "true", "\n", "}", "\n", "return", "false", "\n", "}", "\n\n", "// If address2 is using an IPv6 wildcard for the host, then address2 is", "// always covered.", "if", "host2", "==", "\"", "\"", "||", "host2", "==", "\"", "\"", "{", "return", "true", "\n", "}", "\n\n", "return", "false", "\n", "}" ]
7,888
all-7889
[ "Send", "an", "rsync", "stream", "of", "a", "path", "over", "a", "websocket" ]
[ "func", "rsyncSend", "(", "conn", "*", "websocket", ".", "Conn", ",", "path", "string", ",", "rsyncArgs", "string", ")", "error", "{", "cmd", ",", "dataSocket", ",", "stderr", ",", "err", ":=", "rsyncSendSetup", "(", "path", ",", "rsyncArgs", ")", "\n", "if", "err", "!=", "nil", "{", "return", "err", "\n", "}", "\n\n", "if", "dataSocket", "!=", "nil", "{", "defer", "dataSocket", ".", "Close", "(", ")", "\n", "}", "\n\n", "readDone", ",", "writeDone", ":=", "shared", ".", "WebsocketMirror", "(", "<mask>", ",", "dataSocket", ",", "io", ".", "ReadCloser", "(", "dataSocket", ")", ",", "nil", ",", "nil", ")", "\n\n", "output", ",", "err", ":=", "ioutil", ".", "ReadAll", "(", "stderr", ")", "\n", "if", "err", "!=", "nil", "{", "cmd", ".", "Process", ".", "Kill", "(", ")", "\n", "cmd", ".", "Wait", "(", ")", "\n", "return", "fmt", ".", "Errorf", "(", "\"", "\\n", "\"", ",", "err", ",", "output", ")", "\n", "}", "\n\n", "err", "=", "cmd", ".", "Wait", "(", ")", "\n", "<-", "readDone", "\n", "<-", "writeDone", "\n\n", "if", "err", "!=", "nil", "{", "return", "fmt", ".", "Errorf", "(", "\"", "\\n", "\"", ",", "err", ",", "output", ")", "\n", "}", "\n\n", "return", "nil", "\n", "}" ]
7,889
all-7890
[ "JoinGroup", "is", "a", "wrapper", "around", "gtk_radio_button_join_group", "()", "." ]
[ "func", "(", "v", "*", "RadioButton", ")", "JoinGroup", "(", "groupSource", "*", "RadioButton", ")", "{", "<mask>", "cgroup", "*", "C", ".", "GtkRadioButton", "\n", "if", "groupSource", "!=", "nil", "{", "cgroup", "=", "groupSource", ".", "native", "(", ")", "\n", "}", "\n", "C", ".", "gtk_radio_button_join_group", "(", "v", ".", "native", "(", ")", ",", "cgroup", ")", "\n", "}" ]
7,890
all-7891
[ "jsonEncoder", "is", "an", "Encoder", "that", "produces", "JSON", "-", "formatted", "responses", "." ]
[ "func", "(", "_", "JsonEncoder", ")", "Encode", "(", "v", "...", "interface", "{", "}", ")", "(", "[", "]", "byte", ",", "error", ")", "{", "var", "<mask>", "interface", "{", "}", "=", "v", "\n", "var", "result", "interface", "{", "}", "\n\n", "if", "v", "==", "nil", "{", "// So that empty results produces `[]` and not `null`", "data", "=", "[", "]", "interface", "{", "}", "{", "}", "\n", "}", "else", "if", "len", "(", "v", ")", "==", "1", "{", "data", "=", "v", "[", "0", "]", "\n", "}", "\n\n", "t", ":=", "reflect", ".", "TypeOf", "(", "data", ")", "\n\n", "if", "t", ".", "Kind", "(", ")", "==", "reflect", ".", "Ptr", "{", "t", "=", "t", ".", "Elem", "(", ")", "\n", "}", "\n\n", "if", "t", ".", "Kind", "(", ")", "==", "reflect", ".", "Struct", "{", "result", "=", "copyStruct", "(", "reflect", ".", "ValueOf", "(", "data", ")", ",", "t", ")", ".", "Interface", "(", ")", "\n", "}", "else", "{", "result", "=", "data", "\n", "}", "\n\n", "b", ",", "err", ":=", "json", ".", "Marshal", "(", "result", ")", "\n\n", "return", "b", ",", "err", "\n", "}" ]
7,891
all-7892
[ "ErrorFunc", "outputs", "Error", "level", "log", "returned", "from", "the", "function" ]
[ "func", "ErrorFunc", "(", "f", "func", "(", ")", "string", ")", "error", "{", "if", "isModeEnable", "(", "ERR", ")", "{", "return", "glg", ".", "<mask>", "(", "ERR", ",", "\"", "\"", ",", "f", "(", ")", ")", "\n", "}", "\n", "return", "nil", "\n", "}" ]
7,892
all-7893
[ "Concat", "combine", "several", "arrays", "into", "single", "one", "resulting", "slice", "=", "A1", "|", "A2", "|", "A3", "|", "...", "|", "An" ]
[ "func", "Concat", "(", "arrays", "...", "[", "]", "<mask>", ")", "[", "]", "byte", "{", "var", "result", "[", "]", "byte", "=", "arrays", "[", "0", "]", "\n\n", "for", "_", ",", "arr", ":=", "range", "arrays", "[", "1", ":", "]", "{", "result", "=", "append", "(", "result", ",", "arr", "...", ")", "\n", "}", "\n\n", "return", "result", "\n", "}" ]
7,893
all-7894
[ "loadClusters", "parses", "and", "filters", "the", "json", "data", "then", "populates", "every", "Cluster", "struct", "with", "aggregated", "job", "data", "and", "totals", ".", "The", "job", "data", "specifies", "all", "jobs", "that", "failed", "in", "a", "cluster", "and", "the", "builds", "that", "failed", "for", "each", "job", "independent", "of", "which", "tests", "the", "jobs", "or", "builds", "failed", "." ]
[ "func", "(", "f", "*", "TriageFiler", ")", "loadClusters", "(", "jsonIn", "[", "]", "byte", ")", "(", "[", "]", "*", "Cluster", ",", "error", ")", "{", "var", "err", "error", "\n", "f", ".", "data", ",", "err", "=", "parseTriageData", "(", "jsonIn", ")", "\n", "if", "err", "!=", "nil", "{", "return", "nil", ",", "err", "\n", "}", "\n", "if", "err", "=", "f", ".", "filterAndValidate", "(", "f", ".", "windowDays", ")", ";", "err", "!=", "nil", "{", "return", "nil", ",", "err", "\n", "}", "\n\n", "// Aggregate failing builds in each cluster by job (independent of tests).", "for", "_", ",", "clust", ":=", "range", "f", ".", "data", ".", "Clustered", "{", "clust", ".", "filer", "=", "f", "\n", "clust", ".", "jobs", "=", "make", "(", "map", "[", "string", "]", "[", "]", "int", ")", "\n\n", "for", "_", ",", "test", ":=", "range", "clust", ".", "Tests", "{", "for", "_", ",", "job", ":=", "range", "test", ".", "Jobs", "{", "for", "_", ",", "buildnum", ":=", "range", "job", ".", "Builds", "{", "found", ":=", "false", "\n", "for", "_", ",", "oldBuild", ":=", "range", "clust", ".", "<mask>", "[", "job", ".", "Name", "]", "{", "if", "oldBuild", "==", "buildnum", "{", "found", "=", "true", "\n", "break", "\n", "}", "\n", "}", "\n", "if", "!", "found", "{", "clust", ".", "jobs", "[", "job", ".", "Name", "]", "=", "append", "(", "clust", ".", "jobs", "[", "job", ".", "Name", "]", ",", "buildnum", ")", "\n", "}", "\n", "}", "\n", "}", "\n", "}", "\n", "clust", ".", "totalJobs", "=", "len", "(", "clust", ".", "jobs", ")", "\n", "clust", ".", "totalTests", "=", "len", "(", "clust", ".", "Tests", ")", "\n", "clust", ".", "totalBuilds", "=", "0", "\n", "for", "_", ",", "builds", ":=", "range", "clust", ".", "jobs", "{", "clust", ".", "totalBuilds", "+=", "len", "(", "builds", ")", "\n", "}", "\n", "}", "\n", "return", "f", ".", "data", ".", "Clustered", ",", "nil", "\n", "}" ]
7,894
all-7895
[ "GetReadOnly", "returns", "the", "ReadOnly", "field", "if", "non", "-", "nil", "zero", "value", "otherwise", "." ]
[ "func", "(", "d", "*", "DashboardLite", ")", "GetReadOnly", "(", ")", "bool", "{", "if", "d", "==", "nil", "||", "d", ".", "ReadOnly", "==", "nil", "{", "return", "<mask>", "\n", "}", "\n", "return", "*", "d", ".", "ReadOnly", "\n", "}" ]
7,895
all-7896
[ "Meta", "returns", "a", "call", "option", "which", "attaches", "the", "given", "meta", "object", "to", "the", "JSON", "-", "RPC", "2", ".", "0", "request", "(", "this", "is", "a", "Sourcegraph", "extension", "to", "JSON", "RPC", "2", ".", "0", "for", "carrying", "metadata", ")", "." ]
[ "func", "Meta", "(", "meta", "<mask>", "{", "}", ")", "CallOption", "{", "return", "callOptionFunc", "(", "func", "(", "r", "*", "Request", ")", "error", "{", "return", "r", ".", "SetMeta", "(", "meta", ")", "\n", "}", ")", "\n", "}" ]
7,896
all-7897
[ "SetUri", "is", "a", "wrapper", "around", "gtk_link_button_set_uri", "()", "." ]
[ "func", "(", "v", "*", "LinkButton", ")", "SetUri", "(", "uri", "<mask>", ")", "{", "cstr", ":=", "C", ".", "CString", "(", "uri", ")", "\n", "C", ".", "gtk_link_button_set_uri", "(", "v", ".", "native", "(", ")", ",", "(", "*", "C", ".", "gchar", ")", "(", "cstr", ")", ")", "\n", "}" ]
7,897
all-7898
[ "paint", "draws", "the", "brush", "on", "the", "given", "canvas", "image", "at", "the", "position", "(", "x", "y", ")", "." ]
[ "func", "paint", "(", "canvas", "*", "ebiten", ".", "Image", ",", "x", ",", "y", "int", ")", "{", "op", ":=", "&", "ebiten", ".", "DrawImageOptions", "{", "}", "\n", "op", ".", "GeoM", ".", "Translate", "(", "float64", "(", "x", ")", ",", "float64", "(", "y", ")", ")", "\n", "// Scale the color and rotate the hue so that colors vary on each frame.", "op", ".", "ColorM", ".", "Scale", "(", "1.0", ",", "0.50", ",", "0.125", ",", "1.0", ")", "\n", "tps", ":=", "ebiten", ".", "MaxTPS", "(", ")", "\n", "theta", ":=", "2.0", "*", "math", ".", "Pi", "*", "float64", "(", "<mask>", "%", "tps", ")", "/", "float64", "(", "tps", ")", "\n", "op", ".", "ColorM", ".", "RotateHue", "(", "theta", ")", "\n", "canvas", ".", "DrawImage", "(", "brushImage", ",", "op", ")", "\n", "}" ]
7,898
all-7899
[ "asChanges", "returns", "a", "sequence", "of", "changes", "that", "could", "be", "used", "to", "recreate", "the", "Manifest", "in", "its", "present", "state", "." ]
[ "func", "(", "m", "*", "Manifest", ")", "asChanges", "(", ")", "[", "]", "*", "<mask>", ".", "ManifestChange", "{", "changes", ":=", "make", "(", "[", "]", "*", "pb", ".", "ManifestChange", ",", "0", ",", "len", "(", "m", ".", "Tables", ")", ")", "\n", "for", "id", ",", "tm", ":=", "range", "m", ".", "Tables", "{", "changes", "=", "append", "(", "changes", ",", "newCreateChange", "(", "id", ",", "int", "(", "tm", ".", "Level", ")", ",", "tm", ".", "Checksum", ")", ")", "\n", "}", "\n", "return", "changes", "\n", "}" ]
7,899
all-7900
[ "SetActive", "()", "is", "a", "wrapper", "around", "gtk_combo_box_set_active", "()", "." ]
[ "func", "(", "v", "*", "ComboBox", ")", "SetActive", "(", "index", "int", ")", "{", "C", ".", "gtk_combo_box_set_active", "(", "v", ".", "native", "(", ")", ",", "C", ".", "gint", "(", "<mask>", ")", ")", "\n", "}" ]