Skip to content

Instantly share code, notes, and snippets.

View cristaloleg's full-sized avatar
🇺🇦
still I can't believe it's me

Oleg Kovalov cristaloleg

🇺🇦
still I can't believe it's me
View GitHub Profile
switch arch.Family {
// ... ither case clause.
case sys.I386:
return elf.R_386(nr).String()
case sys.MIPS, sys.MIPS64:
// return elf.R_MIPS(nr).String() // <- 1
case sys.PPC64:
// return elf.R_PPC64(nr).String() // <- 2
case sys.S390X:
// return elf.R_390(nr).String() // <- 3
- for i := len(ip) - 1; i >= 0; i-- {
- v := ip[i]
- buf = append(buf, hexDigit[v&0xF])
- buf = append(buf, '.')
- buf = append(buf, hexDigit[v>>4])
- buf = append(buf, '.')
- }
+ for i := len(ip) - 1; i >= 0; i-- {
+ v := ip[i]
+ buf = append(buf, hexDigit[v&0xF],
- for _, r := range exports.R {
- d.mark(r.Sym, nil)
- }
+ for i := range exports.R {
+ d.mark(exports.R[i].Sym, nil)
+ }
- if c.delim != 0 {
+ if c.delim != delimNone {
s += "_" + c.delim.String()
}
- if c.urlPart != 0 {
+ if c.urlPart != urlPartNone {
s += "_" + c.urlPart.String()
}
- if c.jsCtx != 0 {
+ if c.jsCtx != jsCtxRegexp {
switch arch.Family {
// ... ither case clause.
case sys.I386:
return elf.R_386(nr).String()
case sys.MIPS, sys.MIPS64:
// return elf.R_MIPS(nr).String() // <- 1
case sys.PPC64:
// return elf.R_PPC64(nr).String() // <- 2
case sys.S390X:
// return elf.R_390(nr).String() // <- 3
func (a partsByVarOffset) Less(i, j int) bool {
- return varOffset(a.slots[a.slotIDs[i]]) < varOffset(a.slots[a.slotIDs[i]])
+ return varOffset(a.slots[a.slotIDs[i]]) < varOffset(a.slots[a.slotIDs[j]])
// ^__________________________________^
}
// Local init function for captLocal_checker.go
func init() {
addChecker(&captLocalChecker{}, attrSyntaxOnly)
}
// Ignore ast.Expr 'cause we're not interested what value is assigned to
// a local name. We're interested only in their names.
func (c *captLocalChecker) VisitLocalDef(name astwalk.Name, _ ast.Expr) {
switch {
case c.upcaseNames[name.ID.String()]:
c.warnUpcase(name.ID)
case ast.IsExported(name.ID.String()):
c.warnCapitalized(name.ID)
}
}
func (c *captLocalChecker) Init() {
c.upcaseNames = map[string]bool{
"IN": true,
"OUT": true,
"INOUT": true,
}
}
package lint
// Suffix "Checker" is mandatory
type captLocalChecker struct {
checkerBase
upcaseNames map[string]bool
}