id int32 0 167k | repo stringlengths 5 54 | path stringlengths 4 155 | func_name stringlengths 1 118 | original_string stringlengths 52 85.5k | language stringclasses 1
value | code stringlengths 52 85.5k | code_tokens listlengths 21 1.41k | docstring stringlengths 6 2.61k | docstring_tokens listlengths 3 215 | sha stringlengths 40 40 | url stringlengths 85 252 |
|---|---|---|---|---|---|---|---|---|---|---|---|
24,600 | securego/gosec | rule.go | RegisteredFor | func (r RuleSet) RegisteredFor(n ast.Node) []Rule {
if rules, found := r[reflect.TypeOf(n)]; found {
return rules
}
return []Rule{}
} | go | func (r RuleSet) RegisteredFor(n ast.Node) []Rule {
if rules, found := r[reflect.TypeOf(n)]; found {
return rules
}
return []Rule{}
} | [
"func",
"(",
"r",
"RuleSet",
")",
"RegisteredFor",
"(",
"n",
"ast",
".",
"Node",
")",
"[",
"]",
"Rule",
"{",
"if",
"rules",
",",
"found",
":=",
"r",
"[",
"reflect",
".",
"TypeOf",
"(",
"n",
")",
"]",
";",
"found",
"{",
"return",
"rules",
"\n",
... | // RegisteredFor will return all rules that are registered for a
// specified ast node. | [
"RegisteredFor",
"will",
"return",
"all",
"rules",
"that",
"are",
"registered",
"for",
"a",
"specified",
"ast",
"node",
"."
] | 29cec138dcc94f347e6d41550a5223571dc7d6cf | https://github.com/securego/gosec/blob/29cec138dcc94f347e6d41550a5223571dc7d6cf/rule.go#L54-L59 |
24,601 | securego/gosec | rules/sql.go | MatchPatterns | func (s *sqlStatement) MatchPatterns(str string) bool {
for _, pattern := range s.patterns {
if !pattern.MatchString(str) {
return false
}
}
return true
} | go | func (s *sqlStatement) MatchPatterns(str string) bool {
for _, pattern := range s.patterns {
if !pattern.MatchString(str) {
return false
}
}
return true
} | [
"func",
"(",
"s",
"*",
"sqlStatement",
")",
"MatchPatterns",
"(",
"str",
"string",
")",
"bool",
"{",
"for",
"_",
",",
"pattern",
":=",
"range",
"s",
".",
"patterns",
"{",
"if",
"!",
"pattern",
".",
"MatchString",
"(",
"str",
")",
"{",
"return",
"fals... | // See if the string matches the patterns for the statement. | [
"See",
"if",
"the",
"string",
"matches",
"the",
"patterns",
"for",
"the",
"statement",
"."
] | 29cec138dcc94f347e6d41550a5223571dc7d6cf | https://github.com/securego/gosec/blob/29cec138dcc94f347e6d41550a5223571dc7d6cf/rules/sql.go#L36-L43 |
24,602 | securego/gosec | rules/sql.go | checkObject | func (s *sqlStrConcat) checkObject(n *ast.Ident, c *gosec.Context) bool {
if n.Obj != nil {
return n.Obj.Kind != ast.Var && n.Obj.Kind != ast.Fun
}
// Try to resolve unresolved identifiers using other files in same package
for _, file := range c.PkgFiles {
if node, ok := file.Scope.Objects[n.String()]; ok {
... | go | func (s *sqlStrConcat) checkObject(n *ast.Ident, c *gosec.Context) bool {
if n.Obj != nil {
return n.Obj.Kind != ast.Var && n.Obj.Kind != ast.Fun
}
// Try to resolve unresolved identifiers using other files in same package
for _, file := range c.PkgFiles {
if node, ok := file.Scope.Objects[n.String()]; ok {
... | [
"func",
"(",
"s",
"*",
"sqlStrConcat",
")",
"checkObject",
"(",
"n",
"*",
"ast",
".",
"Ident",
",",
"c",
"*",
"gosec",
".",
"Context",
")",
"bool",
"{",
"if",
"n",
".",
"Obj",
"!=",
"nil",
"{",
"return",
"n",
".",
"Obj",
".",
"Kind",
"!=",
"ast... | // see if we can figure out what it is | [
"see",
"if",
"we",
"can",
"figure",
"out",
"what",
"it",
"is"
] | 29cec138dcc94f347e6d41550a5223571dc7d6cf | https://github.com/securego/gosec/blob/29cec138dcc94f347e6d41550a5223571dc7d6cf/rules/sql.go#L54-L66 |
24,603 | securego/gosec | rules/sql.go | NewSQLStrConcat | func NewSQLStrConcat(id string, conf gosec.Config) (gosec.Rule, []ast.Node) {
return &sqlStrConcat{
sqlStatement: sqlStatement{
patterns: []*regexp.Regexp{
regexp.MustCompile(`(?)(SELECT|DELETE|INSERT|UPDATE|INTO|FROM|WHERE) `),
},
MetaData: gosec.MetaData{
ID: id,
Severity: gosec.Medi... | go | func NewSQLStrConcat(id string, conf gosec.Config) (gosec.Rule, []ast.Node) {
return &sqlStrConcat{
sqlStatement: sqlStatement{
patterns: []*regexp.Regexp{
regexp.MustCompile(`(?)(SELECT|DELETE|INSERT|UPDATE|INTO|FROM|WHERE) `),
},
MetaData: gosec.MetaData{
ID: id,
Severity: gosec.Medi... | [
"func",
"NewSQLStrConcat",
"(",
"id",
"string",
",",
"conf",
"gosec",
".",
"Config",
")",
"(",
"gosec",
".",
"Rule",
",",
"[",
"]",
"ast",
".",
"Node",
")",
"{",
"return",
"&",
"sqlStrConcat",
"{",
"sqlStatement",
":",
"sqlStatement",
"{",
"patterns",
... | // NewSQLStrConcat looks for cases where we are building SQL strings via concatenation | [
"NewSQLStrConcat",
"looks",
"for",
"cases",
"where",
"we",
"are",
"building",
"SQL",
"strings",
"via",
"concatenation"
] | 29cec138dcc94f347e6d41550a5223571dc7d6cf | https://github.com/securego/gosec/blob/29cec138dcc94f347e6d41550a5223571dc7d6cf/rules/sql.go#L90-L104 |
24,604 | securego/gosec | rules/sql.go | NewSQLStrFormat | func NewSQLStrFormat(id string, conf gosec.Config) (gosec.Rule, []ast.Node) {
rule := &sqlStrFormat{
calls: gosec.NewCallList(),
noIssue: gosec.NewCallList(),
noIssueQuoted: gosec.NewCallList(),
sqlStatement: sqlStatement{
patterns: []*regexp.Regexp{
regexp.MustCompile("(?)(SELECT|DELETE|I... | go | func NewSQLStrFormat(id string, conf gosec.Config) (gosec.Rule, []ast.Node) {
rule := &sqlStrFormat{
calls: gosec.NewCallList(),
noIssue: gosec.NewCallList(),
noIssueQuoted: gosec.NewCallList(),
sqlStatement: sqlStatement{
patterns: []*regexp.Regexp{
regexp.MustCompile("(?)(SELECT|DELETE|I... | [
"func",
"NewSQLStrFormat",
"(",
"id",
"string",
",",
"conf",
"gosec",
".",
"Config",
")",
"(",
"gosec",
".",
"Rule",
",",
"[",
"]",
"ast",
".",
"Node",
")",
"{",
"rule",
":=",
"&",
"sqlStrFormat",
"{",
"calls",
":",
"gosec",
".",
"NewCallList",
"(",
... | // NewSQLStrFormat looks for cases where we're building SQL query strings using format strings | [
"NewSQLStrFormat",
"looks",
"for",
"cases",
"where",
"we",
"re",
"building",
"SQL",
"query",
"strings",
"using",
"format",
"strings"
] | 29cec138dcc94f347e6d41550a5223571dc7d6cf | https://github.com/securego/gosec/blob/29cec138dcc94f347e6d41550a5223571dc7d6cf/rules/sql.go#L177-L199 |
24,605 | securego/gosec | config.go | ReadFrom | func (c Config) ReadFrom(r io.Reader) (int64, error) {
data, err := ioutil.ReadAll(r)
if err != nil {
return int64(len(data)), err
}
if err = json.Unmarshal(data, &c); err != nil {
return int64(len(data)), err
}
return int64(len(data)), nil
} | go | func (c Config) ReadFrom(r io.Reader) (int64, error) {
data, err := ioutil.ReadAll(r)
if err != nil {
return int64(len(data)), err
}
if err = json.Unmarshal(data, &c); err != nil {
return int64(len(data)), err
}
return int64(len(data)), nil
} | [
"func",
"(",
"c",
"Config",
")",
"ReadFrom",
"(",
"r",
"io",
".",
"Reader",
")",
"(",
"int64",
",",
"error",
")",
"{",
"data",
",",
"err",
":=",
"ioutil",
".",
"ReadAll",
"(",
"r",
")",
"\n",
"if",
"err",
"!=",
"nil",
"{",
"return",
"int64",
"(... | // ReadFrom implements the io.ReaderFrom interface. This
// should be used with io.Reader to load configuration from
//file or from string etc. | [
"ReadFrom",
"implements",
"the",
"io",
".",
"ReaderFrom",
"interface",
".",
"This",
"should",
"be",
"used",
"with",
"io",
".",
"Reader",
"to",
"load",
"configuration",
"from",
"file",
"or",
"from",
"string",
"etc",
"."
] | 29cec138dcc94f347e6d41550a5223571dc7d6cf | https://github.com/securego/gosec/blob/29cec138dcc94f347e6d41550a5223571dc7d6cf/config.go#L42-L51 |
24,606 | securego/gosec | config.go | WriteTo | func (c Config) WriteTo(w io.Writer) (int64, error) {
data, err := json.Marshal(c)
if err != nil {
return int64(len(data)), err
}
return io.Copy(w, bytes.NewReader(data))
} | go | func (c Config) WriteTo(w io.Writer) (int64, error) {
data, err := json.Marshal(c)
if err != nil {
return int64(len(data)), err
}
return io.Copy(w, bytes.NewReader(data))
} | [
"func",
"(",
"c",
"Config",
")",
"WriteTo",
"(",
"w",
"io",
".",
"Writer",
")",
"(",
"int64",
",",
"error",
")",
"{",
"data",
",",
"err",
":=",
"json",
".",
"Marshal",
"(",
"c",
")",
"\n",
"if",
"err",
"!=",
"nil",
"{",
"return",
"int64",
"(",
... | // WriteTo implements the io.WriteTo interface. This should
// be used to save or print out the configuration information. | [
"WriteTo",
"implements",
"the",
"io",
".",
"WriteTo",
"interface",
".",
"This",
"should",
"be",
"used",
"to",
"save",
"or",
"print",
"out",
"the",
"configuration",
"information",
"."
] | 29cec138dcc94f347e6d41550a5223571dc7d6cf | https://github.com/securego/gosec/blob/29cec138dcc94f347e6d41550a5223571dc7d6cf/config.go#L55-L61 |
24,607 | securego/gosec | config.go | Get | func (c Config) Get(section string) (interface{}, error) {
settings, found := c[section]
if !found {
return nil, fmt.Errorf("Section %s not in configuration", section)
}
return settings, nil
} | go | func (c Config) Get(section string) (interface{}, error) {
settings, found := c[section]
if !found {
return nil, fmt.Errorf("Section %s not in configuration", section)
}
return settings, nil
} | [
"func",
"(",
"c",
"Config",
")",
"Get",
"(",
"section",
"string",
")",
"(",
"interface",
"{",
"}",
",",
"error",
")",
"{",
"settings",
",",
"found",
":=",
"c",
"[",
"section",
"]",
"\n",
"if",
"!",
"found",
"{",
"return",
"nil",
",",
"fmt",
".",
... | // Get returns the configuration section for the supplied key | [
"Get",
"returns",
"the",
"configuration",
"section",
"for",
"the",
"supplied",
"key"
] | 29cec138dcc94f347e6d41550a5223571dc7d6cf | https://github.com/securego/gosec/blob/29cec138dcc94f347e6d41550a5223571dc7d6cf/config.go#L64-L70 |
24,608 | securego/gosec | config.go | GetGlobal | func (c Config) GetGlobal(option GlobalOption) (string, error) {
if globals, ok := c[Globals]; ok {
if settings, ok := globals.(map[GlobalOption]string); ok {
if value, ok := settings[option]; ok {
return value, nil
}
return "", fmt.Errorf("global setting for %s not found", option)
}
}
return "", fm... | go | func (c Config) GetGlobal(option GlobalOption) (string, error) {
if globals, ok := c[Globals]; ok {
if settings, ok := globals.(map[GlobalOption]string); ok {
if value, ok := settings[option]; ok {
return value, nil
}
return "", fmt.Errorf("global setting for %s not found", option)
}
}
return "", fm... | [
"func",
"(",
"c",
"Config",
")",
"GetGlobal",
"(",
"option",
"GlobalOption",
")",
"(",
"string",
",",
"error",
")",
"{",
"if",
"globals",
",",
"ok",
":=",
"c",
"[",
"Globals",
"]",
";",
"ok",
"{",
"if",
"settings",
",",
"ok",
":=",
"globals",
".",
... | // GetGlobal returns value associated with global configuration option | [
"GetGlobal",
"returns",
"value",
"associated",
"with",
"global",
"configuration",
"option"
] | 29cec138dcc94f347e6d41550a5223571dc7d6cf | https://github.com/securego/gosec/blob/29cec138dcc94f347e6d41550a5223571dc7d6cf/config.go#L78-L89 |
24,609 | securego/gosec | config.go | SetGlobal | func (c Config) SetGlobal(option GlobalOption, value string) {
if globals, ok := c[Globals]; ok {
if settings, ok := globals.(map[GlobalOption]string); ok {
settings[option] = value
}
}
} | go | func (c Config) SetGlobal(option GlobalOption, value string) {
if globals, ok := c[Globals]; ok {
if settings, ok := globals.(map[GlobalOption]string); ok {
settings[option] = value
}
}
} | [
"func",
"(",
"c",
"Config",
")",
"SetGlobal",
"(",
"option",
"GlobalOption",
",",
"value",
"string",
")",
"{",
"if",
"globals",
",",
"ok",
":=",
"c",
"[",
"Globals",
"]",
";",
"ok",
"{",
"if",
"settings",
",",
"ok",
":=",
"globals",
".",
"(",
"map"... | // SetGlobal associates a value with a global configuration option | [
"SetGlobal",
"associates",
"a",
"value",
"with",
"a",
"global",
"configuration",
"option"
] | 29cec138dcc94f347e6d41550a5223571dc7d6cf | https://github.com/securego/gosec/blob/29cec138dcc94f347e6d41550a5223571dc7d6cf/config.go#L92-L98 |
24,610 | securego/gosec | config.go | IsGlobalEnabled | func (c Config) IsGlobalEnabled(option GlobalOption) (bool, error) {
value, err := c.GetGlobal(option)
if err != nil {
return false, err
}
return (value == "true" || value == "enabled"), nil
} | go | func (c Config) IsGlobalEnabled(option GlobalOption) (bool, error) {
value, err := c.GetGlobal(option)
if err != nil {
return false, err
}
return (value == "true" || value == "enabled"), nil
} | [
"func",
"(",
"c",
"Config",
")",
"IsGlobalEnabled",
"(",
"option",
"GlobalOption",
")",
"(",
"bool",
",",
"error",
")",
"{",
"value",
",",
"err",
":=",
"c",
".",
"GetGlobal",
"(",
"option",
")",
"\n",
"if",
"err",
"!=",
"nil",
"{",
"return",
"false",... | // IsGlobalEnabled checks if a global option is enabled | [
"IsGlobalEnabled",
"checks",
"if",
"a",
"global",
"option",
"is",
"enabled"
] | 29cec138dcc94f347e6d41550a5223571dc7d6cf | https://github.com/securego/gosec/blob/29cec138dcc94f347e6d41550a5223571dc7d6cf/config.go#L101-L107 |
24,611 | securego/gosec | rules/rand.go | NewWeakRandCheck | func NewWeakRandCheck(id string, conf gosec.Config) (gosec.Rule, []ast.Node) {
return &weakRand{
funcNames: []string{"Read", "Int"},
packagePath: "math/rand",
MetaData: gosec.MetaData{
ID: id,
Severity: gosec.High,
Confidence: gosec.Medium,
What: "Use of weak random number generator... | go | func NewWeakRandCheck(id string, conf gosec.Config) (gosec.Rule, []ast.Node) {
return &weakRand{
funcNames: []string{"Read", "Int"},
packagePath: "math/rand",
MetaData: gosec.MetaData{
ID: id,
Severity: gosec.High,
Confidence: gosec.Medium,
What: "Use of weak random number generator... | [
"func",
"NewWeakRandCheck",
"(",
"id",
"string",
",",
"conf",
"gosec",
".",
"Config",
")",
"(",
"gosec",
".",
"Rule",
",",
"[",
"]",
"ast",
".",
"Node",
")",
"{",
"return",
"&",
"weakRand",
"{",
"funcNames",
":",
"[",
"]",
"string",
"{",
"\"",
"\""... | // NewWeakRandCheck detects the use of random number generator that isn't cryptographically secure | [
"NewWeakRandCheck",
"detects",
"the",
"use",
"of",
"random",
"number",
"generator",
"that",
"isn",
"t",
"cryptographically",
"secure"
] | 29cec138dcc94f347e6d41550a5223571dc7d6cf | https://github.com/securego/gosec/blob/29cec138dcc94f347e6d41550a5223571dc7d6cf/rules/rand.go#L44-L55 |
24,612 | securego/gosec | rules/ssh.go | NewSSHHostKey | func NewSSHHostKey(id string, conf gosec.Config) (gosec.Rule, []ast.Node) {
return &sshHostKey{
pkg: "golang.org/x/crypto/ssh",
calls: []string{"InsecureIgnoreHostKey"},
MetaData: gosec.MetaData{
ID: id,
What: "Use of ssh InsecureIgnoreHostKey should be audited",
Severity: gosec.Medium... | go | func NewSSHHostKey(id string, conf gosec.Config) (gosec.Rule, []ast.Node) {
return &sshHostKey{
pkg: "golang.org/x/crypto/ssh",
calls: []string{"InsecureIgnoreHostKey"},
MetaData: gosec.MetaData{
ID: id,
What: "Use of ssh InsecureIgnoreHostKey should be audited",
Severity: gosec.Medium... | [
"func",
"NewSSHHostKey",
"(",
"id",
"string",
",",
"conf",
"gosec",
".",
"Config",
")",
"(",
"gosec",
".",
"Rule",
",",
"[",
"]",
"ast",
".",
"Node",
")",
"{",
"return",
"&",
"sshHostKey",
"{",
"pkg",
":",
"\"",
"\"",
",",
"calls",
":",
"[",
"]",... | // NewSSHHostKey rule detects the use of insecure ssh HostKeyCallback. | [
"NewSSHHostKey",
"rule",
"detects",
"the",
"use",
"of",
"insecure",
"ssh",
"HostKeyCallback",
"."
] | 29cec138dcc94f347e6d41550a5223571dc7d6cf | https://github.com/securego/gosec/blob/29cec138dcc94f347e6d41550a5223571dc7d6cf/rules/ssh.go#L27-L38 |
24,613 | securego/gosec | rules/errors.go | NewNoErrorCheck | func NewNoErrorCheck(id string, conf gosec.Config) (gosec.Rule, []ast.Node) {
// TODO(gm) Come up with sensible defaults here. Or flip it to use a
// black list instead.
whitelist := gosec.NewCallList()
whitelist.AddAll("bytes.Buffer", "Write", "WriteByte", "WriteRune", "WriteString")
whitelist.AddAll("fmt", "Prin... | go | func NewNoErrorCheck(id string, conf gosec.Config) (gosec.Rule, []ast.Node) {
// TODO(gm) Come up with sensible defaults here. Or flip it to use a
// black list instead.
whitelist := gosec.NewCallList()
whitelist.AddAll("bytes.Buffer", "Write", "WriteByte", "WriteRune", "WriteString")
whitelist.AddAll("fmt", "Prin... | [
"func",
"NewNoErrorCheck",
"(",
"id",
"string",
",",
"conf",
"gosec",
".",
"Config",
")",
"(",
"gosec",
".",
"Rule",
",",
"[",
"]",
"ast",
".",
"Node",
")",
"{",
"// TODO(gm) Come up with sensible defaults here. Or flip it to use a",
"// black list instead.",
"white... | // NewNoErrorCheck detects if the returned error is unchecked | [
"NewNoErrorCheck",
"detects",
"if",
"the",
"returned",
"error",
"is",
"unchecked"
] | 29cec138dcc94f347e6d41550a5223571dc7d6cf | https://github.com/securego/gosec/blob/29cec138dcc94f347e6d41550a5223571dc7d6cf/rules/errors.go#L81-L106 |
24,614 | securego/gosec | rules/big.go | NewUsingBigExp | func NewUsingBigExp(id string, conf gosec.Config) (gosec.Rule, []ast.Node) {
return &usingBigExp{
pkg: "*math/big.Int",
calls: []string{"Exp"},
MetaData: gosec.MetaData{
ID: id,
What: "Use of math/big.Int.Exp function should be audited for modulus == 0",
Severity: gosec.Low,
Confide... | go | func NewUsingBigExp(id string, conf gosec.Config) (gosec.Rule, []ast.Node) {
return &usingBigExp{
pkg: "*math/big.Int",
calls: []string{"Exp"},
MetaData: gosec.MetaData{
ID: id,
What: "Use of math/big.Int.Exp function should be audited for modulus == 0",
Severity: gosec.Low,
Confide... | [
"func",
"NewUsingBigExp",
"(",
"id",
"string",
",",
"conf",
"gosec",
".",
"Config",
")",
"(",
"gosec",
".",
"Rule",
",",
"[",
"]",
"ast",
".",
"Node",
")",
"{",
"return",
"&",
"usingBigExp",
"{",
"pkg",
":",
"\"",
"\"",
",",
"calls",
":",
"[",
"]... | // NewUsingBigExp detects issues with modulus == 0 for Bignum | [
"NewUsingBigExp",
"detects",
"issues",
"with",
"modulus",
"==",
"0",
"for",
"Bignum"
] | 29cec138dcc94f347e6d41550a5223571dc7d6cf | https://github.com/securego/gosec/blob/29cec138dcc94f347e6d41550a5223571dc7d6cf/rules/big.go#L41-L52 |
24,615 | securego/gosec | rules/rulelist.go | Builders | func (rl RuleList) Builders() map[string]gosec.RuleBuilder {
builders := make(map[string]gosec.RuleBuilder)
for _, def := range rl {
builders[def.ID] = def.Create
}
return builders
} | go | func (rl RuleList) Builders() map[string]gosec.RuleBuilder {
builders := make(map[string]gosec.RuleBuilder)
for _, def := range rl {
builders[def.ID] = def.Create
}
return builders
} | [
"func",
"(",
"rl",
"RuleList",
")",
"Builders",
"(",
")",
"map",
"[",
"string",
"]",
"gosec",
".",
"RuleBuilder",
"{",
"builders",
":=",
"make",
"(",
"map",
"[",
"string",
"]",
"gosec",
".",
"RuleBuilder",
")",
"\n",
"for",
"_",
",",
"def",
":=",
"... | // Builders returns all the create methods for a given rule list | [
"Builders",
"returns",
"all",
"the",
"create",
"methods",
"for",
"a",
"given",
"rule",
"list"
] | 29cec138dcc94f347e6d41550a5223571dc7d6cf | https://github.com/securego/gosec/blob/29cec138dcc94f347e6d41550a5223571dc7d6cf/rules/rulelist.go#L31-L37 |
24,616 | securego/gosec | rules/rulelist.go | Generate | func Generate(filters ...RuleFilter) RuleList {
rules := []RuleDefinition{
// misc
{"G101", "Look for hardcoded credentials", NewHardcodedCredentials},
{"G102", "Bind to all interfaces", NewBindsToAllNetworkInterfaces},
{"G103", "Audit the use of unsafe block", NewUsingUnsafe},
{"G104", "Audit errors not che... | go | func Generate(filters ...RuleFilter) RuleList {
rules := []RuleDefinition{
// misc
{"G101", "Look for hardcoded credentials", NewHardcodedCredentials},
{"G102", "Bind to all interfaces", NewBindsToAllNetworkInterfaces},
{"G103", "Audit the use of unsafe block", NewUsingUnsafe},
{"G104", "Audit errors not che... | [
"func",
"Generate",
"(",
"filters",
"...",
"RuleFilter",
")",
"RuleList",
"{",
"rules",
":=",
"[",
"]",
"RuleDefinition",
"{",
"// misc",
"{",
"\"",
"\"",
",",
"\"",
"\"",
",",
"NewHardcodedCredentials",
"}",
",",
"{",
"\"",
"\"",
",",
"\"",
"\"",
",",... | // Generate the list of rules to use | [
"Generate",
"the",
"list",
"of",
"rules",
"to",
"use"
] | 29cec138dcc94f347e6d41550a5223571dc7d6cf | https://github.com/securego/gosec/blob/29cec138dcc94f347e6d41550a5223571dc7d6cf/rules/rulelist.go#L59-L109 |
24,617 | securego/gosec | errors.go | NewError | func NewError(line, column int, err string) *Error {
return &Error{
Line: line,
Column: column,
Err: err,
}
} | go | func NewError(line, column int, err string) *Error {
return &Error{
Line: line,
Column: column,
Err: err,
}
} | [
"func",
"NewError",
"(",
"line",
",",
"column",
"int",
",",
"err",
"string",
")",
"*",
"Error",
"{",
"return",
"&",
"Error",
"{",
"Line",
":",
"line",
",",
"Column",
":",
"column",
",",
"Err",
":",
"err",
",",
"}",
"\n",
"}"
] | // NewError creates Error object | [
"NewError",
"creates",
"Error",
"object"
] | 29cec138dcc94f347e6d41550a5223571dc7d6cf | https://github.com/securego/gosec/blob/29cec138dcc94f347e6d41550a5223571dc7d6cf/errors.go#L15-L21 |
24,618 | securego/gosec | errors.go | sortErrors | func sortErrors(allErrors map[string][]Error) {
for _, errors := range allErrors {
sort.Slice(errors, func(i, j int) bool {
if errors[i].Line == errors[j].Line {
return errors[i].Column <= errors[j].Column
}
return errors[i].Line < errors[j].Line
})
}
} | go | func sortErrors(allErrors map[string][]Error) {
for _, errors := range allErrors {
sort.Slice(errors, func(i, j int) bool {
if errors[i].Line == errors[j].Line {
return errors[i].Column <= errors[j].Column
}
return errors[i].Line < errors[j].Line
})
}
} | [
"func",
"sortErrors",
"(",
"allErrors",
"map",
"[",
"string",
"]",
"[",
"]",
"Error",
")",
"{",
"for",
"_",
",",
"errors",
":=",
"range",
"allErrors",
"{",
"sort",
".",
"Slice",
"(",
"errors",
",",
"func",
"(",
"i",
",",
"j",
"int",
")",
"bool",
... | // sortErros sorts the golang erros by line | [
"sortErros",
"sorts",
"the",
"golang",
"erros",
"by",
"line"
] | 29cec138dcc94f347e6d41550a5223571dc7d6cf | https://github.com/securego/gosec/blob/29cec138dcc94f347e6d41550a5223571dc7d6cf/errors.go#L24-L33 |
24,619 | securego/gosec | rules/tempfiles.go | NewBadTempFile | func NewBadTempFile(id string, conf gosec.Config) (gosec.Rule, []ast.Node) {
calls := gosec.NewCallList()
calls.Add("io/ioutil", "WriteFile")
calls.Add("os", "Create")
return &badTempFile{
calls: calls,
args: regexp.MustCompile(`^/tmp/.*$|^/var/tmp/.*$`),
MetaData: gosec.MetaData{
ID: id,
Sever... | go | func NewBadTempFile(id string, conf gosec.Config) (gosec.Rule, []ast.Node) {
calls := gosec.NewCallList()
calls.Add("io/ioutil", "WriteFile")
calls.Add("os", "Create")
return &badTempFile{
calls: calls,
args: regexp.MustCompile(`^/tmp/.*$|^/var/tmp/.*$`),
MetaData: gosec.MetaData{
ID: id,
Sever... | [
"func",
"NewBadTempFile",
"(",
"id",
"string",
",",
"conf",
"gosec",
".",
"Config",
")",
"(",
"gosec",
".",
"Rule",
",",
"[",
"]",
"ast",
".",
"Node",
")",
"{",
"calls",
":=",
"gosec",
".",
"NewCallList",
"(",
")",
"\n",
"calls",
".",
"Add",
"(",
... | // NewBadTempFile detects direct writes to predictable path in temporary directory | [
"NewBadTempFile",
"detects",
"direct",
"writes",
"to",
"predictable",
"path",
"in",
"temporary",
"directory"
] | 29cec138dcc94f347e6d41550a5223571dc7d6cf | https://github.com/securego/gosec/blob/29cec138dcc94f347e6d41550a5223571dc7d6cf/rules/tempfiles.go#L44-L58 |
24,620 | securego/gosec | import_tracker.go | NewImportTracker | func NewImportTracker() *ImportTracker {
return &ImportTracker{
make(map[string]string),
make(map[string]string),
make(map[string]bool),
}
} | go | func NewImportTracker() *ImportTracker {
return &ImportTracker{
make(map[string]string),
make(map[string]string),
make(map[string]bool),
}
} | [
"func",
"NewImportTracker",
"(",
")",
"*",
"ImportTracker",
"{",
"return",
"&",
"ImportTracker",
"{",
"make",
"(",
"map",
"[",
"string",
"]",
"string",
")",
",",
"make",
"(",
"map",
"[",
"string",
"]",
"string",
")",
",",
"make",
"(",
"map",
"[",
"st... | // NewImportTracker creates an empty Import tracker instance | [
"NewImportTracker",
"creates",
"an",
"empty",
"Import",
"tracker",
"instance"
] | 29cec138dcc94f347e6d41550a5223571dc7d6cf | https://github.com/securego/gosec/blob/29cec138dcc94f347e6d41550a5223571dc7d6cf/import_tracker.go#L31-L37 |
24,621 | securego/gosec | import_tracker.go | TrackFile | func (t *ImportTracker) TrackFile(file *ast.File) {
for _, imp := range file.Imports {
path := strings.Trim(imp.Path.Value, `"`)
parts := strings.Split(path, "/")
if len(parts) > 0 {
name := parts[len(parts)-1]
t.Imported[path] = name
}
}
} | go | func (t *ImportTracker) TrackFile(file *ast.File) {
for _, imp := range file.Imports {
path := strings.Trim(imp.Path.Value, `"`)
parts := strings.Split(path, "/")
if len(parts) > 0 {
name := parts[len(parts)-1]
t.Imported[path] = name
}
}
} | [
"func",
"(",
"t",
"*",
"ImportTracker",
")",
"TrackFile",
"(",
"file",
"*",
"ast",
".",
"File",
")",
"{",
"for",
"_",
",",
"imp",
":=",
"range",
"file",
".",
"Imports",
"{",
"path",
":=",
"strings",
".",
"Trim",
"(",
"imp",
".",
"Path",
".",
"Val... | // TrackFile track all the imports used by the supplied file | [
"TrackFile",
"track",
"all",
"the",
"imports",
"used",
"by",
"the",
"supplied",
"file"
] | 29cec138dcc94f347e6d41550a5223571dc7d6cf | https://github.com/securego/gosec/blob/29cec138dcc94f347e6d41550a5223571dc7d6cf/import_tracker.go#L40-L49 |
24,622 | securego/gosec | import_tracker.go | TrackPackages | func (t *ImportTracker) TrackPackages(pkgs ...*types.Package) {
for _, pkg := range pkgs {
t.Imported[pkg.Path()] = pkg.Name()
}
} | go | func (t *ImportTracker) TrackPackages(pkgs ...*types.Package) {
for _, pkg := range pkgs {
t.Imported[pkg.Path()] = pkg.Name()
}
} | [
"func",
"(",
"t",
"*",
"ImportTracker",
")",
"TrackPackages",
"(",
"pkgs",
"...",
"*",
"types",
".",
"Package",
")",
"{",
"for",
"_",
",",
"pkg",
":=",
"range",
"pkgs",
"{",
"t",
".",
"Imported",
"[",
"pkg",
".",
"Path",
"(",
")",
"]",
"=",
"pkg"... | // TrackPackages tracks all the imports used by the supplied packages | [
"TrackPackages",
"tracks",
"all",
"the",
"imports",
"used",
"by",
"the",
"supplied",
"packages"
] | 29cec138dcc94f347e6d41550a5223571dc7d6cf | https://github.com/securego/gosec/blob/29cec138dcc94f347e6d41550a5223571dc7d6cf/import_tracker.go#L52-L56 |
24,623 | securego/gosec | import_tracker.go | TrackImport | func (t *ImportTracker) TrackImport(n ast.Node) {
if imported, ok := n.(*ast.ImportSpec); ok {
path := strings.Trim(imported.Path.Value, `"`)
if imported.Name != nil {
if imported.Name.Name == "_" {
// Initialization only import
t.InitOnly[path] = true
} else {
// Aliased import
t.Aliased[pat... | go | func (t *ImportTracker) TrackImport(n ast.Node) {
if imported, ok := n.(*ast.ImportSpec); ok {
path := strings.Trim(imported.Path.Value, `"`)
if imported.Name != nil {
if imported.Name.Name == "_" {
// Initialization only import
t.InitOnly[path] = true
} else {
// Aliased import
t.Aliased[pat... | [
"func",
"(",
"t",
"*",
"ImportTracker",
")",
"TrackImport",
"(",
"n",
"ast",
".",
"Node",
")",
"{",
"if",
"imported",
",",
"ok",
":=",
"n",
".",
"(",
"*",
"ast",
".",
"ImportSpec",
")",
";",
"ok",
"{",
"path",
":=",
"strings",
".",
"Trim",
"(",
... | // TrackImport tracks imports and handles the 'unsafe' import | [
"TrackImport",
"tracks",
"imports",
"and",
"handles",
"the",
"unsafe",
"import"
] | 29cec138dcc94f347e6d41550a5223571dc7d6cf | https://github.com/securego/gosec/blob/29cec138dcc94f347e6d41550a5223571dc7d6cf/import_tracker.go#L59-L75 |
24,624 | securego/gosec | rules/readfile.go | isJoinFunc | func (r *readfile) isJoinFunc(n ast.Node, c *gosec.Context) bool {
if call := r.pathJoin.ContainsCallExpr(n, c, false); call != nil {
for _, arg := range call.Args {
// edge case: check if one of the args is a BinaryExpr
if binExp, ok := arg.(*ast.BinaryExpr); ok {
// iterate and resolve all found identiti... | go | func (r *readfile) isJoinFunc(n ast.Node, c *gosec.Context) bool {
if call := r.pathJoin.ContainsCallExpr(n, c, false); call != nil {
for _, arg := range call.Args {
// edge case: check if one of the args is a BinaryExpr
if binExp, ok := arg.(*ast.BinaryExpr); ok {
// iterate and resolve all found identiti... | [
"func",
"(",
"r",
"*",
"readfile",
")",
"isJoinFunc",
"(",
"n",
"ast",
".",
"Node",
",",
"c",
"*",
"gosec",
".",
"Context",
")",
"bool",
"{",
"if",
"call",
":=",
"r",
".",
"pathJoin",
".",
"ContainsCallExpr",
"(",
"n",
",",
"c",
",",
"false",
")"... | // isJoinFunc checks if there is a filepath.Join or other join function | [
"isJoinFunc",
"checks",
"if",
"there",
"is",
"a",
"filepath",
".",
"Join",
"or",
"other",
"join",
"function"
] | 29cec138dcc94f347e6d41550a5223571dc7d6cf | https://github.com/securego/gosec/blob/29cec138dcc94f347e6d41550a5223571dc7d6cf/rules/readfile.go#L36-L57 |
24,625 | securego/gosec | rules/readfile.go | Match | func (r *readfile) Match(n ast.Node, c *gosec.Context) (*gosec.Issue, error) {
if node := r.ContainsCallExpr(n, c, false); node != nil {
for _, arg := range node.Args {
// handles path joining functions in Arg
// eg. os.Open(filepath.Join("/tmp/", file))
if callExpr, ok := arg.(*ast.CallExpr); ok {
if r... | go | func (r *readfile) Match(n ast.Node, c *gosec.Context) (*gosec.Issue, error) {
if node := r.ContainsCallExpr(n, c, false); node != nil {
for _, arg := range node.Args {
// handles path joining functions in Arg
// eg. os.Open(filepath.Join("/tmp/", file))
if callExpr, ok := arg.(*ast.CallExpr); ok {
if r... | [
"func",
"(",
"r",
"*",
"readfile",
")",
"Match",
"(",
"n",
"ast",
".",
"Node",
",",
"c",
"*",
"gosec",
".",
"Context",
")",
"(",
"*",
"gosec",
".",
"Issue",
",",
"error",
")",
"{",
"if",
"node",
":=",
"r",
".",
"ContainsCallExpr",
"(",
"n",
","... | // Match inspects AST nodes to determine if the match the methods `os.Open` or `ioutil.ReadFile` | [
"Match",
"inspects",
"AST",
"nodes",
"to",
"determine",
"if",
"the",
"match",
"the",
"methods",
"os",
".",
"Open",
"or",
"ioutil",
".",
"ReadFile"
] | 29cec138dcc94f347e6d41550a5223571dc7d6cf | https://github.com/securego/gosec/blob/29cec138dcc94f347e6d41550a5223571dc7d6cf/rules/readfile.go#L60-L87 |
24,626 | securego/gosec | rules/readfile.go | NewReadFile | func NewReadFile(id string, conf gosec.Config) (gosec.Rule, []ast.Node) {
rule := &readfile{
pathJoin: gosec.NewCallList(),
CallList: gosec.NewCallList(),
MetaData: gosec.MetaData{
ID: id,
What: "Potential file inclusion via variable",
Severity: gosec.Medium,
Confidence: gosec.High,
... | go | func NewReadFile(id string, conf gosec.Config) (gosec.Rule, []ast.Node) {
rule := &readfile{
pathJoin: gosec.NewCallList(),
CallList: gosec.NewCallList(),
MetaData: gosec.MetaData{
ID: id,
What: "Potential file inclusion via variable",
Severity: gosec.Medium,
Confidence: gosec.High,
... | [
"func",
"NewReadFile",
"(",
"id",
"string",
",",
"conf",
"gosec",
".",
"Config",
")",
"(",
"gosec",
".",
"Rule",
",",
"[",
"]",
"ast",
".",
"Node",
")",
"{",
"rule",
":=",
"&",
"readfile",
"{",
"pathJoin",
":",
"gosec",
".",
"NewCallList",
"(",
")"... | // NewReadFile detects cases where we read files | [
"NewReadFile",
"detects",
"cases",
"where",
"we",
"read",
"files"
] | 29cec138dcc94f347e6d41550a5223571dc7d6cf | https://github.com/securego/gosec/blob/29cec138dcc94f347e6d41550a5223571dc7d6cf/rules/readfile.go#L90-L106 |
24,627 | securego/gosec | rules/ssrf.go | ResolveVar | func (r *ssrf) ResolveVar(n *ast.CallExpr, c *gosec.Context) bool {
if len(n.Args) > 0 {
arg := n.Args[0]
if ident, ok := arg.(*ast.Ident); ok {
obj := c.Info.ObjectOf(ident)
if _, ok := obj.(*types.Var); ok && !gosec.TryResolve(ident, c) {
return true
}
}
}
return false
} | go | func (r *ssrf) ResolveVar(n *ast.CallExpr, c *gosec.Context) bool {
if len(n.Args) > 0 {
arg := n.Args[0]
if ident, ok := arg.(*ast.Ident); ok {
obj := c.Info.ObjectOf(ident)
if _, ok := obj.(*types.Var); ok && !gosec.TryResolve(ident, c) {
return true
}
}
}
return false
} | [
"func",
"(",
"r",
"*",
"ssrf",
")",
"ResolveVar",
"(",
"n",
"*",
"ast",
".",
"CallExpr",
",",
"c",
"*",
"gosec",
".",
"Context",
")",
"bool",
"{",
"if",
"len",
"(",
"n",
".",
"Args",
")",
">",
"0",
"{",
"arg",
":=",
"n",
".",
"Args",
"[",
"... | // ResolveVar tries to resolve the first argument of a call expression
// The first argument is the url | [
"ResolveVar",
"tries",
"to",
"resolve",
"the",
"first",
"argument",
"of",
"a",
"call",
"expression",
"The",
"first",
"argument",
"is",
"the",
"url"
] | 29cec138dcc94f347e6d41550a5223571dc7d6cf | https://github.com/securego/gosec/blob/29cec138dcc94f347e6d41550a5223571dc7d6cf/rules/ssrf.go#L22-L33 |
24,628 | securego/gosec | rules/ssrf.go | NewSSRFCheck | func NewSSRFCheck(id string, conf gosec.Config) (gosec.Rule, []ast.Node) {
rule := &ssrf{
CallList: gosec.NewCallList(),
MetaData: gosec.MetaData{
ID: id,
What: "Potential HTTP request made with variable url",
Severity: gosec.Medium,
Confidence: gosec.Medium,
},
}
rule.AddAll("net/h... | go | func NewSSRFCheck(id string, conf gosec.Config) (gosec.Rule, []ast.Node) {
rule := &ssrf{
CallList: gosec.NewCallList(),
MetaData: gosec.MetaData{
ID: id,
What: "Potential HTTP request made with variable url",
Severity: gosec.Medium,
Confidence: gosec.Medium,
},
}
rule.AddAll("net/h... | [
"func",
"NewSSRFCheck",
"(",
"id",
"string",
",",
"conf",
"gosec",
".",
"Config",
")",
"(",
"gosec",
".",
"Rule",
",",
"[",
"]",
"ast",
".",
"Node",
")",
"{",
"rule",
":=",
"&",
"ssrf",
"{",
"CallList",
":",
"gosec",
".",
"NewCallList",
"(",
")",
... | // NewSSRFCheck detects cases where HTTP requests are sent | [
"NewSSRFCheck",
"detects",
"cases",
"where",
"HTTP",
"requests",
"are",
"sent"
] | 29cec138dcc94f347e6d41550a5223571dc7d6cf | https://github.com/securego/gosec/blob/29cec138dcc94f347e6d41550a5223571dc7d6cf/rules/ssrf.go#L47-L59 |
24,629 | securego/gosec | resolve.go | TryResolve | func TryResolve(n ast.Node, c *Context) bool {
switch node := n.(type) {
case *ast.BasicLit:
return true
case *ast.CompositeLit:
return resolveCompLit(node, c)
case *ast.Ident:
return resolveIdent(node, c)
case *ast.AssignStmt:
return resolveAssign(node, c)
case *ast.CallExpr:
return resolveCallExpr... | go | func TryResolve(n ast.Node, c *Context) bool {
switch node := n.(type) {
case *ast.BasicLit:
return true
case *ast.CompositeLit:
return resolveCompLit(node, c)
case *ast.Ident:
return resolveIdent(node, c)
case *ast.AssignStmt:
return resolveAssign(node, c)
case *ast.CallExpr:
return resolveCallExpr... | [
"func",
"TryResolve",
"(",
"n",
"ast",
".",
"Node",
",",
"c",
"*",
"Context",
")",
"bool",
"{",
"switch",
"node",
":=",
"n",
".",
"(",
"type",
")",
"{",
"case",
"*",
"ast",
".",
"BasicLit",
":",
"return",
"true",
"\n\n",
"case",
"*",
"ast",
".",
... | // TryResolve will attempt, given a subtree starting at some ATS node, to resolve
// all values contained within to a known constant. It is used to check for any
// unknown values in compound expressions. | [
"TryResolve",
"will",
"attempt",
"given",
"a",
"subtree",
"starting",
"at",
"some",
"ATS",
"node",
"to",
"resolve",
"all",
"values",
"contained",
"within",
"to",
"a",
"known",
"constant",
".",
"It",
"is",
"used",
"to",
"check",
"for",
"any",
"unknown",
"va... | 29cec138dcc94f347e6d41550a5223571dc7d6cf | https://github.com/securego/gosec/blob/29cec138dcc94f347e6d41550a5223571dc7d6cf/resolve.go#L60-L82 |
24,630 | securego/gosec | issue.go | NewIssue | func NewIssue(ctx *Context, node ast.Node, ruleID, desc string, severity Score, confidence Score) *Issue {
var code string
fobj := ctx.FileSet.File(node.Pos())
name := fobj.Name()
start, end := fobj.Line(node.Pos()), fobj.Line(node.End())
line := strconv.Itoa(start)
if start != end {
line = fmt.Sprintf("%d-%d"... | go | func NewIssue(ctx *Context, node ast.Node, ruleID, desc string, severity Score, confidence Score) *Issue {
var code string
fobj := ctx.FileSet.File(node.Pos())
name := fobj.Name()
start, end := fobj.Line(node.Pos()), fobj.Line(node.End())
line := strconv.Itoa(start)
if start != end {
line = fmt.Sprintf("%d-%d"... | [
"func",
"NewIssue",
"(",
"ctx",
"*",
"Context",
",",
"node",
"ast",
".",
"Node",
",",
"ruleID",
",",
"desc",
"string",
",",
"severity",
"Score",
",",
"confidence",
"Score",
")",
"*",
"Issue",
"{",
"var",
"code",
"string",
"\n",
"fobj",
":=",
"ctx",
"... | // NewIssue creates a new Issue | [
"NewIssue",
"creates",
"a",
"new",
"Issue"
] | 29cec138dcc94f347e6d41550a5223571dc7d6cf | https://github.com/securego/gosec/blob/29cec138dcc94f347e6d41550a5223571dc7d6cf/issue.go#L94-L125 |
24,631 | securego/gosec | analyzer.go | NewAnalyzer | func NewAnalyzer(conf Config, tests bool, logger *log.Logger) *Analyzer {
ignoreNoSec := false
if enabled, err := conf.IsGlobalEnabled(Nosec); err == nil {
ignoreNoSec = enabled
}
if logger == nil {
logger = log.New(os.Stderr, "[gosec]", log.LstdFlags)
}
return &Analyzer{
ignoreNosec: ignoreNoSec,
ruleset... | go | func NewAnalyzer(conf Config, tests bool, logger *log.Logger) *Analyzer {
ignoreNoSec := false
if enabled, err := conf.IsGlobalEnabled(Nosec); err == nil {
ignoreNoSec = enabled
}
if logger == nil {
logger = log.New(os.Stderr, "[gosec]", log.LstdFlags)
}
return &Analyzer{
ignoreNosec: ignoreNoSec,
ruleset... | [
"func",
"NewAnalyzer",
"(",
"conf",
"Config",
",",
"tests",
"bool",
",",
"logger",
"*",
"log",
".",
"Logger",
")",
"*",
"Analyzer",
"{",
"ignoreNoSec",
":=",
"false",
"\n",
"if",
"enabled",
",",
"err",
":=",
"conf",
".",
"IsGlobalEnabled",
"(",
"Nosec",
... | // NewAnalyzer builds a new analyzer. | [
"NewAnalyzer",
"builds",
"a",
"new",
"analyzer",
"."
] | 29cec138dcc94f347e6d41550a5223571dc7d6cf | https://github.com/securego/gosec/blob/29cec138dcc94f347e6d41550a5223571dc7d6cf/analyzer.go#L74-L93 |
24,632 | securego/gosec | analyzer.go | LoadRules | func (gosec *Analyzer) LoadRules(ruleDefinitions map[string]RuleBuilder) {
for id, def := range ruleDefinitions {
r, nodes := def(id, gosec.config)
gosec.ruleset.Register(r, nodes...)
}
} | go | func (gosec *Analyzer) LoadRules(ruleDefinitions map[string]RuleBuilder) {
for id, def := range ruleDefinitions {
r, nodes := def(id, gosec.config)
gosec.ruleset.Register(r, nodes...)
}
} | [
"func",
"(",
"gosec",
"*",
"Analyzer",
")",
"LoadRules",
"(",
"ruleDefinitions",
"map",
"[",
"string",
"]",
"RuleBuilder",
")",
"{",
"for",
"id",
",",
"def",
":=",
"range",
"ruleDefinitions",
"{",
"r",
",",
"nodes",
":=",
"def",
"(",
"id",
",",
"gosec"... | // LoadRules instantiates all the rules to be used when analyzing source
// packages | [
"LoadRules",
"instantiates",
"all",
"the",
"rules",
"to",
"be",
"used",
"when",
"analyzing",
"source",
"packages"
] | 29cec138dcc94f347e6d41550a5223571dc7d6cf | https://github.com/securego/gosec/blob/29cec138dcc94f347e6d41550a5223571dc7d6cf/analyzer.go#L97-L102 |
24,633 | securego/gosec | analyzer.go | Process | func (gosec *Analyzer) Process(buildTags []string, packagePaths ...string) error {
config := gosec.pkgConfig(buildTags)
for _, pkgPath := range packagePaths {
pkgs, err := gosec.load(pkgPath, config)
if err != nil {
gosec.AppendError(pkgPath, err)
}
for _, pkg := range pkgs {
if pkg.Name != "" {
err... | go | func (gosec *Analyzer) Process(buildTags []string, packagePaths ...string) error {
config := gosec.pkgConfig(buildTags)
for _, pkgPath := range packagePaths {
pkgs, err := gosec.load(pkgPath, config)
if err != nil {
gosec.AppendError(pkgPath, err)
}
for _, pkg := range pkgs {
if pkg.Name != "" {
err... | [
"func",
"(",
"gosec",
"*",
"Analyzer",
")",
"Process",
"(",
"buildTags",
"[",
"]",
"string",
",",
"packagePaths",
"...",
"string",
")",
"error",
"{",
"config",
":=",
"gosec",
".",
"pkgConfig",
"(",
"buildTags",
")",
"\n",
"for",
"_",
",",
"pkgPath",
":... | // Process kicks off the analysis process for a given package | [
"Process",
"kicks",
"off",
"the",
"analysis",
"process",
"for",
"a",
"given",
"package"
] | 29cec138dcc94f347e6d41550a5223571dc7d6cf | https://github.com/securego/gosec/blob/29cec138dcc94f347e6d41550a5223571dc7d6cf/analyzer.go#L105-L124 |
24,634 | securego/gosec | analyzer.go | ParseErrors | func (gosec *Analyzer) ParseErrors(pkg *packages.Package) error {
if len(pkg.Errors) == 0 {
return nil
}
for _, pkgErr := range pkg.Errors {
parts := strings.Split(pkgErr.Pos, ":")
file := parts[0]
var err error
var line int
if len(parts) > 1 {
if line, err = strconv.Atoi(parts[1]); err != nil {
r... | go | func (gosec *Analyzer) ParseErrors(pkg *packages.Package) error {
if len(pkg.Errors) == 0 {
return nil
}
for _, pkgErr := range pkg.Errors {
parts := strings.Split(pkgErr.Pos, ":")
file := parts[0]
var err error
var line int
if len(parts) > 1 {
if line, err = strconv.Atoi(parts[1]); err != nil {
r... | [
"func",
"(",
"gosec",
"*",
"Analyzer",
")",
"ParseErrors",
"(",
"pkg",
"*",
"packages",
".",
"Package",
")",
"error",
"{",
"if",
"len",
"(",
"pkg",
".",
"Errors",
")",
"==",
"0",
"{",
"return",
"nil",
"\n",
"}",
"\n",
"for",
"_",
",",
"pkgErr",
"... | // ParseErrors parses the errors from given package | [
"ParseErrors",
"parses",
"the",
"errors",
"from",
"given",
"package"
] | 29cec138dcc94f347e6d41550a5223571dc7d6cf | https://github.com/securego/gosec/blob/29cec138dcc94f347e6d41550a5223571dc7d6cf/analyzer.go#L193-L223 |
24,635 | securego/gosec | analyzer.go | AppendError | func (gosec *Analyzer) AppendError(file string, err error) {
// Do not report the error for empty packages (e.g. files excluded from build with a tag)
r := regexp.MustCompile(`no buildable Go source files in`)
if r.MatchString(err.Error()) {
return
}
errors := []Error{}
if ferrs, ok := gosec.errors[file]; ok {
... | go | func (gosec *Analyzer) AppendError(file string, err error) {
// Do not report the error for empty packages (e.g. files excluded from build with a tag)
r := regexp.MustCompile(`no buildable Go source files in`)
if r.MatchString(err.Error()) {
return
}
errors := []Error{}
if ferrs, ok := gosec.errors[file]; ok {
... | [
"func",
"(",
"gosec",
"*",
"Analyzer",
")",
"AppendError",
"(",
"file",
"string",
",",
"err",
"error",
")",
"{",
"// Do not report the error for empty packages (e.g. files excluded from build with a tag)",
"r",
":=",
"regexp",
".",
"MustCompile",
"(",
"`no buildable Go so... | // AppendError appends an error to the file errors | [
"AppendError",
"appends",
"an",
"error",
"to",
"the",
"file",
"errors"
] | 29cec138dcc94f347e6d41550a5223571dc7d6cf | https://github.com/securego/gosec/blob/29cec138dcc94f347e6d41550a5223571dc7d6cf/analyzer.go#L226-L239 |
24,636 | securego/gosec | analyzer.go | Visit | func (gosec *Analyzer) Visit(n ast.Node) ast.Visitor {
// If we've reached the end of this branch, pop off the ignores stack.
if n == nil {
if len(gosec.context.Ignores) > 0 {
gosec.context.Ignores = gosec.context.Ignores[1:]
}
return gosec
}
// Get any new rule exclusions.
ignoredRules, ignoreAll := gos... | go | func (gosec *Analyzer) Visit(n ast.Node) ast.Visitor {
// If we've reached the end of this branch, pop off the ignores stack.
if n == nil {
if len(gosec.context.Ignores) > 0 {
gosec.context.Ignores = gosec.context.Ignores[1:]
}
return gosec
}
// Get any new rule exclusions.
ignoredRules, ignoreAll := gos... | [
"func",
"(",
"gosec",
"*",
"Analyzer",
")",
"Visit",
"(",
"n",
"ast",
".",
"Node",
")",
"ast",
".",
"Visitor",
"{",
"// If we've reached the end of this branch, pop off the ignores stack.",
"if",
"n",
"==",
"nil",
"{",
"if",
"len",
"(",
"gosec",
".",
"context"... | // Visit runs the gosec visitor logic over an AST created by parsing go code.
// Rule methods added with AddRule will be invoked as necessary. | [
"Visit",
"runs",
"the",
"gosec",
"visitor",
"logic",
"over",
"an",
"AST",
"created",
"by",
"parsing",
"go",
"code",
".",
"Rule",
"methods",
"added",
"with",
"AddRule",
"will",
"be",
"invoked",
"as",
"necessary",
"."
] | 29cec138dcc94f347e6d41550a5223571dc7d6cf | https://github.com/securego/gosec/blob/29cec138dcc94f347e6d41550a5223571dc7d6cf/analyzer.go#L271-L320 |
24,637 | securego/gosec | analyzer.go | Report | func (gosec *Analyzer) Report() ([]*Issue, *Metrics, map[string][]Error) {
return gosec.issues, gosec.stats, gosec.errors
} | go | func (gosec *Analyzer) Report() ([]*Issue, *Metrics, map[string][]Error) {
return gosec.issues, gosec.stats, gosec.errors
} | [
"func",
"(",
"gosec",
"*",
"Analyzer",
")",
"Report",
"(",
")",
"(",
"[",
"]",
"*",
"Issue",
",",
"*",
"Metrics",
",",
"map",
"[",
"string",
"]",
"[",
"]",
"Error",
")",
"{",
"return",
"gosec",
".",
"issues",
",",
"gosec",
".",
"stats",
",",
"g... | // Report returns the current issues discovered and the metrics about the scan | [
"Report",
"returns",
"the",
"current",
"issues",
"discovered",
"and",
"the",
"metrics",
"about",
"the",
"scan"
] | 29cec138dcc94f347e6d41550a5223571dc7d6cf | https://github.com/securego/gosec/blob/29cec138dcc94f347e6d41550a5223571dc7d6cf/analyzer.go#L323-L325 |
24,638 | securego/gosec | analyzer.go | Reset | func (gosec *Analyzer) Reset() {
gosec.context = &Context{}
gosec.issues = make([]*Issue, 0, 16)
gosec.stats = &Metrics{}
} | go | func (gosec *Analyzer) Reset() {
gosec.context = &Context{}
gosec.issues = make([]*Issue, 0, 16)
gosec.stats = &Metrics{}
} | [
"func",
"(",
"gosec",
"*",
"Analyzer",
")",
"Reset",
"(",
")",
"{",
"gosec",
".",
"context",
"=",
"&",
"Context",
"{",
"}",
"\n",
"gosec",
".",
"issues",
"=",
"make",
"(",
"[",
"]",
"*",
"Issue",
",",
"0",
",",
"16",
")",
"\n",
"gosec",
".",
... | // Reset clears state such as context, issues and metrics from the configured analyzer | [
"Reset",
"clears",
"state",
"such",
"as",
"context",
"issues",
"and",
"metrics",
"from",
"the",
"configured",
"analyzer"
] | 29cec138dcc94f347e6d41550a5223571dc7d6cf | https://github.com/securego/gosec/blob/29cec138dcc94f347e6d41550a5223571dc7d6cf/analyzer.go#L328-L332 |
24,639 | Shopify/toxiproxy | client/client.go | Proxies | func (client *Client) Proxies() (map[string]*Proxy, error) {
resp, err := http.Get(client.endpoint + "/proxies")
if err != nil {
return nil, err
}
err = checkError(resp, http.StatusOK, "Proxies")
if err != nil {
return nil, err
}
proxies := make(map[string]*Proxy)
err = json.NewDecoder(resp.Body).Decode(&... | go | func (client *Client) Proxies() (map[string]*Proxy, error) {
resp, err := http.Get(client.endpoint + "/proxies")
if err != nil {
return nil, err
}
err = checkError(resp, http.StatusOK, "Proxies")
if err != nil {
return nil, err
}
proxies := make(map[string]*Proxy)
err = json.NewDecoder(resp.Body).Decode(&... | [
"func",
"(",
"client",
"*",
"Client",
")",
"Proxies",
"(",
")",
"(",
"map",
"[",
"string",
"]",
"*",
"Proxy",
",",
"error",
")",
"{",
"resp",
",",
"err",
":=",
"http",
".",
"Get",
"(",
"client",
".",
"endpoint",
"+",
"\"",
"\"",
")",
"\n",
"if"... | // Proxies returns a map with all the proxies and their toxics. | [
"Proxies",
"returns",
"a",
"map",
"with",
"all",
"the",
"proxies",
"and",
"their",
"toxics",
"."
] | 07d7b6381cb3b059bdd3d66b1e844ccacc2f660e | https://github.com/Shopify/toxiproxy/blob/07d7b6381cb3b059bdd3d66b1e844ccacc2f660e/client/client.go#L60-L82 |
24,640 | Shopify/toxiproxy | client/client.go | Proxy | func (client *Client) Proxy(name string) (*Proxy, error) {
// TODO url encode
resp, err := http.Get(client.endpoint + "/proxies/" + name)
if err != nil {
return nil, err
}
err = checkError(resp, http.StatusOK, "Proxy")
if err != nil {
return nil, err
}
proxy := new(Proxy)
err = json.NewDecoder(resp.Body)... | go | func (client *Client) Proxy(name string) (*Proxy, error) {
// TODO url encode
resp, err := http.Get(client.endpoint + "/proxies/" + name)
if err != nil {
return nil, err
}
err = checkError(resp, http.StatusOK, "Proxy")
if err != nil {
return nil, err
}
proxy := new(Proxy)
err = json.NewDecoder(resp.Body)... | [
"func",
"(",
"client",
"*",
"Client",
")",
"Proxy",
"(",
"name",
"string",
")",
"(",
"*",
"Proxy",
",",
"error",
")",
"{",
"// TODO url encode",
"resp",
",",
"err",
":=",
"http",
".",
"Get",
"(",
"client",
".",
"endpoint",
"+",
"\"",
"\"",
"+",
"na... | // Proxy returns a proxy by name. | [
"Proxy",
"returns",
"a",
"proxy",
"by",
"name",
"."
] | 07d7b6381cb3b059bdd3d66b1e844ccacc2f660e | https://github.com/Shopify/toxiproxy/blob/07d7b6381cb3b059bdd3d66b1e844ccacc2f660e/client/client.go#L112-L133 |
24,641 | Shopify/toxiproxy | client/client.go | Populate | func (client *Client) Populate(config []Proxy) ([]*Proxy, error) {
proxies := struct {
Proxies []*Proxy `json:"proxies"`
}{}
request, err := json.Marshal(config)
if err != nil {
return nil, err
}
resp, err := http.Post(client.endpoint+"/populate", "application/json", bytes.NewReader(request))
if err != nil ... | go | func (client *Client) Populate(config []Proxy) ([]*Proxy, error) {
proxies := struct {
Proxies []*Proxy `json:"proxies"`
}{}
request, err := json.Marshal(config)
if err != nil {
return nil, err
}
resp, err := http.Post(client.endpoint+"/populate", "application/json", bytes.NewReader(request))
if err != nil ... | [
"func",
"(",
"client",
"*",
"Client",
")",
"Populate",
"(",
"config",
"[",
"]",
"Proxy",
")",
"(",
"[",
"]",
"*",
"Proxy",
",",
"error",
")",
"{",
"proxies",
":=",
"struct",
"{",
"Proxies",
"[",
"]",
"*",
"Proxy",
"`json:\"proxies\"`",
"\n",
"}",
"... | // Create a list of proxies using a configuration list. If a proxy already exists, it will be replaced
// with the specified configuration. For large amounts of proxies, `config` can be loaded from a file.
// Returns a list of the successfully created proxies. | [
"Create",
"a",
"list",
"of",
"proxies",
"using",
"a",
"configuration",
"list",
".",
"If",
"a",
"proxy",
"already",
"exists",
"it",
"will",
"be",
"replaced",
"with",
"the",
"specified",
"configuration",
".",
"For",
"large",
"amounts",
"of",
"proxies",
"config... | 07d7b6381cb3b059bdd3d66b1e844ccacc2f660e | https://github.com/Shopify/toxiproxy/blob/07d7b6381cb3b059bdd3d66b1e844ccacc2f660e/client/client.go#L138-L163 |
24,642 | Shopify/toxiproxy | client/client.go | Save | func (proxy *Proxy) Save() error {
request, err := json.Marshal(proxy)
if err != nil {
return err
}
var resp *http.Response
if proxy.created {
resp, err = http.Post(proxy.client.endpoint+"/proxies/"+proxy.Name, "text/plain", bytes.NewReader(request))
} else {
resp, err = http.Post(proxy.client.endpoint+"/p... | go | func (proxy *Proxy) Save() error {
request, err := json.Marshal(proxy)
if err != nil {
return err
}
var resp *http.Response
if proxy.created {
resp, err = http.Post(proxy.client.endpoint+"/proxies/"+proxy.Name, "text/plain", bytes.NewReader(request))
} else {
resp, err = http.Post(proxy.client.endpoint+"/p... | [
"func",
"(",
"proxy",
"*",
"Proxy",
")",
"Save",
"(",
")",
"error",
"{",
"request",
",",
"err",
":=",
"json",
".",
"Marshal",
"(",
"proxy",
")",
"\n",
"if",
"err",
"!=",
"nil",
"{",
"return",
"err",
"\n",
"}",
"\n\n",
"var",
"resp",
"*",
"http",
... | // Save saves changes to a proxy such as its enabled status or upstream port. | [
"Save",
"saves",
"changes",
"to",
"a",
"proxy",
"such",
"as",
"its",
"enabled",
"status",
"or",
"upstream",
"port",
"."
] | 07d7b6381cb3b059bdd3d66b1e844ccacc2f660e | https://github.com/Shopify/toxiproxy/blob/07d7b6381cb3b059bdd3d66b1e844ccacc2f660e/client/client.go#L166-L198 |
24,643 | Shopify/toxiproxy | client/client.go | Toxics | func (proxy *Proxy) Toxics() (Toxics, error) {
resp, err := http.Get(proxy.client.endpoint + "/proxies/" + proxy.Name + "/toxics")
if err != nil {
return nil, err
}
err = checkError(resp, http.StatusOK, "Toxics")
if err != nil {
return nil, err
}
toxics := make(Toxics, 0)
err = json.NewDecoder(resp.Body).... | go | func (proxy *Proxy) Toxics() (Toxics, error) {
resp, err := http.Get(proxy.client.endpoint + "/proxies/" + proxy.Name + "/toxics")
if err != nil {
return nil, err
}
err = checkError(resp, http.StatusOK, "Toxics")
if err != nil {
return nil, err
}
toxics := make(Toxics, 0)
err = json.NewDecoder(resp.Body).... | [
"func",
"(",
"proxy",
"*",
"Proxy",
")",
"Toxics",
"(",
")",
"(",
"Toxics",
",",
"error",
")",
"{",
"resp",
",",
"err",
":=",
"http",
".",
"Get",
"(",
"proxy",
".",
"client",
".",
"endpoint",
"+",
"\"",
"\"",
"+",
"proxy",
".",
"Name",
"+",
"\"... | // Toxics returns a map of all the active toxics and their attributes. | [
"Toxics",
"returns",
"a",
"map",
"of",
"all",
"the",
"active",
"toxics",
"and",
"their",
"attributes",
"."
] | 07d7b6381cb3b059bdd3d66b1e844ccacc2f660e | https://github.com/Shopify/toxiproxy/blob/07d7b6381cb3b059bdd3d66b1e844ccacc2f660e/client/client.go#L232-L250 |
24,644 | Shopify/toxiproxy | client/client.go | ResetState | func (client *Client) ResetState() error {
resp, err := http.Post(client.endpoint+"/reset", "text/plain", bytes.NewReader([]byte{}))
if err != nil {
return err
}
return checkError(resp, http.StatusNoContent, "ResetState")
} | go | func (client *Client) ResetState() error {
resp, err := http.Post(client.endpoint+"/reset", "text/plain", bytes.NewReader([]byte{}))
if err != nil {
return err
}
return checkError(resp, http.StatusNoContent, "ResetState")
} | [
"func",
"(",
"client",
"*",
"Client",
")",
"ResetState",
"(",
")",
"error",
"{",
"resp",
",",
"err",
":=",
"http",
".",
"Post",
"(",
"client",
".",
"endpoint",
"+",
"\"",
"\"",
",",
"\"",
"\"",
",",
"bytes",
".",
"NewReader",
"(",
"[",
"]",
"byte... | // ResetState resets the state of all proxies and toxics in Toxiproxy. | [
"ResetState",
"resets",
"the",
"state",
"of",
"all",
"proxies",
"and",
"toxics",
"in",
"Toxiproxy",
"."
] | 07d7b6381cb3b059bdd3d66b1e844ccacc2f660e | https://github.com/Shopify/toxiproxy/blob/07d7b6381cb3b059bdd3d66b1e844ccacc2f660e/client/client.go#L336-L343 |
24,645 | Shopify/toxiproxy | link.go | Start | func (link *ToxicLink) Start(name string, source io.Reader, dest io.WriteCloser) {
go func() {
bytes, err := io.Copy(link.input, source)
if err != nil {
logrus.WithFields(logrus.Fields{
"name": link.proxy.Name,
"bytes": bytes,
"err": err,
}).Warn("Source terminated")
}
link.input.Close()
... | go | func (link *ToxicLink) Start(name string, source io.Reader, dest io.WriteCloser) {
go func() {
bytes, err := io.Copy(link.input, source)
if err != nil {
logrus.WithFields(logrus.Fields{
"name": link.proxy.Name,
"bytes": bytes,
"err": err,
}).Warn("Source terminated")
}
link.input.Close()
... | [
"func",
"(",
"link",
"*",
"ToxicLink",
")",
"Start",
"(",
"name",
"string",
",",
"source",
"io",
".",
"Reader",
",",
"dest",
"io",
".",
"WriteCloser",
")",
"{",
"go",
"func",
"(",
")",
"{",
"bytes",
",",
"err",
":=",
"io",
".",
"Copy",
"(",
"link... | // Start the link with the specified toxics | [
"Start",
"the",
"link",
"with",
"the",
"specified",
"toxics"
] | 07d7b6381cb3b059bdd3d66b1e844ccacc2f660e | https://github.com/Shopify/toxiproxy/blob/07d7b6381cb3b059bdd3d66b1e844ccacc2f660e/link.go#L56-L88 |
24,646 | Shopify/toxiproxy | link.go | AddToxic | func (link *ToxicLink) AddToxic(toxic *toxics.ToxicWrapper) {
i := len(link.stubs)
newin := make(chan *stream.StreamChunk, toxic.BufferSize)
link.stubs = append(link.stubs, toxics.NewToxicStub(newin, link.stubs[i-1].Output))
// Interrupt the last toxic so that we don't have a race when moving channels
if link.st... | go | func (link *ToxicLink) AddToxic(toxic *toxics.ToxicWrapper) {
i := len(link.stubs)
newin := make(chan *stream.StreamChunk, toxic.BufferSize)
link.stubs = append(link.stubs, toxics.NewToxicStub(newin, link.stubs[i-1].Output))
// Interrupt the last toxic so that we don't have a race when moving channels
if link.st... | [
"func",
"(",
"link",
"*",
"ToxicLink",
")",
"AddToxic",
"(",
"toxic",
"*",
"toxics",
".",
"ToxicWrapper",
")",
"{",
"i",
":=",
"len",
"(",
"link",
".",
"stubs",
")",
"\n\n",
"newin",
":=",
"make",
"(",
"chan",
"*",
"stream",
".",
"StreamChunk",
",",
... | // Add a toxic to the end of the chain. | [
"Add",
"a",
"toxic",
"to",
"the",
"end",
"of",
"the",
"chain",
"."
] | 07d7b6381cb3b059bdd3d66b1e844ccacc2f660e | https://github.com/Shopify/toxiproxy/blob/07d7b6381cb3b059bdd3d66b1e844ccacc2f660e/link.go#L91-L112 |
24,647 | Shopify/toxiproxy | link.go | UpdateToxic | func (link *ToxicLink) UpdateToxic(toxic *toxics.ToxicWrapper) {
if link.stubs[toxic.Index].InterruptToxic() {
go link.stubs[toxic.Index].Run(toxic)
}
} | go | func (link *ToxicLink) UpdateToxic(toxic *toxics.ToxicWrapper) {
if link.stubs[toxic.Index].InterruptToxic() {
go link.stubs[toxic.Index].Run(toxic)
}
} | [
"func",
"(",
"link",
"*",
"ToxicLink",
")",
"UpdateToxic",
"(",
"toxic",
"*",
"toxics",
".",
"ToxicWrapper",
")",
"{",
"if",
"link",
".",
"stubs",
"[",
"toxic",
".",
"Index",
"]",
".",
"InterruptToxic",
"(",
")",
"{",
"go",
"link",
".",
"stubs",
"[",... | // Update an existing toxic in the chain. | [
"Update",
"an",
"existing",
"toxic",
"in",
"the",
"chain",
"."
] | 07d7b6381cb3b059bdd3d66b1e844ccacc2f660e | https://github.com/Shopify/toxiproxy/blob/07d7b6381cb3b059bdd3d66b1e844ccacc2f660e/link.go#L115-L119 |
24,648 | Shopify/toxiproxy | link.go | RemoveToxic | func (link *ToxicLink) RemoveToxic(toxic *toxics.ToxicWrapper) {
i := toxic.Index
if link.stubs[i].InterruptToxic() {
cleanup, ok := toxic.Toxic.(toxics.CleanupToxic)
if ok {
cleanup.Cleanup(link.stubs[i])
// Cleanup could have closed the stub.
if link.stubs[i].Closed() {
return
}
}
stop := ... | go | func (link *ToxicLink) RemoveToxic(toxic *toxics.ToxicWrapper) {
i := toxic.Index
if link.stubs[i].InterruptToxic() {
cleanup, ok := toxic.Toxic.(toxics.CleanupToxic)
if ok {
cleanup.Cleanup(link.stubs[i])
// Cleanup could have closed the stub.
if link.stubs[i].Closed() {
return
}
}
stop := ... | [
"func",
"(",
"link",
"*",
"ToxicLink",
")",
"RemoveToxic",
"(",
"toxic",
"*",
"toxics",
".",
"ToxicWrapper",
")",
"{",
"i",
":=",
"toxic",
".",
"Index",
"\n\n",
"if",
"link",
".",
"stubs",
"[",
"i",
"]",
".",
"InterruptToxic",
"(",
")",
"{",
"cleanup... | // Remove an existing toxic from the chain. | [
"Remove",
"an",
"existing",
"toxic",
"from",
"the",
"chain",
"."
] | 07d7b6381cb3b059bdd3d66b1e844ccacc2f660e | https://github.com/Shopify/toxiproxy/blob/07d7b6381cb3b059bdd3d66b1e844ccacc2f660e/link.go#L122-L176 |
24,649 | Shopify/toxiproxy | toxics/toxic.go | Run | func (s *ToxicStub) Run(toxic *ToxicWrapper) {
s.running = make(chan struct{})
defer close(s.running)
if rand.Float32() < toxic.Toxicity {
toxic.Pipe(s)
} else {
new(NoopToxic).Pipe(s)
}
} | go | func (s *ToxicStub) Run(toxic *ToxicWrapper) {
s.running = make(chan struct{})
defer close(s.running)
if rand.Float32() < toxic.Toxicity {
toxic.Pipe(s)
} else {
new(NoopToxic).Pipe(s)
}
} | [
"func",
"(",
"s",
"*",
"ToxicStub",
")",
"Run",
"(",
"toxic",
"*",
"ToxicWrapper",
")",
"{",
"s",
".",
"running",
"=",
"make",
"(",
"chan",
"struct",
"{",
"}",
")",
"\n",
"defer",
"close",
"(",
"s",
".",
"running",
")",
"\n",
"if",
"rand",
".",
... | // Begin running a toxic on this stub, can be interrupted.
// Runs a noop toxic randomly depending on toxicity | [
"Begin",
"running",
"a",
"toxic",
"on",
"this",
"stub",
"can",
"be",
"interrupted",
".",
"Runs",
"a",
"noop",
"toxic",
"randomly",
"depending",
"on",
"toxicity"
] | 07d7b6381cb3b059bdd3d66b1e844ccacc2f660e | https://github.com/Shopify/toxiproxy/blob/07d7b6381cb3b059bdd3d66b1e844ccacc2f660e/toxics/toxic.go#L78-L86 |
24,650 | Shopify/toxiproxy | toxics/toxic.go | InterruptToxic | func (s *ToxicStub) InterruptToxic() bool {
select {
case <-s.closed:
return false
case s.Interrupt <- struct{}{}:
<-s.running // Wait for the running toxic to exit
return true
}
} | go | func (s *ToxicStub) InterruptToxic() bool {
select {
case <-s.closed:
return false
case s.Interrupt <- struct{}{}:
<-s.running // Wait for the running toxic to exit
return true
}
} | [
"func",
"(",
"s",
"*",
"ToxicStub",
")",
"InterruptToxic",
"(",
")",
"bool",
"{",
"select",
"{",
"case",
"<-",
"s",
".",
"closed",
":",
"return",
"false",
"\n",
"case",
"s",
".",
"Interrupt",
"<-",
"struct",
"{",
"}",
"{",
"}",
":",
"<-",
"s",
".... | // Interrupt the flow of data so that the toxic controlling the stub can be replaced.
// Returns true if the stream was successfully interrupted, or false if the stream is closed. | [
"Interrupt",
"the",
"flow",
"of",
"data",
"so",
"that",
"the",
"toxic",
"controlling",
"the",
"stub",
"can",
"be",
"replaced",
".",
"Returns",
"true",
"if",
"the",
"stream",
"was",
"successfully",
"interrupted",
"or",
"false",
"if",
"the",
"stream",
"is",
... | 07d7b6381cb3b059bdd3d66b1e844ccacc2f660e | https://github.com/Shopify/toxiproxy/blob/07d7b6381cb3b059bdd3d66b1e844ccacc2f660e/toxics/toxic.go#L90-L98 |
24,651 | Shopify/toxiproxy | toxic_collection.go | findToxicByName | func (c *ToxicCollection) findToxicByName(name string) *toxics.ToxicWrapper {
for dir := range c.chain {
for i, toxic := range c.chain[dir] {
if i == 0 {
// Skip the first noop toxic, it has no name
continue
}
if toxic.Name == name {
return toxic
}
}
}
return nil
} | go | func (c *ToxicCollection) findToxicByName(name string) *toxics.ToxicWrapper {
for dir := range c.chain {
for i, toxic := range c.chain[dir] {
if i == 0 {
// Skip the first noop toxic, it has no name
continue
}
if toxic.Name == name {
return toxic
}
}
}
return nil
} | [
"func",
"(",
"c",
"*",
"ToxicCollection",
")",
"findToxicByName",
"(",
"name",
"string",
")",
"*",
"toxics",
".",
"ToxicWrapper",
"{",
"for",
"dir",
":=",
"range",
"c",
".",
"chain",
"{",
"for",
"i",
",",
"toxic",
":=",
"range",
"c",
".",
"chain",
"[... | // All following functions assume the lock is already grabbed | [
"All",
"following",
"functions",
"assume",
"the",
"lock",
"is",
"already",
"grabbed"
] | 07d7b6381cb3b059bdd3d66b1e844ccacc2f660e | https://github.com/Shopify/toxiproxy/blob/07d7b6381cb3b059bdd3d66b1e844ccacc2f660e/toxic_collection.go#L188-L201 |
24,652 | Shopify/toxiproxy | proxy.go | server | func (proxy *Proxy) server() {
ln, err := net.Listen("tcp", proxy.Listen)
if err != nil {
proxy.started <- err
return
}
proxy.Listen = ln.Addr().String()
proxy.started <- nil
logrus.WithFields(logrus.Fields{
"name": proxy.Name,
"proxy": proxy.Listen,
"upstream": proxy.Upstream,
}).Info("Starte... | go | func (proxy *Proxy) server() {
ln, err := net.Listen("tcp", proxy.Listen)
if err != nil {
proxy.started <- err
return
}
proxy.Listen = ln.Addr().String()
proxy.started <- nil
logrus.WithFields(logrus.Fields{
"name": proxy.Name,
"proxy": proxy.Listen,
"upstream": proxy.Upstream,
}).Info("Starte... | [
"func",
"(",
"proxy",
"*",
"Proxy",
")",
"server",
"(",
")",
"{",
"ln",
",",
"err",
":=",
"net",
".",
"Listen",
"(",
"\"",
"\"",
",",
"proxy",
".",
"Listen",
")",
"\n",
"if",
"err",
"!=",
"nil",
"{",
"proxy",
".",
"started",
"<-",
"err",
"\n",
... | // server runs the Proxy server, accepting new clients and creating Links to
// connect them to upstreams. | [
"server",
"runs",
"the",
"Proxy",
"server",
"accepting",
"new",
"clients",
"and",
"creating",
"Links",
"to",
"connect",
"them",
"to",
"upstreams",
"."
] | 07d7b6381cb3b059bdd3d66b1e844ccacc2f660e | https://github.com/Shopify/toxiproxy/blob/07d7b6381cb3b059bdd3d66b1e844ccacc2f660e/proxy.go#L94-L182 |
24,653 | Shopify/toxiproxy | proxy.go | start | func start(proxy *Proxy) error {
if proxy.Enabled {
return ErrProxyAlreadyStarted
}
proxy.tomb = tomb.Tomb{} // Reset tomb, from previous starts/stops
go proxy.server()
err := <-proxy.started
// Only enable the proxy if it successfully started
proxy.Enabled = err == nil
return err
} | go | func start(proxy *Proxy) error {
if proxy.Enabled {
return ErrProxyAlreadyStarted
}
proxy.tomb = tomb.Tomb{} // Reset tomb, from previous starts/stops
go proxy.server()
err := <-proxy.started
// Only enable the proxy if it successfully started
proxy.Enabled = err == nil
return err
} | [
"func",
"start",
"(",
"proxy",
"*",
"Proxy",
")",
"error",
"{",
"if",
"proxy",
".",
"Enabled",
"{",
"return",
"ErrProxyAlreadyStarted",
"\n",
"}",
"\n\n",
"proxy",
".",
"tomb",
"=",
"tomb",
".",
"Tomb",
"{",
"}",
"// Reset tomb, from previous starts/stops",
... | // Starts a proxy, assumes the lock has already been taken | [
"Starts",
"a",
"proxy",
"assumes",
"the",
"lock",
"has",
"already",
"been",
"taken"
] | 07d7b6381cb3b059bdd3d66b1e844ccacc2f660e | https://github.com/Shopify/toxiproxy/blob/07d7b6381cb3b059bdd3d66b1e844ccacc2f660e/proxy.go#L191-L202 |
24,654 | Shopify/toxiproxy | proxy.go | stop | func stop(proxy *Proxy) {
if !proxy.Enabled {
return
}
proxy.Enabled = false
proxy.tomb.Killf("Shutting down from stop()")
proxy.tomb.Wait() // Wait until we stop accepting new connections
proxy.connections.Lock()
defer proxy.connections.Unlock()
for _, conn := range proxy.connections.list {
conn.Close()
... | go | func stop(proxy *Proxy) {
if !proxy.Enabled {
return
}
proxy.Enabled = false
proxy.tomb.Killf("Shutting down from stop()")
proxy.tomb.Wait() // Wait until we stop accepting new connections
proxy.connections.Lock()
defer proxy.connections.Unlock()
for _, conn := range proxy.connections.list {
conn.Close()
... | [
"func",
"stop",
"(",
"proxy",
"*",
"Proxy",
")",
"{",
"if",
"!",
"proxy",
".",
"Enabled",
"{",
"return",
"\n",
"}",
"\n",
"proxy",
".",
"Enabled",
"=",
"false",
"\n\n",
"proxy",
".",
"tomb",
".",
"Killf",
"(",
"\"",
"\"",
")",
"\n",
"proxy",
".",... | // Stops a proxy, assumes the lock has already been taken | [
"Stops",
"a",
"proxy",
"assumes",
"the",
"lock",
"has",
"already",
"been",
"taken"
] | 07d7b6381cb3b059bdd3d66b1e844ccacc2f660e | https://github.com/Shopify/toxiproxy/blob/07d7b6381cb3b059bdd3d66b1e844ccacc2f660e/proxy.go#L205-L225 |
24,655 | cweill/gotests | internal/goparser/goparser.go | Parse | func (p *Parser) Parse(srcPath string, files []models.Path) (*Result, error) {
b, err := p.readFile(srcPath)
if err != nil {
return nil, err
}
fset := token.NewFileSet()
f, err := p.parseFile(fset, srcPath)
if err != nil {
return nil, err
}
fs, err := p.parseFiles(fset, f, files)
if err != nil {
return n... | go | func (p *Parser) Parse(srcPath string, files []models.Path) (*Result, error) {
b, err := p.readFile(srcPath)
if err != nil {
return nil, err
}
fset := token.NewFileSet()
f, err := p.parseFile(fset, srcPath)
if err != nil {
return nil, err
}
fs, err := p.parseFiles(fset, f, files)
if err != nil {
return n... | [
"func",
"(",
"p",
"*",
"Parser",
")",
"Parse",
"(",
"srcPath",
"string",
",",
"files",
"[",
"]",
"models",
".",
"Path",
")",
"(",
"*",
"Result",
",",
"error",
")",
"{",
"b",
",",
"err",
":=",
"p",
".",
"readFile",
"(",
"srcPath",
")",
"\n",
"if... | // Parse parses a given Go file at srcPath, along any files that share the same
// package, into a domain model for generating tests. | [
"Parse",
"parses",
"a",
"given",
"Go",
"file",
"at",
"srcPath",
"along",
"any",
"files",
"that",
"share",
"the",
"same",
"package",
"into",
"a",
"domain",
"model",
"for",
"generating",
"tests",
"."
] | afa0a378663a63a98287714c3f3359e22a4ab29e | https://github.com/cweill/gotests/blob/afa0a378663a63a98287714c3f3359e22a4ab29e/internal/goparser/goparser.go#L38-L61 |
24,656 | cweill/gotests | internal/goparser/goparser.go | goCode | func goCode(b []byte, f *ast.File) []byte {
furthestPos := f.Name.End()
for _, node := range f.Imports {
if pos := node.End(); pos > furthestPos {
furthestPos = pos
}
}
if furthestPos < token.Pos(len(b)) {
furthestPos++
// Avoid wrong output on windows-encoded files
if b[furthestPos-2] == '\r' && b[fu... | go | func goCode(b []byte, f *ast.File) []byte {
furthestPos := f.Name.End()
for _, node := range f.Imports {
if pos := node.End(); pos > furthestPos {
furthestPos = pos
}
}
if furthestPos < token.Pos(len(b)) {
furthestPos++
// Avoid wrong output on windows-encoded files
if b[furthestPos-2] == '\r' && b[fu... | [
"func",
"goCode",
"(",
"b",
"[",
"]",
"byte",
",",
"f",
"*",
"ast",
".",
"File",
")",
"[",
"]",
"byte",
"{",
"furthestPos",
":=",
"f",
".",
"Name",
".",
"End",
"(",
")",
"\n",
"for",
"_",
",",
"node",
":=",
"range",
"f",
".",
"Imports",
"{",
... | // Returns the Go code below the imports block. | [
"Returns",
"the",
"Go",
"code",
"below",
"the",
"imports",
"block",
"."
] | afa0a378663a63a98287714c3f3359e22a4ab29e | https://github.com/cweill/gotests/blob/afa0a378663a63a98287714c3f3359e22a4ab29e/internal/goparser/goparser.go#L163-L179 |
24,657 | cweill/gotests | internal/input/input.go | Files | func Files(srcPath string) ([]models.Path, error) {
srcPath, err := filepath.Abs(srcPath)
if err != nil {
return nil, fmt.Errorf("filepath.Abs: %v\n", err)
}
var fi os.FileInfo
if fi, err = os.Stat(srcPath); err != nil {
return nil, fmt.Errorf("os.Stat: %v\n", err)
}
if fi.IsDir() {
return dirFiles(srcPath... | go | func Files(srcPath string) ([]models.Path, error) {
srcPath, err := filepath.Abs(srcPath)
if err != nil {
return nil, fmt.Errorf("filepath.Abs: %v\n", err)
}
var fi os.FileInfo
if fi, err = os.Stat(srcPath); err != nil {
return nil, fmt.Errorf("os.Stat: %v\n", err)
}
if fi.IsDir() {
return dirFiles(srcPath... | [
"func",
"Files",
"(",
"srcPath",
"string",
")",
"(",
"[",
"]",
"models",
".",
"Path",
",",
"error",
")",
"{",
"srcPath",
",",
"err",
":=",
"filepath",
".",
"Abs",
"(",
"srcPath",
")",
"\n",
"if",
"err",
"!=",
"nil",
"{",
"return",
"nil",
",",
"fm... | // Files returns all the Golang files for the given path. Ignores hidden files. | [
"Files",
"returns",
"all",
"the",
"Golang",
"files",
"for",
"the",
"given",
"path",
".",
"Ignores",
"hidden",
"files",
"."
] | afa0a378663a63a98287714c3f3359e22a4ab29e | https://github.com/cweill/gotests/blob/afa0a378663a63a98287714c3f3359e22a4ab29e/internal/input/input.go#L13-L26 |
24,658 | cweill/gotests | internal/render/render.go | LoadCustomTemplates | func LoadCustomTemplates(dir string) error {
initEmptyTmpls()
files, err := ioutil.ReadDir(dir)
if err != nil {
return fmt.Errorf("ioutil.ReadDir: %v", err)
}
templateFiles := []string{}
for _, f := range files {
templateFiles = append(templateFiles, path.Join(dir, f.Name()))
}
tmpls, err = tmpls.ParseFil... | go | func LoadCustomTemplates(dir string) error {
initEmptyTmpls()
files, err := ioutil.ReadDir(dir)
if err != nil {
return fmt.Errorf("ioutil.ReadDir: %v", err)
}
templateFiles := []string{}
for _, f := range files {
templateFiles = append(templateFiles, path.Join(dir, f.Name()))
}
tmpls, err = tmpls.ParseFil... | [
"func",
"LoadCustomTemplates",
"(",
"dir",
"string",
")",
"error",
"{",
"initEmptyTmpls",
"(",
")",
"\n\n",
"files",
",",
"err",
":=",
"ioutil",
".",
"ReadDir",
"(",
"dir",
")",
"\n",
"if",
"err",
"!=",
"nil",
"{",
"return",
"fmt",
".",
"Errorf",
"(",
... | // LoadCustomTemplates allows to load in custom templates from a specified path. | [
"LoadCustomTemplates",
"allows",
"to",
"load",
"in",
"custom",
"templates",
"from",
"a",
"specified",
"path",
"."
] | afa0a378663a63a98287714c3f3359e22a4ab29e | https://github.com/cweill/gotests/blob/afa0a378663a63a98287714c3f3359e22a4ab29e/internal/render/render.go#L30-L47 |
24,659 | cweill/gotests | internal/render/bindata/esc.go | FSByte | func FSByte(useLocal bool, name string) ([]byte, error) {
if useLocal {
f, err := _escLocal.Open(name)
if err != nil {
return nil, err
}
b, err := ioutil.ReadAll(f)
_ = f.Close()
return b, err
}
f, err := _escStatic.prepare(name)
if err != nil {
return nil, err
}
return f.data, nil
} | go | func FSByte(useLocal bool, name string) ([]byte, error) {
if useLocal {
f, err := _escLocal.Open(name)
if err != nil {
return nil, err
}
b, err := ioutil.ReadAll(f)
_ = f.Close()
return b, err
}
f, err := _escStatic.prepare(name)
if err != nil {
return nil, err
}
return f.data, nil
} | [
"func",
"FSByte",
"(",
"useLocal",
"bool",
",",
"name",
"string",
")",
"(",
"[",
"]",
"byte",
",",
"error",
")",
"{",
"if",
"useLocal",
"{",
"f",
",",
"err",
":=",
"_escLocal",
".",
"Open",
"(",
"name",
")",
"\n",
"if",
"err",
"!=",
"nil",
"{",
... | // FSByte returns the named file from the embedded assets. If useLocal is
// true, the filesystem's contents are instead used. | [
"FSByte",
"returns",
"the",
"named",
"file",
"from",
"the",
"embedded",
"assets",
".",
"If",
"useLocal",
"is",
"true",
"the",
"filesystem",
"s",
"contents",
"are",
"instead",
"used",
"."
] | afa0a378663a63a98287714c3f3359e22a4ab29e | https://github.com/cweill/gotests/blob/afa0a378663a63a98287714c3f3359e22a4ab29e/internal/render/bindata/esc.go#L173-L188 |
24,660 | cweill/gotests | internal/render/bindata/esc.go | FSMustByte | func FSMustByte(useLocal bool, name string) []byte {
b, err := FSByte(useLocal, name)
if err != nil {
panic(err)
}
return b
} | go | func FSMustByte(useLocal bool, name string) []byte {
b, err := FSByte(useLocal, name)
if err != nil {
panic(err)
}
return b
} | [
"func",
"FSMustByte",
"(",
"useLocal",
"bool",
",",
"name",
"string",
")",
"[",
"]",
"byte",
"{",
"b",
",",
"err",
":=",
"FSByte",
"(",
"useLocal",
",",
"name",
")",
"\n",
"if",
"err",
"!=",
"nil",
"{",
"panic",
"(",
"err",
")",
"\n",
"}",
"\n",
... | // FSMustByte is the same as FSByte, but panics if name is not present. | [
"FSMustByte",
"is",
"the",
"same",
"as",
"FSByte",
"but",
"panics",
"if",
"name",
"is",
"not",
"present",
"."
] | afa0a378663a63a98287714c3f3359e22a4ab29e | https://github.com/cweill/gotests/blob/afa0a378663a63a98287714c3f3359e22a4ab29e/internal/render/bindata/esc.go#L191-L197 |
24,661 | cweill/gotests | internal/render/bindata/esc.go | FSString | func FSString(useLocal bool, name string) (string, error) {
b, err := FSByte(useLocal, name)
return string(b), err
} | go | func FSString(useLocal bool, name string) (string, error) {
b, err := FSByte(useLocal, name)
return string(b), err
} | [
"func",
"FSString",
"(",
"useLocal",
"bool",
",",
"name",
"string",
")",
"(",
"string",
",",
"error",
")",
"{",
"b",
",",
"err",
":=",
"FSByte",
"(",
"useLocal",
",",
"name",
")",
"\n",
"return",
"string",
"(",
"b",
")",
",",
"err",
"\n",
"}"
] | // FSString is the string version of FSByte. | [
"FSString",
"is",
"the",
"string",
"version",
"of",
"FSByte",
"."
] | afa0a378663a63a98287714c3f3359e22a4ab29e | https://github.com/cweill/gotests/blob/afa0a378663a63a98287714c3f3359e22a4ab29e/internal/render/bindata/esc.go#L200-L203 |
24,662 | cweill/gotests | internal/render/bindata/esc.go | FSMustString | func FSMustString(useLocal bool, name string) string {
return string(FSMustByte(useLocal, name))
} | go | func FSMustString(useLocal bool, name string) string {
return string(FSMustByte(useLocal, name))
} | [
"func",
"FSMustString",
"(",
"useLocal",
"bool",
",",
"name",
"string",
")",
"string",
"{",
"return",
"string",
"(",
"FSMustByte",
"(",
"useLocal",
",",
"name",
")",
")",
"\n",
"}"
] | // FSMustString is the string version of FSMustByte. | [
"FSMustString",
"is",
"the",
"string",
"version",
"of",
"FSMustByte",
"."
] | afa0a378663a63a98287714c3f3359e22a4ab29e | https://github.com/cweill/gotests/blob/afa0a378663a63a98287714c3f3359e22a4ab29e/internal/render/bindata/esc.go#L206-L208 |
24,663 | dropbox/godropbox | database/binlog/parsed_event_reader.go | NewParsedV4EventReader | func NewParsedV4EventReader(
reader EventReader,
parsers V4EventParserMap) EventReader {
return &parsedV4EventReader{
reader: reader,
eventParsers: parsers,
}
} | go | func NewParsedV4EventReader(
reader EventReader,
parsers V4EventParserMap) EventReader {
return &parsedV4EventReader{
reader: reader,
eventParsers: parsers,
}
} | [
"func",
"NewParsedV4EventReader",
"(",
"reader",
"EventReader",
",",
"parsers",
"V4EventParserMap",
")",
"EventReader",
"{",
"return",
"&",
"parsedV4EventReader",
"{",
"reader",
":",
"reader",
",",
"eventParsers",
":",
"parsers",
",",
"}",
"\n",
"}"
] | // This returns an EventReader which applies the appropriate parser on each
// raw v4 event in the stream. If no parser is available for the event,
// or if an error occurs during parsing, then the reader will return the
// original event along with the error. | [
"This",
"returns",
"an",
"EventReader",
"which",
"applies",
"the",
"appropriate",
"parser",
"on",
"each",
"raw",
"v4",
"event",
"in",
"the",
"stream",
".",
"If",
"no",
"parser",
"is",
"available",
"for",
"the",
"event",
"or",
"if",
"an",
"error",
"occurs",... | 5749d3b71cbefd8eacc316df3f0a6fcb9991bb51 | https://github.com/dropbox/godropbox/blob/5749d3b71cbefd8eacc316df3f0a6fcb9991bb51/database/binlog/parsed_event_reader.go#L16-L24 |
24,664 | dropbox/godropbox | io2/writer_to_reader_adapter.go | NewWriterToReaderAdapter | func NewWriterToReaderAdapter(toBeAdapted func(io.Reader) (io.Reader, error),
output io.Writer,
shouldCloseDownstream bool) io.WriteCloser {
retval := privateReaderAdapter{
Writer: WriterToReaderAdapter{
workChan: make(chan *[]byte),
doneWorkChan: make(chan *[]byte),
errChan: make(chan error, 3),... | go | func NewWriterToReaderAdapter(toBeAdapted func(io.Reader) (io.Reader, error),
output io.Writer,
shouldCloseDownstream bool) io.WriteCloser {
retval := privateReaderAdapter{
Writer: WriterToReaderAdapter{
workChan: make(chan *[]byte),
doneWorkChan: make(chan *[]byte),
errChan: make(chan error, 3),... | [
"func",
"NewWriterToReaderAdapter",
"(",
"toBeAdapted",
"func",
"(",
"io",
".",
"Reader",
")",
"(",
"io",
".",
"Reader",
",",
"error",
")",
",",
"output",
"io",
".",
"Writer",
",",
"shouldCloseDownstream",
"bool",
")",
"io",
".",
"WriteCloser",
"{",
"retva... | // This makes a io.Writer from a io.Reader and begins reading and writing data
// The returned class is not thread safe and public methods must be called from a single thread | [
"This",
"makes",
"a",
"io",
".",
"Writer",
"from",
"a",
"io",
".",
"Reader",
"and",
"begins",
"reading",
"and",
"writing",
"data",
"The",
"returned",
"class",
"is",
"not",
"thread",
"safe",
"and",
"public",
"methods",
"must",
"be",
"called",
"from",
"a",... | 5749d3b71cbefd8eacc316df3f0a6fcb9991bb51 | https://github.com/dropbox/godropbox/blob/5749d3b71cbefd8eacc316df3f0a6fcb9991bb51/io2/writer_to_reader_adapter.go#L29-L41 |
24,665 | dropbox/godropbox | io2/writer_to_reader_adapter.go | Read | func (rself *privateReaderAdapter) Read(data []byte) (int, error) {
lenToCopy := len(rself.bufferToBeRead)
if lenToCopy == 0 {
rself.workReceipt = <-rself.Writer.workChan
if rself.workReceipt == nil {
// no more data to consume
rself.closeReceived = true
return 0, io.EOF
}
rself.bufferToBeRead = *rse... | go | func (rself *privateReaderAdapter) Read(data []byte) (int, error) {
lenToCopy := len(rself.bufferToBeRead)
if lenToCopy == 0 {
rself.workReceipt = <-rself.Writer.workChan
if rself.workReceipt == nil {
// no more data to consume
rself.closeReceived = true
return 0, io.EOF
}
rself.bufferToBeRead = *rse... | [
"func",
"(",
"rself",
"*",
"privateReaderAdapter",
")",
"Read",
"(",
"data",
"[",
"]",
"byte",
")",
"(",
"int",
",",
"error",
")",
"{",
"lenToCopy",
":=",
"len",
"(",
"rself",
".",
"bufferToBeRead",
")",
"\n",
"if",
"lenToCopy",
"==",
"0",
"{",
"rsel... | // this is the private Read implementation, to be used with io.Copy
// on the read thread | [
"this",
"is",
"the",
"private",
"Read",
"implementation",
"to",
"be",
"used",
"with",
"io",
".",
"Copy",
"on",
"the",
"read",
"thread"
] | 5749d3b71cbefd8eacc316df3f0a6fcb9991bb51 | https://github.com/dropbox/godropbox/blob/5749d3b71cbefd8eacc316df3f0a6fcb9991bb51/io2/writer_to_reader_adapter.go#L45-L67 |
24,666 | dropbox/godropbox | io2/writer_to_reader_adapter.go | copyDataToOutput | func copyDataToOutput(inputFactory func(io.Reader) (io.Reader, error),
adaptedInput *privateReaderAdapter,
output io.Writer,
shouldCloseDownstream bool) {
input, err := inputFactory(adaptedInput)
if err != nil {
adaptedInput.Writer.errChan <- err
} else {
_, err = io.Copy(output, input)
if err != nil {
... | go | func copyDataToOutput(inputFactory func(io.Reader) (io.Reader, error),
adaptedInput *privateReaderAdapter,
output io.Writer,
shouldCloseDownstream bool) {
input, err := inputFactory(adaptedInput)
if err != nil {
adaptedInput.Writer.errChan <- err
} else {
_, err = io.Copy(output, input)
if err != nil {
... | [
"func",
"copyDataToOutput",
"(",
"inputFactory",
"func",
"(",
"io",
".",
"Reader",
")",
"(",
"io",
".",
"Reader",
",",
"error",
")",
",",
"adaptedInput",
"*",
"privateReaderAdapter",
",",
"output",
"io",
".",
"Writer",
",",
"shouldCloseDownstream",
"bool",
"... | // This io.Copy's as much data as possible from the wrapped reader
// to the corresponding writer output.
// When finished it closes the downstream and drains the upstream
// writer. Finally it sends any remaining errors to the errChan and
// closes that channel | [
"This",
"io",
".",
"Copy",
"s",
"as",
"much",
"data",
"as",
"possible",
"from",
"the",
"wrapped",
"reader",
"to",
"the",
"corresponding",
"writer",
"output",
".",
"When",
"finished",
"it",
"closes",
"the",
"downstream",
"and",
"drains",
"the",
"upstream",
... | 5749d3b71cbefd8eacc316df3f0a6fcb9991bb51 | https://github.com/dropbox/godropbox/blob/5749d3b71cbefd8eacc316df3f0a6fcb9991bb51/io2/writer_to_reader_adapter.go#L158-L187 |
24,667 | dropbox/godropbox | caching/generic_storage.go | NewGenericStorage | func NewGenericStorage(name string, options GenericStorageOptions) Storage {
return &GenericStorage{
name: name,
get: options.GetFunc,
getMulti: options.GetMultiFunc,
set: options.SetFunc,
setMulti: options.SetMultiFunc,
del: options.DelFunc,
delMulti: optio... | go | func NewGenericStorage(name string, options GenericStorageOptions) Storage {
return &GenericStorage{
name: name,
get: options.GetFunc,
getMulti: options.GetMultiFunc,
set: options.SetFunc,
setMulti: options.SetMultiFunc,
del: options.DelFunc,
delMulti: optio... | [
"func",
"NewGenericStorage",
"(",
"name",
"string",
",",
"options",
"GenericStorageOptions",
")",
"Storage",
"{",
"return",
"&",
"GenericStorage",
"{",
"name",
":",
"name",
",",
"get",
":",
"options",
".",
"GetFunc",
",",
"getMulti",
":",
"options",
".",
"Ge... | // This creates a GenericStorage. See GenericStorageOptions for additional
// information. | [
"This",
"creates",
"a",
"GenericStorage",
".",
"See",
"GenericStorageOptions",
"for",
"additional",
"information",
"."
] | 5749d3b71cbefd8eacc316df3f0a6fcb9991bb51 | https://github.com/dropbox/godropbox/blob/5749d3b71cbefd8eacc316df3f0a6fcb9991bb51/caching/generic_storage.go#L59-L71 |
24,668 | dropbox/godropbox | container/set/set.go | Union | func Union(s1 Set, s2 Set) Set {
if s1 == nil {
if s2 == nil {
return nil
}
return s2.Copy()
}
s3 := s1.Copy()
s3.Union(s2)
return s3
} | go | func Union(s1 Set, s2 Set) Set {
if s1 == nil {
if s2 == nil {
return nil
}
return s2.Copy()
}
s3 := s1.Copy()
s3.Union(s2)
return s3
} | [
"func",
"Union",
"(",
"s1",
"Set",
",",
"s2",
"Set",
")",
"Set",
"{",
"if",
"s1",
"==",
"nil",
"{",
"if",
"s2",
"==",
"nil",
"{",
"return",
"nil",
"\n",
"}",
"\n\n",
"return",
"s2",
".",
"Copy",
"(",
")",
"\n",
"}",
"\n",
"s3",
":=",
"s1",
... | // Returns a new set which is the union of s1 and s2. s1 and s2 are unmodified. | [
"Returns",
"a",
"new",
"set",
"which",
"is",
"the",
"union",
"of",
"s1",
"and",
"s2",
".",
"s1",
"and",
"s2",
"are",
"unmodified",
"."
] | 5749d3b71cbefd8eacc316df3f0a6fcb9991bb51 | https://github.com/dropbox/godropbox/blob/5749d3b71cbefd8eacc316df3f0a6fcb9991bb51/container/set/set.go#L50-L61 |
24,669 | dropbox/godropbox | container/set/set.go | Intersect | func Intersect(s1 Set, s2 Set) Set {
if s1 == nil {
if s2 == nil {
return nil
}
return s2.New()
}
s3 := s1.Copy()
s3.Intersect(s2)
return s3
} | go | func Intersect(s1 Set, s2 Set) Set {
if s1 == nil {
if s2 == nil {
return nil
}
return s2.New()
}
s3 := s1.Copy()
s3.Intersect(s2)
return s3
} | [
"func",
"Intersect",
"(",
"s1",
"Set",
",",
"s2",
"Set",
")",
"Set",
"{",
"if",
"s1",
"==",
"nil",
"{",
"if",
"s2",
"==",
"nil",
"{",
"return",
"nil",
"\n",
"}",
"\n\n",
"return",
"s2",
".",
"New",
"(",
")",
"\n",
"}",
"\n",
"s3",
":=",
"s1",... | // Returns a new set which is the intersect of s1 and s2. s1 and s2 are
// unmodified. | [
"Returns",
"a",
"new",
"set",
"which",
"is",
"the",
"intersect",
"of",
"s1",
"and",
"s2",
".",
"s1",
"and",
"s2",
"are",
"unmodified",
"."
] | 5749d3b71cbefd8eacc316df3f0a6fcb9991bb51 | https://github.com/dropbox/godropbox/blob/5749d3b71cbefd8eacc316df3f0a6fcb9991bb51/container/set/set.go#L65-L76 |
24,670 | dropbox/godropbox | container/set/set.go | Subtract | func Subtract(s1 Set, s2 Set) Set {
if s1 == nil {
if s2 == nil {
return nil
}
return s2.New()
}
s3 := s1.Copy()
s3.Subtract(s2)
return s3
} | go | func Subtract(s1 Set, s2 Set) Set {
if s1 == nil {
if s2 == nil {
return nil
}
return s2.New()
}
s3 := s1.Copy()
s3.Subtract(s2)
return s3
} | [
"func",
"Subtract",
"(",
"s1",
"Set",
",",
"s2",
"Set",
")",
"Set",
"{",
"if",
"s1",
"==",
"nil",
"{",
"if",
"s2",
"==",
"nil",
"{",
"return",
"nil",
"\n",
"}",
"\n\n",
"return",
"s2",
".",
"New",
"(",
")",
"\n",
"}",
"\n",
"s3",
":=",
"s1",
... | // Returns a new set which is the difference between s1 and s2. s1 and s2 are
// unmodified. | [
"Returns",
"a",
"new",
"set",
"which",
"is",
"the",
"difference",
"between",
"s1",
"and",
"s2",
".",
"s1",
"and",
"s2",
"are",
"unmodified",
"."
] | 5749d3b71cbefd8eacc316df3f0a6fcb9991bb51 | https://github.com/dropbox/godropbox/blob/5749d3b71cbefd8eacc316df3f0a6fcb9991bb51/container/set/set.go#L80-L91 |
24,671 | dropbox/godropbox | container/set/set.go | equal | func equal(s Set, s2 Set) bool {
if s.Len() != s2.Len() {
return false
}
return s.IsSubset(s2)
} | go | func equal(s Set, s2 Set) bool {
if s.Len() != s2.Len() {
return false
}
return s.IsSubset(s2)
} | [
"func",
"equal",
"(",
"s",
"Set",
",",
"s2",
"Set",
")",
"bool",
"{",
"if",
"s",
".",
"Len",
"(",
")",
"!=",
"s2",
".",
"Len",
"(",
")",
"{",
"return",
"false",
"\n",
"}",
"\n\n",
"return",
"s",
".",
"IsSubset",
"(",
"s2",
")",
"\n",
"}"
] | // Common functions between the two implementations, since go
// does not allow for any inheritance. | [
"Common",
"functions",
"between",
"the",
"two",
"implementations",
"since",
"go",
"does",
"not",
"allow",
"for",
"any",
"inheritance",
"."
] | 5749d3b71cbefd8eacc316df3f0a6fcb9991bb51 | https://github.com/dropbox/godropbox/blob/5749d3b71cbefd8eacc316df3f0a6fcb9991bb51/container/set/set.go#L340-L346 |
24,672 | dropbox/godropbox | memcache/raw_binary_client.go | NewRawBinaryClient | func NewRawBinaryClient(shard int, channel io.ReadWriter) ClientShard {
return &RawBinaryClient{
shard: shard,
channel: channel,
validState: true,
maxValueLength: defaultMaxValueLength,
}
} | go | func NewRawBinaryClient(shard int, channel io.ReadWriter) ClientShard {
return &RawBinaryClient{
shard: shard,
channel: channel,
validState: true,
maxValueLength: defaultMaxValueLength,
}
} | [
"func",
"NewRawBinaryClient",
"(",
"shard",
"int",
",",
"channel",
"io",
".",
"ReadWriter",
")",
"ClientShard",
"{",
"return",
"&",
"RawBinaryClient",
"{",
"shard",
":",
"shard",
",",
"channel",
":",
"channel",
",",
"validState",
":",
"true",
",",
"maxValueL... | // This creates a new memcache RawBinaryClient. | [
"This",
"creates",
"a",
"new",
"memcache",
"RawBinaryClient",
"."
] | 5749d3b71cbefd8eacc316df3f0a6fcb9991bb51 | https://github.com/dropbox/godropbox/blob/5749d3b71cbefd8eacc316df3f0a6fcb9991bb51/memcache/raw_binary_client.go#L103-L110 |
24,673 | dropbox/godropbox | memcache/raw_binary_client.go | NewLargeRawBinaryClient | func NewLargeRawBinaryClient(shard int, channel io.ReadWriter) ClientShard {
return &RawBinaryClient{
shard: shard,
channel: channel,
validState: true,
maxValueLength: largeMaxValueLength,
}
} | go | func NewLargeRawBinaryClient(shard int, channel io.ReadWriter) ClientShard {
return &RawBinaryClient{
shard: shard,
channel: channel,
validState: true,
maxValueLength: largeMaxValueLength,
}
} | [
"func",
"NewLargeRawBinaryClient",
"(",
"shard",
"int",
",",
"channel",
"io",
".",
"ReadWriter",
")",
"ClientShard",
"{",
"return",
"&",
"RawBinaryClient",
"{",
"shard",
":",
"shard",
",",
"channel",
":",
"channel",
",",
"validState",
":",
"true",
",",
"maxV... | // This creates a new memcache RawBinaryClient for use with np-large cluster. | [
"This",
"creates",
"a",
"new",
"memcache",
"RawBinaryClient",
"for",
"use",
"with",
"np",
"-",
"large",
"cluster",
"."
] | 5749d3b71cbefd8eacc316df3f0a6fcb9991bb51 | https://github.com/dropbox/godropbox/blob/5749d3b71cbefd8eacc316df3f0a6fcb9991bb51/memcache/raw_binary_client.go#L113-L120 |
24,674 | dropbox/godropbox | memcache/raw_binary_client.go | mutate | func (c *RawBinaryClient) mutate(code opCode, item *Item) MutateResponse {
if item == nil {
return NewMutateErrorResponse("", errors.New("item is nil"))
}
c.mutex.Lock()
defer c.mutex.Unlock()
if resp := c.sendMutateRequest(code, item, true); resp != nil {
return resp
}
return c.receiveMutateResponse(code... | go | func (c *RawBinaryClient) mutate(code opCode, item *Item) MutateResponse {
if item == nil {
return NewMutateErrorResponse("", errors.New("item is nil"))
}
c.mutex.Lock()
defer c.mutex.Unlock()
if resp := c.sendMutateRequest(code, item, true); resp != nil {
return resp
}
return c.receiveMutateResponse(code... | [
"func",
"(",
"c",
"*",
"RawBinaryClient",
")",
"mutate",
"(",
"code",
"opCode",
",",
"item",
"*",
"Item",
")",
"MutateResponse",
"{",
"if",
"item",
"==",
"nil",
"{",
"return",
"NewMutateErrorResponse",
"(",
"\"",
"\"",
",",
"errors",
".",
"New",
"(",
"... | // Perform a mutation operation specified by the given code. | [
"Perform",
"a",
"mutation",
"operation",
"specified",
"by",
"the",
"given",
"code",
"."
] | 5749d3b71cbefd8eacc316df3f0a6fcb9991bb51 | https://github.com/dropbox/godropbox/blob/5749d3b71cbefd8eacc316df3f0a6fcb9991bb51/memcache/raw_binary_client.go#L443-L456 |
24,675 | dropbox/godropbox | rate_limiter/rate_limiter.go | MaxQuota | func (l *rateLimiterImpl) MaxQuota() float64 {
l.mutex.Lock()
defer l.mutex.Unlock()
return l.maxQuota
} | go | func (l *rateLimiterImpl) MaxQuota() float64 {
l.mutex.Lock()
defer l.mutex.Unlock()
return l.maxQuota
} | [
"func",
"(",
"l",
"*",
"rateLimiterImpl",
")",
"MaxQuota",
"(",
")",
"float64",
"{",
"l",
".",
"mutex",
".",
"Lock",
"(",
")",
"\n",
"defer",
"l",
".",
"mutex",
".",
"Unlock",
"(",
")",
"\n",
"return",
"l",
".",
"maxQuota",
"\n",
"}"
] | // This returns the leaky bucket's maximum capacity. | [
"This",
"returns",
"the",
"leaky",
"bucket",
"s",
"maximum",
"capacity",
"."
] | 5749d3b71cbefd8eacc316df3f0a6fcb9991bb51 | https://github.com/dropbox/godropbox/blob/5749d3b71cbefd8eacc316df3f0a6fcb9991bb51/rate_limiter/rate_limiter.go#L147-L151 |
24,676 | dropbox/godropbox | rate_limiter/rate_limiter.go | SetMaxQuota | func (l *rateLimiterImpl) SetMaxQuota(q float64) error {
if q < 0 {
return errors.Newf("Max quota must be non-negative: %f", q)
}
l.mutex.Lock()
defer l.mutex.Unlock()
l.maxQuota = q
if l.quota > q {
l.quota = q
}
if l.maxQuota == 0 {
l.cond.Broadcast()
}
return nil
} | go | func (l *rateLimiterImpl) SetMaxQuota(q float64) error {
if q < 0 {
return errors.Newf("Max quota must be non-negative: %f", q)
}
l.mutex.Lock()
defer l.mutex.Unlock()
l.maxQuota = q
if l.quota > q {
l.quota = q
}
if l.maxQuota == 0 {
l.cond.Broadcast()
}
return nil
} | [
"func",
"(",
"l",
"*",
"rateLimiterImpl",
")",
"SetMaxQuota",
"(",
"q",
"float64",
")",
"error",
"{",
"if",
"q",
"<",
"0",
"{",
"return",
"errors",
".",
"Newf",
"(",
"\"",
"\"",
",",
"q",
")",
"\n",
"}",
"\n\n",
"l",
".",
"mutex",
".",
"Lock",
... | // This sets the leaky bucket's maximum capacity. The value must be
// non-negative. | [
"This",
"sets",
"the",
"leaky",
"bucket",
"s",
"maximum",
"capacity",
".",
"The",
"value",
"must",
"be",
"non",
"-",
"negative",
"."
] | 5749d3b71cbefd8eacc316df3f0a6fcb9991bb51 | https://github.com/dropbox/godropbox/blob/5749d3b71cbefd8eacc316df3f0a6fcb9991bb51/rate_limiter/rate_limiter.go#L155-L173 |
24,677 | dropbox/godropbox | rate_limiter/rate_limiter.go | QuotaPerSec | func (l *rateLimiterImpl) QuotaPerSec() float64 {
l.mutex.Lock()
defer l.mutex.Unlock()
return l.quotaPerSec
} | go | func (l *rateLimiterImpl) QuotaPerSec() float64 {
l.mutex.Lock()
defer l.mutex.Unlock()
return l.quotaPerSec
} | [
"func",
"(",
"l",
"*",
"rateLimiterImpl",
")",
"QuotaPerSec",
"(",
")",
"float64",
"{",
"l",
".",
"mutex",
".",
"Lock",
"(",
")",
"\n",
"defer",
"l",
".",
"mutex",
".",
"Unlock",
"(",
")",
"\n\n",
"return",
"l",
".",
"quotaPerSec",
"\n",
"}"
] | // This returns the leaky bucket's fill rate. | [
"This",
"returns",
"the",
"leaky",
"bucket",
"s",
"fill",
"rate",
"."
] | 5749d3b71cbefd8eacc316df3f0a6fcb9991bb51 | https://github.com/dropbox/godropbox/blob/5749d3b71cbefd8eacc316df3f0a6fcb9991bb51/rate_limiter/rate_limiter.go#L176-L181 |
24,678 | dropbox/godropbox | rate_limiter/rate_limiter.go | SetQuotaPerSec | func (l *rateLimiterImpl) SetQuotaPerSec(r float64) error {
if r < 0 {
return errors.Newf("Quota per second must be non-negative: %f", r)
}
l.mutex.Lock()
defer l.mutex.Unlock()
l.quotaPerSec = r
return nil
} | go | func (l *rateLimiterImpl) SetQuotaPerSec(r float64) error {
if r < 0 {
return errors.Newf("Quota per second must be non-negative: %f", r)
}
l.mutex.Lock()
defer l.mutex.Unlock()
l.quotaPerSec = r
return nil
} | [
"func",
"(",
"l",
"*",
"rateLimiterImpl",
")",
"SetQuotaPerSec",
"(",
"r",
"float64",
")",
"error",
"{",
"if",
"r",
"<",
"0",
"{",
"return",
"errors",
".",
"Newf",
"(",
"\"",
"\"",
",",
"r",
")",
"\n",
"}",
"\n\n",
"l",
".",
"mutex",
".",
"Lock",... | // This sets the leaky bucket's fill rate. The value must be non-negative. | [
"This",
"sets",
"the",
"leaky",
"bucket",
"s",
"fill",
"rate",
".",
"The",
"value",
"must",
"be",
"non",
"-",
"negative",
"."
] | 5749d3b71cbefd8eacc316df3f0a6fcb9991bb51 | https://github.com/dropbox/godropbox/blob/5749d3b71cbefd8eacc316df3f0a6fcb9991bb51/rate_limiter/rate_limiter.go#L184-L195 |
24,679 | dropbox/godropbox | rate_limiter/rate_limiter.go | Quota | func (l *rateLimiterImpl) Quota() float64 {
l.mutex.Lock()
defer l.mutex.Unlock()
return l.quota
} | go | func (l *rateLimiterImpl) Quota() float64 {
l.mutex.Lock()
defer l.mutex.Unlock()
return l.quota
} | [
"func",
"(",
"l",
"*",
"rateLimiterImpl",
")",
"Quota",
"(",
")",
"float64",
"{",
"l",
".",
"mutex",
".",
"Lock",
"(",
")",
"\n",
"defer",
"l",
".",
"mutex",
".",
"Unlock",
"(",
")",
"\n",
"return",
"l",
".",
"quota",
"\n",
"}"
] | // This returns the current available quota. | [
"This",
"returns",
"the",
"current",
"available",
"quota",
"."
] | 5749d3b71cbefd8eacc316df3f0a6fcb9991bb51 | https://github.com/dropbox/godropbox/blob/5749d3b71cbefd8eacc316df3f0a6fcb9991bb51/rate_limiter/rate_limiter.go#L198-L202 |
24,680 | dropbox/godropbox | rate_limiter/rate_limiter.go | setQuota | func (l *rateLimiterImpl) setQuota(q float64) {
l.mutex.Lock()
defer l.mutex.Unlock()
l.quota = q
} | go | func (l *rateLimiterImpl) setQuota(q float64) {
l.mutex.Lock()
defer l.mutex.Unlock()
l.quota = q
} | [
"func",
"(",
"l",
"*",
"rateLimiterImpl",
")",
"setQuota",
"(",
"q",
"float64",
")",
"{",
"l",
".",
"mutex",
".",
"Lock",
"(",
")",
"\n",
"defer",
"l",
".",
"mutex",
".",
"Unlock",
"(",
")",
"\n",
"l",
".",
"quota",
"=",
"q",
"\n",
"}"
] | // Only used for testing. | [
"Only",
"used",
"for",
"testing",
"."
] | 5749d3b71cbefd8eacc316df3f0a6fcb9991bb51 | https://github.com/dropbox/godropbox/blob/5749d3b71cbefd8eacc316df3f0a6fcb9991bb51/rate_limiter/rate_limiter.go#L205-L209 |
24,681 | dropbox/godropbox | rate_limiter/rate_limiter.go | Stop | func (l *rateLimiterImpl) Stop() {
l.mutex.Lock()
defer l.mutex.Unlock()
if l.stopped {
return
}
l.stopped = true
close(l.stopChan)
l.ticker.Stop()
l.cond.Broadcast()
} | go | func (l *rateLimiterImpl) Stop() {
l.mutex.Lock()
defer l.mutex.Unlock()
if l.stopped {
return
}
l.stopped = true
close(l.stopChan)
l.ticker.Stop()
l.cond.Broadcast()
} | [
"func",
"(",
"l",
"*",
"rateLimiterImpl",
")",
"Stop",
"(",
")",
"{",
"l",
".",
"mutex",
".",
"Lock",
"(",
")",
"\n",
"defer",
"l",
".",
"mutex",
".",
"Unlock",
"(",
")",
"\n\n",
"if",
"l",
".",
"stopped",
"{",
"return",
"\n",
"}",
"\n\n",
"l",... | // Stop the rate limiter. | [
"Stop",
"the",
"rate",
"limiter",
"."
] | 5749d3b71cbefd8eacc316df3f0a6fcb9991bb51 | https://github.com/dropbox/godropbox/blob/5749d3b71cbefd8eacc316df3f0a6fcb9991bb51/rate_limiter/rate_limiter.go#L262-L276 |
24,682 | dropbox/godropbox | io2/reader_to_writer_adapter.go | Write | func (sbself *splitBufferedWriter) Write(data []byte) (int, error) {
toCopy := len(sbself.userBuffer) - sbself.userBufferCount
if toCopy > len(data) {
toCopy = len(data)
}
copy(sbself.userBuffer[sbself.userBufferCount:sbself.userBufferCount+toCopy], data[:toCopy])
sbself.userBufferCount += toCopy
if toCopy < le... | go | func (sbself *splitBufferedWriter) Write(data []byte) (int, error) {
toCopy := len(sbself.userBuffer) - sbself.userBufferCount
if toCopy > len(data) {
toCopy = len(data)
}
copy(sbself.userBuffer[sbself.userBufferCount:sbself.userBufferCount+toCopy], data[:toCopy])
sbself.userBufferCount += toCopy
if toCopy < le... | [
"func",
"(",
"sbself",
"*",
"splitBufferedWriter",
")",
"Write",
"(",
"data",
"[",
"]",
"byte",
")",
"(",
"int",
",",
"error",
")",
"{",
"toCopy",
":=",
"len",
"(",
"sbself",
".",
"userBuffer",
")",
"-",
"sbself",
".",
"userBufferCount",
"\n",
"if",
... | // writes, preferably to the userBuffer but then optionally to the remainder | [
"writes",
"preferably",
"to",
"the",
"userBuffer",
"but",
"then",
"optionally",
"to",
"the",
"remainder"
] | 5749d3b71cbefd8eacc316df3f0a6fcb9991bb51 | https://github.com/dropbox/godropbox/blob/5749d3b71cbefd8eacc316df3f0a6fcb9991bb51/io2/reader_to_writer_adapter.go#L67-L79 |
24,683 | dropbox/godropbox | io2/reader_to_writer_adapter.go | RemoveUserBuffer | func (sbself *splitBufferedWriter) RemoveUserBuffer() (amountReturned int, err error) {
if len(sbself.userBuffer) > sbself.userBufferCount {
if len(sbself.remainder.Bytes()) != 0 {
err = errors.New("remainder must be clear if userBuffer isn't full")
panic(err)
}
}
amountReturned = sbself.userBufferCount
s... | go | func (sbself *splitBufferedWriter) RemoveUserBuffer() (amountReturned int, err error) {
if len(sbself.userBuffer) > sbself.userBufferCount {
if len(sbself.remainder.Bytes()) != 0 {
err = errors.New("remainder must be clear if userBuffer isn't full")
panic(err)
}
}
amountReturned = sbself.userBufferCount
s... | [
"func",
"(",
"sbself",
"*",
"splitBufferedWriter",
")",
"RemoveUserBuffer",
"(",
")",
"(",
"amountReturned",
"int",
",",
"err",
"error",
")",
"{",
"if",
"len",
"(",
"sbself",
".",
"userBuffer",
")",
">",
"sbself",
".",
"userBufferCount",
"{",
"if",
"len",
... | // removes the user buffer from the splitBufferedWriter
// This makes sure that if the user buffer is only somewhat full, no data remains in the remainder
// This preserves the remainder buffer, since that will be consumed later | [
"removes",
"the",
"user",
"buffer",
"from",
"the",
"splitBufferedWriter",
"This",
"makes",
"sure",
"that",
"if",
"the",
"user",
"buffer",
"is",
"only",
"somewhat",
"full",
"no",
"data",
"remains",
"in",
"the",
"remainder",
"This",
"preserves",
"the",
"remainde... | 5749d3b71cbefd8eacc316df3f0a6fcb9991bb51 | https://github.com/dropbox/godropbox/blob/5749d3b71cbefd8eacc316df3f0a6fcb9991bb51/io2/reader_to_writer_adapter.go#L88-L100 |
24,684 | dropbox/godropbox | io2/reader_to_writer_adapter.go | InstallNewUserBufferAndResetRemainder | func (sbself *splitBufferedWriter) InstallNewUserBufferAndResetRemainder(
data []byte) {
sbself.remainder.Reset()
sbself.userBuffer = data
sbself.userBufferCount = 0
} | go | func (sbself *splitBufferedWriter) InstallNewUserBufferAndResetRemainder(
data []byte) {
sbself.remainder.Reset()
sbself.userBuffer = data
sbself.userBufferCount = 0
} | [
"func",
"(",
"sbself",
"*",
"splitBufferedWriter",
")",
"InstallNewUserBufferAndResetRemainder",
"(",
"data",
"[",
"]",
"byte",
")",
"{",
"sbself",
".",
"remainder",
".",
"Reset",
"(",
")",
"\n",
"sbself",
".",
"userBuffer",
"=",
"data",
"\n",
"sbself",
".",... | // installs a user buffer into the splitBufferedWriter, resetting
// the remainder and original buffer | [
"installs",
"a",
"user",
"buffer",
"into",
"the",
"splitBufferedWriter",
"resetting",
"the",
"remainder",
"and",
"original",
"buffer"
] | 5749d3b71cbefd8eacc316df3f0a6fcb9991bb51 | https://github.com/dropbox/godropbox/blob/5749d3b71cbefd8eacc316df3f0a6fcb9991bb51/io2/reader_to_writer_adapter.go#L104-L110 |
24,685 | dropbox/godropbox | io2/reader_to_writer_adapter.go | Read | func (rwaself *ReaderToWriterAdapter) Read(data []byte) (int, error) {
lenToCopy := len(rwaself.writeBuffer.Bytes()) - rwaself.offset
if lenToCopy > 0 {
// if we have leftover data from a previous call, we can return that only
if lenToCopy > len(data) {
lenToCopy = len(data)
}
copy(data[:lenToCopy],
rwa... | go | func (rwaself *ReaderToWriterAdapter) Read(data []byte) (int, error) {
lenToCopy := len(rwaself.writeBuffer.Bytes()) - rwaself.offset
if lenToCopy > 0 {
// if we have leftover data from a previous call, we can return that only
if lenToCopy > len(data) {
lenToCopy = len(data)
}
copy(data[:lenToCopy],
rwa... | [
"func",
"(",
"rwaself",
"*",
"ReaderToWriterAdapter",
")",
"Read",
"(",
"data",
"[",
"]",
"byte",
")",
"(",
"int",
",",
"error",
")",
"{",
"lenToCopy",
":=",
"len",
"(",
"rwaself",
".",
"writeBuffer",
".",
"Bytes",
"(",
")",
")",
"-",
"rwaself",
".",... | // implements the Read interface by wrapping the Writer with some buffers | [
"implements",
"the",
"Read",
"interface",
"by",
"wrapping",
"the",
"Writer",
"with",
"some",
"buffers"
] | 5749d3b71cbefd8eacc316df3f0a6fcb9991bb51 | https://github.com/dropbox/godropbox/blob/5749d3b71cbefd8eacc316df3f0a6fcb9991bb51/io2/reader_to_writer_adapter.go#L117-L177 |
24,686 | dropbox/godropbox | io2/reader_to_writer_adapter.go | Close | func (rwaself *ReaderToWriterAdapter) Close() error {
var wCloseErr error
var rCloseErr error
if writeCloser, ok := rwaself.writer.(io.WriteCloser); ok {
if !rwaself.closedWriter {
wCloseErr = writeCloser.Close()
}
}
if readCloser, ok := rwaself.upstream.(io.ReadCloser); ok {
rCloseErr = readCloser.Close(... | go | func (rwaself *ReaderToWriterAdapter) Close() error {
var wCloseErr error
var rCloseErr error
if writeCloser, ok := rwaself.writer.(io.WriteCloser); ok {
if !rwaself.closedWriter {
wCloseErr = writeCloser.Close()
}
}
if readCloser, ok := rwaself.upstream.(io.ReadCloser); ok {
rCloseErr = readCloser.Close(... | [
"func",
"(",
"rwaself",
"*",
"ReaderToWriterAdapter",
")",
"Close",
"(",
")",
"error",
"{",
"var",
"wCloseErr",
"error",
"\n",
"var",
"rCloseErr",
"error",
"\n",
"if",
"writeCloser",
",",
"ok",
":=",
"rwaself",
".",
"writer",
".",
"(",
"io",
".",
"WriteC... | // interrupt the read by closing all resources | [
"interrupt",
"the",
"read",
"by",
"closing",
"all",
"resources"
] | 5749d3b71cbefd8eacc316df3f0a6fcb9991bb51 | https://github.com/dropbox/godropbox/blob/5749d3b71cbefd8eacc316df3f0a6fcb9991bb51/io2/reader_to_writer_adapter.go#L180-L200 |
24,687 | dropbox/godropbox | net2/http2/gzip.go | NewGzipResponseWriter | func NewGzipResponseWriter(writer http.ResponseWriter, compressionLevel int) gzipResponseWriter {
gzWriter, _ := gzip.NewWriterLevel(writer, compressionLevel)
return gzipResponseWriter{ResponseWriter: writer, gzWriter: gzWriter}
} | go | func NewGzipResponseWriter(writer http.ResponseWriter, compressionLevel int) gzipResponseWriter {
gzWriter, _ := gzip.NewWriterLevel(writer, compressionLevel)
return gzipResponseWriter{ResponseWriter: writer, gzWriter: gzWriter}
} | [
"func",
"NewGzipResponseWriter",
"(",
"writer",
"http",
".",
"ResponseWriter",
",",
"compressionLevel",
"int",
")",
"gzipResponseWriter",
"{",
"gzWriter",
",",
"_",
":=",
"gzip",
".",
"NewWriterLevel",
"(",
"writer",
",",
"compressionLevel",
")",
"\n",
"return",
... | // compressionLevel - one of the compression levels in the gzip package. | [
"compressionLevel",
"-",
"one",
"of",
"the",
"compression",
"levels",
"in",
"the",
"gzip",
"package",
"."
] | 5749d3b71cbefd8eacc316df3f0a6fcb9991bb51 | https://github.com/dropbox/godropbox/blob/5749d3b71cbefd8eacc316df3f0a6fcb9991bb51/net2/http2/gzip.go#L19-L22 |
24,688 | dropbox/godropbox | sys/filelock/filelock.go | TryRLock | func (f *FileLock) TryRLock() error {
return f.performLock(syscall.LOCK_SH | syscall.LOCK_NB)
} | go | func (f *FileLock) TryRLock() error {
return f.performLock(syscall.LOCK_SH | syscall.LOCK_NB)
} | [
"func",
"(",
"f",
"*",
"FileLock",
")",
"TryRLock",
"(",
")",
"error",
"{",
"return",
"f",
".",
"performLock",
"(",
"syscall",
".",
"LOCK_SH",
"|",
"syscall",
".",
"LOCK_NB",
")",
"\n",
"}"
] | // Non blocking way to try to acquire a shared lock. | [
"Non",
"blocking",
"way",
"to",
"try",
"to",
"acquire",
"a",
"shared",
"lock",
"."
] | 5749d3b71cbefd8eacc316df3f0a6fcb9991bb51 | https://github.com/dropbox/godropbox/blob/5749d3b71cbefd8eacc316df3f0a6fcb9991bb51/sys/filelock/filelock.go#L70-L72 |
24,689 | dropbox/godropbox | sys/filelock/filelock.go | TryLock | func (f *FileLock) TryLock() error {
return f.performLock(syscall.LOCK_EX | syscall.LOCK_NB)
} | go | func (f *FileLock) TryLock() error {
return f.performLock(syscall.LOCK_EX | syscall.LOCK_NB)
} | [
"func",
"(",
"f",
"*",
"FileLock",
")",
"TryLock",
"(",
")",
"error",
"{",
"return",
"f",
".",
"performLock",
"(",
"syscall",
".",
"LOCK_EX",
"|",
"syscall",
".",
"LOCK_NB",
")",
"\n",
"}"
] | // Non blocking way to try to acquire an exclusive lock. | [
"Non",
"blocking",
"way",
"to",
"try",
"to",
"acquire",
"an",
"exclusive",
"lock",
"."
] | 5749d3b71cbefd8eacc316df3f0a6fcb9991bb51 | https://github.com/dropbox/godropbox/blob/5749d3b71cbefd8eacc316df3f0a6fcb9991bb51/sys/filelock/filelock.go#L80-L82 |
24,690 | dropbox/godropbox | database/sqlbuilder/column.go | DateTimeColumn | func DateTimeColumn(name string, nullable NullableColumn) NonAliasColumn {
if !validIdentifierName(name) {
panic("Invalid column name in datetime column")
}
dc := &dateTimeColumn{}
dc.name = name
dc.nullable = nullable
return dc
} | go | func DateTimeColumn(name string, nullable NullableColumn) NonAliasColumn {
if !validIdentifierName(name) {
panic("Invalid column name in datetime column")
}
dc := &dateTimeColumn{}
dc.name = name
dc.nullable = nullable
return dc
} | [
"func",
"DateTimeColumn",
"(",
"name",
"string",
",",
"nullable",
"NullableColumn",
")",
"NonAliasColumn",
"{",
"if",
"!",
"validIdentifierName",
"(",
"name",
")",
"{",
"panic",
"(",
"\"",
"\"",
")",
"\n",
"}",
"\n",
"dc",
":=",
"&",
"dateTimeColumn",
"{",... | // Representation of DateTime columns
// This function will panic if name is not valid | [
"Representation",
"of",
"DateTime",
"columns",
"This",
"function",
"will",
"panic",
"if",
"name",
"is",
"not",
"valid"
] | 5749d3b71cbefd8eacc316df3f0a6fcb9991bb51 | https://github.com/dropbox/godropbox/blob/5749d3b71cbefd8eacc316df3f0a6fcb9991bb51/database/sqlbuilder/column.go#L140-L148 |
24,691 | dropbox/godropbox | database/sqlbuilder/column.go | IntColumn | func IntColumn(name string, nullable NullableColumn) NonAliasColumn {
if !validIdentifierName(name) {
panic("Invalid column name in int column")
}
ic := &integerColumn{}
ic.name = name
ic.nullable = nullable
return ic
} | go | func IntColumn(name string, nullable NullableColumn) NonAliasColumn {
if !validIdentifierName(name) {
panic("Invalid column name in int column")
}
ic := &integerColumn{}
ic.name = name
ic.nullable = nullable
return ic
} | [
"func",
"IntColumn",
"(",
"name",
"string",
",",
"nullable",
"NullableColumn",
")",
"NonAliasColumn",
"{",
"if",
"!",
"validIdentifierName",
"(",
"name",
")",
"{",
"panic",
"(",
"\"",
"\"",
")",
"\n",
"}",
"\n",
"ic",
":=",
"&",
"integerColumn",
"{",
"}"... | // Representation of any integer column
// This function will panic if name is not valid | [
"Representation",
"of",
"any",
"integer",
"column",
"This",
"function",
"will",
"panic",
"if",
"name",
"is",
"not",
"valid"
] | 5749d3b71cbefd8eacc316df3f0a6fcb9991bb51 | https://github.com/dropbox/godropbox/blob/5749d3b71cbefd8eacc316df3f0a6fcb9991bb51/database/sqlbuilder/column.go#L157-L165 |
24,692 | dropbox/godropbox | database/sqlbuilder/column.go | DoubleColumn | func DoubleColumn(name string, nullable NullableColumn) NonAliasColumn {
if !validIdentifierName(name) {
panic("Invalid column name in int column")
}
ic := &doubleColumn{}
ic.name = name
ic.nullable = nullable
return ic
} | go | func DoubleColumn(name string, nullable NullableColumn) NonAliasColumn {
if !validIdentifierName(name) {
panic("Invalid column name in int column")
}
ic := &doubleColumn{}
ic.name = name
ic.nullable = nullable
return ic
} | [
"func",
"DoubleColumn",
"(",
"name",
"string",
",",
"nullable",
"NullableColumn",
")",
"NonAliasColumn",
"{",
"if",
"!",
"validIdentifierName",
"(",
"name",
")",
"{",
"panic",
"(",
"\"",
"\"",
")",
"\n",
"}",
"\n",
"ic",
":=",
"&",
"doubleColumn",
"{",
"... | // Representation of any double column
// This function will panic if name is not valid | [
"Representation",
"of",
"any",
"double",
"column",
"This",
"function",
"will",
"panic",
"if",
"name",
"is",
"not",
"valid"
] | 5749d3b71cbefd8eacc316df3f0a6fcb9991bb51 | https://github.com/dropbox/godropbox/blob/5749d3b71cbefd8eacc316df3f0a6fcb9991bb51/database/sqlbuilder/column.go#L174-L182 |
24,693 | dropbox/godropbox | database/sqlbuilder/column.go | BoolColumn | func BoolColumn(name string, nullable NullableColumn) NonAliasColumn {
if !validIdentifierName(name) {
panic("Invalid column name in bool column")
}
bc := &booleanColumn{}
bc.name = name
bc.nullable = nullable
return bc
} | go | func BoolColumn(name string, nullable NullableColumn) NonAliasColumn {
if !validIdentifierName(name) {
panic("Invalid column name in bool column")
}
bc := &booleanColumn{}
bc.name = name
bc.nullable = nullable
return bc
} | [
"func",
"BoolColumn",
"(",
"name",
"string",
",",
"nullable",
"NullableColumn",
")",
"NonAliasColumn",
"{",
"if",
"!",
"validIdentifierName",
"(",
"name",
")",
"{",
"panic",
"(",
"\"",
"\"",
")",
"\n",
"}",
"\n",
"bc",
":=",
"&",
"booleanColumn",
"{",
"}... | // Representation of TINYINT used as a bool
// This function will panic if name is not valid | [
"Representation",
"of",
"TINYINT",
"used",
"as",
"a",
"bool",
"This",
"function",
"will",
"panic",
"if",
"name",
"is",
"not",
"valid"
] | 5749d3b71cbefd8eacc316df3f0a6fcb9991bb51 | https://github.com/dropbox/godropbox/blob/5749d3b71cbefd8eacc316df3f0a6fcb9991bb51/database/sqlbuilder/column.go#L194-L202 |
24,694 | dropbox/godropbox | resource_pool/managed_handle.go | NewManagedHandle | func NewManagedHandle(
resourceLocation string,
handle interface{},
pool ResourcePool,
options Options) ManagedHandle {
h := &managedHandleImpl{
location: resourceLocation,
handle: handle,
pool: pool,
options: options,
}
atomic.StoreInt32(&h.isActive, 1)
return h
} | go | func NewManagedHandle(
resourceLocation string,
handle interface{},
pool ResourcePool,
options Options) ManagedHandle {
h := &managedHandleImpl{
location: resourceLocation,
handle: handle,
pool: pool,
options: options,
}
atomic.StoreInt32(&h.isActive, 1)
return h
} | [
"func",
"NewManagedHandle",
"(",
"resourceLocation",
"string",
",",
"handle",
"interface",
"{",
"}",
",",
"pool",
"ResourcePool",
",",
"options",
"Options",
")",
"ManagedHandle",
"{",
"h",
":=",
"&",
"managedHandleImpl",
"{",
"location",
":",
"resourceLocation",
... | // This creates a managed handle wrapper. | [
"This",
"creates",
"a",
"managed",
"handle",
"wrapper",
"."
] | 5749d3b71cbefd8eacc316df3f0a6fcb9991bb51 | https://github.com/dropbox/godropbox/blob/5749d3b71cbefd8eacc316df3f0a6fcb9991bb51/resource_pool/managed_handle.go#L46-L61 |
24,695 | dropbox/godropbox | memcache/static_shard_manager.go | NewStaticShardManager | func NewStaticShardManager(
serverAddrs []string,
shardFunc func(key string, numShard int) (shard int),
options net2.ConnectionOptions) ShardManager {
manager := &StaticShardManager{}
manager.Init(
shardFunc,
func(err error) { log.Print(err) },
log.Print,
options)
shardStates := make([]ShardState, len(s... | go | func NewStaticShardManager(
serverAddrs []string,
shardFunc func(key string, numShard int) (shard int),
options net2.ConnectionOptions) ShardManager {
manager := &StaticShardManager{}
manager.Init(
shardFunc,
func(err error) { log.Print(err) },
log.Print,
options)
shardStates := make([]ShardState, len(s... | [
"func",
"NewStaticShardManager",
"(",
"serverAddrs",
"[",
"]",
"string",
",",
"shardFunc",
"func",
"(",
"key",
"string",
",",
"numShard",
"int",
")",
"(",
"shard",
"int",
")",
",",
"options",
"net2",
".",
"ConnectionOptions",
")",
"ShardManager",
"{",
"manag... | // This creates a StaticShardManager, which returns connections from a static
// list of memcache shards. | [
"This",
"creates",
"a",
"StaticShardManager",
"which",
"returns",
"connections",
"from",
"a",
"static",
"list",
"of",
"memcache",
"shards",
"."
] | 5749d3b71cbefd8eacc316df3f0a6fcb9991bb51 | https://github.com/dropbox/godropbox/blob/5749d3b71cbefd8eacc316df3f0a6fcb9991bb51/memcache/static_shard_manager.go#L22-L43 |
24,696 | dropbox/godropbox | bufio2/look_ahead_buffer.go | NewLookAheadBuffer | func NewLookAheadBuffer(src io.Reader, bufferSize int) *LookAheadBuffer {
return NewLookAheadBufferUsing(src, make([]byte, bufferSize, bufferSize))
} | go | func NewLookAheadBuffer(src io.Reader, bufferSize int) *LookAheadBuffer {
return NewLookAheadBufferUsing(src, make([]byte, bufferSize, bufferSize))
} | [
"func",
"NewLookAheadBuffer",
"(",
"src",
"io",
".",
"Reader",
",",
"bufferSize",
"int",
")",
"*",
"LookAheadBuffer",
"{",
"return",
"NewLookAheadBufferUsing",
"(",
"src",
",",
"make",
"(",
"[",
"]",
"byte",
",",
"bufferSize",
",",
"bufferSize",
")",
")",
... | // NewLookAheadBuffer returns a new LookAheadBuffer whose raw buffer has EXACTLY
// the specified size. | [
"NewLookAheadBuffer",
"returns",
"a",
"new",
"LookAheadBuffer",
"whose",
"raw",
"buffer",
"has",
"EXACTLY",
"the",
"specified",
"size",
"."
] | 5749d3b71cbefd8eacc316df3f0a6fcb9991bb51 | https://github.com/dropbox/godropbox/blob/5749d3b71cbefd8eacc316df3f0a6fcb9991bb51/bufio2/look_ahead_buffer.go#L24-L26 |
24,697 | dropbox/godropbox | bufio2/look_ahead_buffer.go | NewLookAheadBufferUsing | func NewLookAheadBufferUsing(src io.Reader, rawBuffer []byte) *LookAheadBuffer {
return &LookAheadBuffer{
src: src,
buffer: rawBuffer,
bytesBuffered: 0,
}
} | go | func NewLookAheadBufferUsing(src io.Reader, rawBuffer []byte) *LookAheadBuffer {
return &LookAheadBuffer{
src: src,
buffer: rawBuffer,
bytesBuffered: 0,
}
} | [
"func",
"NewLookAheadBufferUsing",
"(",
"src",
"io",
".",
"Reader",
",",
"rawBuffer",
"[",
"]",
"byte",
")",
"*",
"LookAheadBuffer",
"{",
"return",
"&",
"LookAheadBuffer",
"{",
"src",
":",
"src",
",",
"buffer",
":",
"rawBuffer",
",",
"bytesBuffered",
":",
... | // NewLookAheadBufferUsing returns a new LookAheadBuffer which uses the
// provided buffer as its raw buffer. This allows buffer reuse, which reduces
// unnecessary memory allocation. | [
"NewLookAheadBufferUsing",
"returns",
"a",
"new",
"LookAheadBuffer",
"which",
"uses",
"the",
"provided",
"buffer",
"as",
"its",
"raw",
"buffer",
".",
"This",
"allows",
"buffer",
"reuse",
"which",
"reduces",
"unnecessary",
"memory",
"allocation",
"."
] | 5749d3b71cbefd8eacc316df3f0a6fcb9991bb51 | https://github.com/dropbox/godropbox/blob/5749d3b71cbefd8eacc316df3f0a6fcb9991bb51/bufio2/look_ahead_buffer.go#L31-L37 |
24,698 | dropbox/godropbox | bufio2/look_ahead_buffer.go | ConsumeAll | func (b *LookAheadBuffer) ConsumeAll() {
err := b.Consume(b.bytesBuffered)
if err != nil { // This should never happen
panic(err)
}
} | go | func (b *LookAheadBuffer) ConsumeAll() {
err := b.Consume(b.bytesBuffered)
if err != nil { // This should never happen
panic(err)
}
} | [
"func",
"(",
"b",
"*",
"LookAheadBuffer",
")",
"ConsumeAll",
"(",
")",
"{",
"err",
":=",
"b",
".",
"Consume",
"(",
"b",
".",
"bytesBuffered",
")",
"\n",
"if",
"err",
"!=",
"nil",
"{",
"// This should never happen",
"panic",
"(",
"err",
")",
"\n",
"}",
... | // ConsumeAll drops all populated bytes from the look ahead buffer. | [
"ConsumeAll",
"drops",
"all",
"populated",
"bytes",
"from",
"the",
"look",
"ahead",
"buffer",
"."
] | 5749d3b71cbefd8eacc316df3f0a6fcb9991bb51 | https://github.com/dropbox/godropbox/blob/5749d3b71cbefd8eacc316df3f0a6fcb9991bb51/bufio2/look_ahead_buffer.go#L126-L131 |
24,699 | dropbox/godropbox | database/binlog/query_event.go | IsModeEnabled | func (e *QueryEvent) IsModeEnabled(mode mysql_proto.SqlMode_BitPosition) bool {
if e.sqlMode == nil {
return false
}
return (*e.sqlMode & (uint64(1) << uint(mode))) != 0
} | go | func (e *QueryEvent) IsModeEnabled(mode mysql_proto.SqlMode_BitPosition) bool {
if e.sqlMode == nil {
return false
}
return (*e.sqlMode & (uint64(1) << uint(mode))) != 0
} | [
"func",
"(",
"e",
"*",
"QueryEvent",
")",
"IsModeEnabled",
"(",
"mode",
"mysql_proto",
".",
"SqlMode_BitPosition",
")",
"bool",
"{",
"if",
"e",
".",
"sqlMode",
"==",
"nil",
"{",
"return",
"false",
"\n",
"}",
"\n\n",
"return",
"(",
"*",
"e",
".",
"sqlMo... | // IsModeEnabled returns true iff sql mode status is set and the mode bit is
// set. | [
"IsModeEnabled",
"returns",
"true",
"iff",
"sql",
"mode",
"status",
"is",
"set",
"and",
"the",
"mode",
"bit",
"is",
"set",
"."
] | 5749d3b71cbefd8eacc316df3f0a6fcb9991bb51 | https://github.com/dropbox/godropbox/blob/5749d3b71cbefd8eacc316df3f0a6fcb9991bb51/database/binlog/query_event.go#L152-L158 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.