_id
stringlengths
2
7
title
stringlengths
1
118
partition
stringclasses
3 values
text
stringlengths
52
85.5k
language
stringclasses
1 value
meta_information
dict
q171100
Ping
validation
func (s *Server) Ping(node *net.UDPAddr, callback func(krpc.Msg, error)) error { s.mu.Lock() defer s.mu.Unlock() return s.ping(node, callback) }
go
{ "resource": "" }
q171101
addResponseNodes
validation
func (s *Server) addResponseNodes(d krpc.Msg) { if d.R == nil { return } d.R.ForAllNodes(func(ni krpc.NodeInfo) { s.getNode(NewAddr(ni.Addr.UDP()), int160FromByteArray(ni.ID), true) }) }
go
{ "resource": "" }
q171102
findNode
validation
func (s *Server) findNode(addr Addr, targetID int160, callback func(krpc.Msg, error)) (err error) { return s.query(addr, "find_node", &krpc.MsgArgs{ Target: targetID.AsByteArray(), Want: []krpc.Want{krpc.WantNodes, krpc.WantNodes6}, }, func(m krpc.Msg, err error) { // Scrape peers from the response to put in ...
go
{ "resource": "" }
q171103
Bootstrap
validation
func (s *Server) Bootstrap() (ts TraversalStats, err error) { initialAddrs, err := s.traversalStartingNodes() if err != nil { return } var outstanding sync.WaitGroup triedAddrs := newBloomFilterForTraversal() var onAddr func(addr Addr) onAddr = func(addr Addr) { if triedAddrs.Test([]byte(addr.String())) { ...
go
{ "resource": "" }
q171104
NumNodes
validation
func (s *Server) NumNodes() int { s.mu.Lock() defer s.mu.Unlock() return s.numNodes() }
go
{ "resource": "" }
q171105
Nodes
validation
func (s *Server) Nodes() (nis []krpc.NodeInfo) { s.mu.Lock() defer s.mu.Unlock() s.table.forNodes(func(n *node) bool { nis = append(nis, krpc.NodeInfo{ Addr: n.addr.KRPC(), ID: n.id.AsByteArray(), }) return true }) return }
go
{ "resource": "" }
q171106
Close
validation
func (s *Server) Close() { s.mu.Lock() defer s.mu.Unlock() s.closed.Set() s.socket.Close() }
go
{ "resource": "" }
q171107
IsGood
validation
func (n *node) IsGood() bool { if n.id.IsZero() { return false } if time.Since(n.lastGotResponse) < 15*time.Minute { return true } if !n.lastGotResponse.IsZero() && time.Since(n.lastGotQuery) < 15*time.Minute { return true } return false }
go
{ "resource": "" }
q171108
NumContacted
validation
func (a *Announce) NumContacted() int { a.mu.Lock() defer a.mu.Unlock() return a.numContacted }
go
{ "resource": "" }
q171109
Announce
validation
func (s *Server) Announce(infoHash [20]byte, port int, impliedPort bool) (*Announce, error) { startAddrs, err := s.traversalStartingNodes() if err != nil { return nil, err } a := &Announce{ Peers: make(chan PeersValues, 100), values: make(chan PeersValues), triedAddrs: ne...
go
{ "resource": "" }
q171110
maybeAnnouncePeer
validation
func (a *Announce) maybeAnnouncePeer(to Addr, token *string, peerId *krpc.ID) { if token == nil { return } if !a.server.config.NoSecurity && (peerId == nil || !NodeIdSecure(*peerId, to.IP())) { return } a.server.mu.Lock() defer a.server.mu.Unlock() a.server.announcePeer(to, a.infoHash, a.announcePort, *token...
go
{ "resource": "" }
q171111
Close
validation
func (a *Announce) Close() { a.mu.Lock() defer a.mu.Unlock() a.close() }
go
{ "resource": "" }
q171112
NewUUID
validation
func NewUUID() (UUID, error) { nodeMu.Lock() if nodeID == zeroID { setNodeInterface("") } nodeMu.Unlock() var uuid UUID now, seq, err := GetTime() if err != nil { return uuid, err } timeLow := uint32(now & 0xffffffff) timeMid := uint16((now >> 32) & 0xffff) timeHi := uint16((now >> 48) & 0x0fff) timeH...
go
{ "resource": "" }
q171113
SetNodeInterface
validation
func SetNodeInterface(name string) bool { defer nodeMu.Unlock() nodeMu.Lock() return setNodeInterface(name) }
go
{ "resource": "" }
q171114
NodeID
validation
func NodeID() []byte { defer nodeMu.Unlock() nodeMu.Lock() if nodeID == zeroID { setNodeInterface("") } nid := nodeID return nid[:] }
go
{ "resource": "" }
q171115
SetNodeID
validation
func SetNodeID(id []byte) bool { if len(id) < 6 { return false } defer nodeMu.Unlock() nodeMu.Lock() copy(nodeID[:], id) ifname = "user" return true }
go
{ "resource": "" }
q171116
NodeID
validation
func (uuid UUID) NodeID() []byte { var node [6]byte copy(node[:], uuid[10:]) return node[:] }
go
{ "resource": "" }
q171117
ParseBytes
validation
func ParseBytes(b []byte) (UUID, error) { var uuid UUID switch len(b) { case 36: // xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx case 36 + 9: // urn:uuid:xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx if !bytes.Equal(bytes.ToLower(b[:9]), []byte("urn:uuid:")) { return uuid, fmt.Errorf("invalid urn prefix: %q", b[:9]) } b = ...
go
{ "resource": "" }
q171118
MustParse
validation
func MustParse(s string) UUID { uuid, err := Parse(s) if err != nil { panic(`uuid: Parse(` + s + `): ` + err.Error()) } return uuid }
go
{ "resource": "" }
q171119
FromBytes
validation
func FromBytes(b []byte) (uuid UUID, err error) { err = uuid.UnmarshalBinary(b) return uuid, err }
go
{ "resource": "" }
q171120
Must
validation
func Must(uuid UUID, err error) UUID { if err != nil { panic(err) } return uuid }
go
{ "resource": "" }
q171121
Variant
validation
func (uuid UUID) Variant() Variant { switch { case (uuid[8] & 0xc0) == 0x80: return RFC4122 case (uuid[8] & 0xe0) == 0xc0: return Microsoft case (uuid[8] & 0xe0) == 0xe0: return Future default: return Reserved } }
go
{ "resource": "" }
q171122
Time
validation
func (uuid UUID) Time() Time { time := int64(binary.BigEndian.Uint32(uuid[0:4])) time |= int64(binary.BigEndian.Uint16(uuid[4:6])) << 32 time |= int64(binary.BigEndian.Uint16(uuid[6:8])&0xfff) << 48 return Time(time) }
go
{ "resource": "" }
q171123
MarshalText
validation
func (uuid UUID) MarshalText() ([]byte, error) { var js [36]byte encodeHex(js[:], uuid) return js[:], nil }
go
{ "resource": "" }
q171124
UnmarshalText
validation
func (uuid *UUID) UnmarshalText(data []byte) error { id, err := ParseBytes(data) if err == nil { *uuid = id } return err }
go
{ "resource": "" }
q171125
UnmarshalBinary
validation
func (uuid *UUID) UnmarshalBinary(data []byte) error { if len(data) != 16 { return fmt.Errorf("invalid UUID (got %d bytes)", len(data)) } copy(uuid[:], data) return nil }
go
{ "resource": "" }
q171126
RunCursorAt
validation
func (s *Select) RunCursorAt(cursorPos, scroll int) (int, string, error) { if s.Size == 0 { s.Size = 5 } l, err := list.New(s.Items, s.Size) if err != nil { return 0, "", err } l.Searcher = s.Searcher s.list = l s.setKeys() err = s.prepareTemplates() if err != nil { return 0, "", err } return s.in...
go
{ "resource": "" }
q171127
Run
validation
func (sa *SelectWithAdd) Run() (int, string, error) { if len(sa.Items) > 0 { newItems := append([]string{sa.AddLabel}, sa.Items...) list, err := list.New(newItems, 5) if err != nil { return 0, "", err } s := Select{ Label: sa.Label, Items: newItems, IsVimMode: sa.IsVimMode, HideHelp:...
go
{ "resource": "" }
q171128
New
validation
func New(w io.Writer) *ScreenBuf { return &ScreenBuf{buf: &bytes.Buffer{}, w: w} }
go
{ "resource": "" }
q171129
Clear
validation
func (s *ScreenBuf) Clear() error { for i := 0; i < s.height; i++ { _, err := s.buf.Write(moveUp) if err != nil { return err } _, err = s.buf.Write(clearLine) if err != nil { return err } } s.cursor = 0 s.height = 0 s.reset = false return nil }
go
{ "resource": "" }
q171130
Write
validation
func (s *ScreenBuf) Write(b []byte) (int, error) { if bytes.ContainsAny(b, "\r\n") { return 0, fmt.Errorf("%q should not contain either \\r or \\n", b) } if s.reset { if err := s.Clear(); err != nil { return 0, err } } switch { case s.cursor == s.height: n, err := s.buf.Write(clearLine) if err != n...
go
{ "resource": "" }
q171131
Flush
validation
func (s *ScreenBuf) Flush() error { for i := s.cursor; i < s.height; i++ { if i < s.height { _, err := s.buf.Write(clearLine) if err != nil { return err } } _, err := s.buf.Write(moveDown) if err != nil { return err } } _, err := s.buf.WriteTo(s.w) if err != nil { return err } s.buf....
go
{ "resource": "" }
q171132
Styler
validation
func Styler(attrs ...attribute) func(interface{}) string { attrstrs := make([]string, len(attrs)) for i, v := range attrs { attrstrs[i] = strconv.Itoa(int(v)) } seq := strings.Join(attrstrs, ";") return func(v interface{}) string { end := "" s, ok := v.(string) if !ok || !strings.HasSuffix(s, ResetCode) ...
go
{ "resource": "" }
q171133
New
validation
func New(items interface{}, size int) (*List, error) { if size < 1 { return nil, fmt.Errorf("list size %d must be greater than 0", size) } if items == nil || reflect.TypeOf(items).Kind() != reflect.Slice { return nil, fmt.Errorf("items %v is not a slice", items) } slice := reflect.ValueOf(items) values := m...
go
{ "resource": "" }
q171134
Prev
validation
func (l *List) Prev() { if l.cursor > 0 { l.cursor-- } if l.start > l.cursor { l.start = l.cursor } }
go
{ "resource": "" }
q171135
Search
validation
func (l *List) Search(term string) { term = strings.Trim(term, " ") l.cursor = 0 l.start = 0 l.search(term) }
go
{ "resource": "" }
q171136
CancelSearch
validation
func (l *List) CancelSearch() { l.cursor = 0 l.start = 0 l.scope = l.items }
go
{ "resource": "" }
q171137
SetStart
validation
func (l *List) SetStart(i int) { if i < 0 { i = 0 } if i > l.cursor { l.start = l.cursor } else { l.start = i } }
go
{ "resource": "" }
q171138
SetCursor
validation
func (l *List) SetCursor(i int) { max := len(l.scope) - 1 if i >= max { i = max } if i < 0 { i = 0 } l.cursor = i if l.start > l.cursor { l.start = l.cursor } else if l.start+l.size <= l.cursor { l.start = l.cursor - l.size + 1 } }
go
{ "resource": "" }
q171139
Next
validation
func (l *List) Next() { max := len(l.scope) - 1 if l.cursor < max { l.cursor++ } if l.start+l.size <= l.cursor { l.start = l.cursor - l.size + 1 } }
go
{ "resource": "" }
q171140
PageUp
validation
func (l *List) PageUp() { start := l.start - l.size if start < 0 { l.start = 0 } else { l.start = start } cursor := l.start if cursor < l.cursor { l.cursor = cursor } }
go
{ "resource": "" }
q171141
PageDown
validation
func (l *List) PageDown() { start := l.start + l.size max := len(l.scope) - l.size switch { case len(l.scope) < l.size: l.start = 0 case start > max: l.start = max default: l.start = start } cursor := l.start if cursor == l.cursor { l.cursor = len(l.scope) - 1 } else if cursor > l.cursor { l.curs...
go
{ "resource": "" }
q171142
Items
validation
func (l *List) Items() ([]interface{}, int) { var result []interface{} max := len(l.scope) end := l.start + l.size if end > max { end = max } active := NotFound for i, j := l.start, 0; i < end; i, j = i+1, j+1 { if l.cursor == i { active = j } result = append(result, *l.scope[i]) } return resul...
go
{ "resource": "" }
q171143
NewCursor
validation
func NewCursor(startinginput string, pointer Pointer, eraseDefault bool) Cursor { if pointer == nil { pointer = defaultCursor } cur := Cursor{Cursor: pointer, Position: len(startinginput), input: []rune(startinginput), erase: eraseDefault} if eraseDefault { cur.Start() } else { cur.End() } return cur }
go
{ "resource": "" }
q171144
correctPosition
validation
func (c *Cursor) correctPosition() { if c.Position > len(c.input) { c.Position = len(c.input) } if c.Position < 0 { c.Position = 0 } }
go
{ "resource": "" }
q171145
format
validation
func format(a []rune, c *Cursor) string { i := c.Position var b []rune out := make([]rune, 0) if i < len(a) { b = c.Cursor([]rune(a[i : i+1])) out = append(out, a[:i]...) // does not include i out = append(out, b...) // add the cursor out = append(out, a[i+1:]...) // add the rest after i } else { ...
go
{ "resource": "" }
q171146
Format
validation
func (c *Cursor) Format() string { r := c.input // insert the cursor return format(r, c) }
go
{ "resource": "" }
q171147
FormatMask
validation
func (c *Cursor) FormatMask(mask rune) string { r := make([]rune, len(c.input)) for i := range r { r[i] = mask } return format(r, c) }
go
{ "resource": "" }
q171148
Replace
validation
func (c *Cursor) Replace(input string) { c.input = []rune(input) c.End() }
go
{ "resource": "" }
q171149
Place
validation
func (c *Cursor) Place(position int) { c.Position = position c.correctPosition() }
go
{ "resource": "" }
q171150
Move
validation
func (c *Cursor) Move(shift int) { // delete the current cursor c.Position = c.Position + shift c.correctPosition() }
go
{ "resource": "" }
q171151
Backspace
validation
func (c *Cursor) Backspace() { a := c.input i := c.Position if i == 0 { // Shrug return } if i == len(a) { c.input = a[:i-1] } else { c.input = append(a[:i-1], a[i:]...) } // now it's pointing to the i+1th element c.Move(-1) }
go
{ "resource": "" }
q171152
Listen
validation
func (c *Cursor) Listen(line []rune, pos int, key rune) ([]rune, int, bool) { if line != nil { // no matter what, update our internal representation. c.Update(string(line)) } switch key { case 0: // empty case KeyEnter: return []rune(c.Get()), c.Position, false case KeyBackspace: if c.erase { c.erase ...
go
{ "resource": "" }
q171153
AggregateIssueChan
validation
func AggregateIssueChan(issues chan *Issue) chan *Issue { out := make(chan *Issue, 1000000) issueMap := make(map[issueKey]*multiIssue) go func() { for issue := range issues { key := issueKey{ path: issue.Path.String(), line: issue.Line, col: issue.Col, message: issue.Message, } i...
go
{ "resource": "" }
q171154
StaticCallee
validation
func (c *CallCommon) StaticCallee() *Function { switch fn := c.Value.(type) { case *Function: return fn case *MakeClosure: return fn.Fn.(*Function) } return nil }
go
{ "resource": "" }
q171155
Func
validation
func (p *Package) Func(name string) (f *Function) { f, _ = p.Members[name].(*Function) return }
go
{ "resource": "" }
q171156
Var
validation
func (p *Package) Var(name string) (g *Global) { g, _ = p.Members[name].(*Global) return }
go
{ "resource": "" }
q171157
Const
validation
func (p *Package) Const(name string) (c *NamedConst) { c, _ = p.Members[name].(*NamedConst) return }
go
{ "resource": "" }
q171158
Type
validation
func (p *Package) Type(name string) (t *Type) { t, _ = p.Members[name].(*Type) return }
go
{ "resource": "" }
q171159
getGoPath
validation
func getGoPath() string { path := os.Getenv("GOPATH") if path == "" { user, err := user.Current() kingpin.FatalIfError(err, "") path = filepath.Join(user.HomeDir, "go") } return path }
go
{ "resource": "" }
q171160
addPath
validation
func addPath(paths []string, path string) []string { for _, existingpath := range paths { if path == existingpath { return paths } } return append(paths, path) }
go
{ "resource": "" }
q171161
configureEnvironmentForInstall
validation
func configureEnvironmentForInstall() { if config.Update { warning(`Linters are now vendored by default, --update ignored. The original behaviour can be re-enabled with --no-vendored-linters. To request an update for a vendored linter file an issue at: https://github.com/alecthomas/gometalinter/issues/new `) } go...
go
{ "resource": "" }
q171162
UnmarshalStrict
validation
func UnmarshalStrict(in []byte, out interface{}) (err error) { return unmarshal(in, out, true) }
go
{ "resource": "" }
q171163
Decode
validation
func (dec *Decoder) Decode(v interface{}) (err error) { d := newDecoder(dec.strict) defer handleErr(&err) node := dec.parser.parse() if node == nil { return io.EOF } out := reflect.ValueOf(v) if out.Kind() == reflect.Ptr && !out.IsNil() { out = out.Elem() } d.unmarshal(node, out) if len(d.terrors) > 0 { ...
go
{ "resource": "" }
q171164
Close
validation
func (e *Encoder) Close() (err error) { defer handleErr(&err) e.encoder.finish() return nil }
go
{ "resource": "" }
q171165
yaml_parser_save_simple_key
validation
func yaml_parser_save_simple_key(parser *yaml_parser_t) bool { // A simple key is required at the current position if the scanner is in // the block context and the current column coincides with the indentation // level. required := parser.flow_level == 0 && parser.indent == parser.mark.column // // If the curr...
go
{ "resource": "" }
q171166
align
validation
func align(x, a int64) int64 { y := x + a - 1 return y - y%a }
go
{ "resource": "" }
q171167
lintName
validation
func lintName(name string, initialisms map[string]bool) (should string) { // A large part of this function is copied from // github.com/golang/lint, Copyright (c) 2013 The Go Authors, // licensed under the BSD 3-clause license. // Fast path for simple cases: "_" and all lowercase. if name == "_" { return name ...
go
{ "resource": "" }
q171168
sanityCheck
validation
func sanityCheck(fn *Function, reporter io.Writer) bool { if reporter == nil { reporter = os.Stderr } return (&sanity{reporter: reporter}).checkFunction(fn) }
go
{ "resource": "" }
q171169
mustSanityCheck
validation
func mustSanityCheck(fn *Function, reporter io.Writer) { if !sanityCheck(fn, reporter) { fn.WriteTo(os.Stderr) panic("SanityCheck failed") } }
go
{ "resource": "" }
q171170
findDuplicate
validation
func findDuplicate(blocks []*BasicBlock) *BasicBlock { if len(blocks) < 2 { return nil } if blocks[0] == blocks[1] { return blocks[0] } // Slow path: m := make(map[*BasicBlock]bool) for _, b := range blocks { if m[b] { return b } m[b] = true } return nil }
go
{ "resource": "" }
q171171
newIssuePathFromAbsPath
validation
func newIssuePathFromAbsPath(root, path string) (IssuePath, error) { resolvedRoot, err := filepath.EvalSymlinks(root) if err != nil { return newIssuePath(root, path), err } resolvedPath, err := filepath.EvalSymlinks(path) if err != nil { return newIssuePath(root, path), err } if !filepath.IsAbs(path) { r...
go
{ "resource": "" }
q171172
NewIssue
validation
func NewIssue(linter string, formatTmpl *template.Template) (*Issue, error) { issue := &Issue{ Line: 1, Severity: Warning, Linter: linter, formatTmpl: formatTmpl, } err := formatTmpl.Execute(ioutil.Discard, issue) return issue, err }
go
{ "resource": "" }
q171173
SortIssueChan
validation
func SortIssueChan(issues chan *Issue, order []string) chan *Issue { out := make(chan *Issue, 1000000) sorted := &sortedIssues{ issues: []*Issue{}, order: order, } go func() { for issue := range issues { sorted.issues = append(sorted.issues, issue) } sort.Sort(sorted) for _, issue := range sorted.is...
go
{ "resource": "" }
q171174
logicalBinop
validation
func (b *builder) logicalBinop(fn *Function, e *ast.BinaryExpr) Value { rhs := fn.newBasicBlock("binop.rhs") done := fn.newBasicBlock("binop.done") // T(e) = T(e.X) = T(e.Y) after untyped constants have been // eliminated. // TODO(adonovan): not true; MyBool==MyBool yields UntypedBool. t := fn.Pkg.typeOf(e) va...
go
{ "resource": "" }
q171175
expr
validation
func (b *builder) expr(fn *Function, e ast.Expr) Value { e = unparen(e) tv := fn.Pkg.info.Types[e] // Is expression a constant? if tv.Value != nil { return NewConst(tv.Value, tv.Type) } var v Value if tv.Addressable() { // Prefer pointer arithmetic ({Index,Field}Addr) followed // by Load over subelement...
go
{ "resource": "" }
q171176
stmtList
validation
func (b *builder) stmtList(fn *Function, list []ast.Stmt) { for _, s := range list { b.stmt(fn, s) } }
go
{ "resource": "" }
q171177
assignOp
validation
func (b *builder) assignOp(fn *Function, loc lvalue, incr Value, op token.Token, pos token.Pos) { oldv := loc.load(fn) loc.store(fn, emitArith(fn, op, oldv, emitConv(fn, incr, oldv.Type()), loc.typ(), pos)) }
go
{ "resource": "" }
q171178
localValueSpec
validation
func (b *builder) localValueSpec(fn *Function, spec *ast.ValueSpec) { switch { case len(spec.Values) == len(spec.Names): // e.g. var x, y = 0, 1 // 1:1 assignment for i, id := range spec.Names { if !isBlankIdent(id) { fn.addLocalForIdent(id) } lval := b.addr(fn, id, false) // non-escaping b.assi...
go
{ "resource": "" }
q171179
arrayLen
validation
func (b *builder) arrayLen(fn *Function, elts []ast.Expr) int64 { var max int64 = -1 var i int64 = -1 for _, e := range elts { if kv, ok := e.(*ast.KeyValueExpr); ok { i = b.expr(fn, kv.Key).(*Const).Int64() } else { i++ } if i > max { max = i } } return max + 1 }
go
{ "resource": "" }
q171180
switchStmt
validation
func (b *builder) switchStmt(fn *Function, s *ast.SwitchStmt, label *lblock) { // We treat SwitchStmt like a sequential if-else chain. // Multiway dispatch can be recovered later by ssautil.Switches() // to those cases that are free of side effects. if s.Init != nil { b.stmt(fn, s.Init) } var tag Value = vTrue ...
go
{ "resource": "" }
q171181
typeSwitchStmt
validation
func (b *builder) typeSwitchStmt(fn *Function, s *ast.TypeSwitchStmt, label *lblock) { // We treat TypeSwitchStmt like a sequential if-else chain. // Multiway dispatch can be recovered later by ssautil.Switches(). // Typeswitch lowering: // // var x X // switch y := x.(type) { // case T1, T2: S1 ...
go
{ "resource": "" }
q171182
forStmt
validation
func (b *builder) forStmt(fn *Function, s *ast.ForStmt, label *lblock) { // ...init... // jump loop // loop: // if cond goto body else done // body: // ...body... // jump post // post: (target of continue) // ...post... // jump loop // done: (...
go
{ "resource": "" }
q171183
rangeStmt
validation
func (b *builder) rangeStmt(fn *Function, s *ast.RangeStmt, label *lblock) { var tk, tv types.Type if s.Key != nil && !isBlankIdent(s.Key) { tk = fn.Pkg.typeOf(s.Key) } if s.Value != nil && !isBlankIdent(s.Value) { tv = fn.Pkg.typeOf(s.Value) } // If iteration variables are defined (:=), this // occurs once...
go
{ "resource": "" }
q171184
buildFunction
validation
func (b *builder) buildFunction(fn *Function) { if fn.Blocks != nil { return // building already started } var recvField *ast.FieldList var body *ast.BlockStmt var functype *ast.FuncType switch n := fn.syntax.(type) { case nil: return // not a Go source function. (Synthetic, or from object file.) case *as...
go
{ "resource": "" }
q171185
buildFuncDecl
validation
func (b *builder) buildFuncDecl(pkg *Package, decl *ast.FuncDecl) { id := decl.Name if isBlankIdent(id) { return // discard } fn := pkg.values[pkg.info.Defs[id]].(*Function) if decl.Recv == nil && id.Name == "init" { var v Call v.Call.Value = fn v.setType(types.NewTuple()) pkg.init.emit(&v) } b.buildFu...
go
{ "resource": "" }
q171186
Build
validation
func (prog *Program) Build() { var wg sync.WaitGroup for _, p := range prog.packages { if prog.mode&BuildSerially != 0 { p.Build() } else { wg.Add(1) go func(p *Package) { p.Build() wg.Done() }(p) } } wg.Wait() }
go
{ "resource": "" }
q171187
objectOf
validation
func (p *Package) objectOf(id *ast.Ident) types.Object { if o := p.info.ObjectOf(id); o != nil { return o } panic(fmt.Sprintf("no types.Object for ast.Ident %s @ %s", id.Name, p.Prog.Fset.Position(id.Pos()))) }
go
{ "resource": "" }
q171188
typeOf
validation
func (p *Package) typeOf(e ast.Expr) types.Type { if T := p.info.TypeOf(e); T != nil { return T } panic(fmt.Sprintf("no type for %T @ %s", e, p.Prog.Fset.Position(e.Pos()))) }
go
{ "resource": "" }
q171189
expect
validation
func (p *parser) expect(e yaml_event_type_t) { if p.event.typ == yaml_NO_EVENT { if !yaml_parser_parse(&p.parser, &p.event) { p.fail() } } if p.event.typ == yaml_STREAM_END_EVENT { failf("attempted to go past the end of stream; corrupted value?") } if p.event.typ != e { p.parser.problem = fmt.Sprintf("e...
go
{ "resource": "" }
q171190
peek
validation
func (p *parser) peek() yaml_event_type_t { if p.event.typ != yaml_NO_EVENT { return p.event.typ } if !yaml_parser_parse(&p.parser, &p.event) { p.fail() } return p.event.typ }
go
{ "resource": "" }
q171191
prepare
validation
func (d *decoder) prepare(n *node, out reflect.Value) (newout reflect.Value, unmarshaled, good bool) { if n.tag == yaml_NULL_TAG || n.kind == scalarNode && n.tag == "" && (n.value == "null" || n.value == "~" || n.value == "" && n.implicit) { return out, false, false } again := true for again { again = false i...
go
{ "resource": "" }
q171192
Parse
validation
func Parse(f string) ([]interface{}, error) { var out []interface{} for len(f) > 0 { if f[0] == '%' { v, n, err := ParseVerb(f) if err != nil { return nil, err } f = f[n:] out = append(out, v) } else { n := strings.IndexByte(f, '%') if n > -1 { out = append(out, f[:n]) f = f[n:] ...
go
{ "resource": "" }
q171193
ParseVerb
validation
func ParseVerb(f string) (Verb, int, error) { if len(f) < 2 { return Verb{}, 0, ErrInvalid } const ( flags = 1 width = 2 widthStar = 3 widthIndex = 5 dot = 6 prec = 7 precStar = 8 precIndex = 10 verbIndex = 11 verb = 12 ) m := re.FindStringSubmatch(f) if m == nil {...
go
{ "resource": "" }
q171194
terminates
validation
func terminates(fn *ssa.Function) bool { if fn.Blocks == nil { // assuming that a function terminates is the conservative // choice return true } for _, block := range fn.Blocks { if len(block.Instrs) == 0 { continue } if _, ok := block.Instrs[len(block.Instrs)-1].(*ssa.Return); ok { return true ...
go
{ "resource": "" }
q171195
yaml_reader_read_handler
validation
func yaml_reader_read_handler(parser *yaml_parser_t, buffer []byte) (n int, err error) { return parser.input_reader.Read(buffer) }
go
{ "resource": "" }
q171196
yaml_parser_set_input_reader
validation
func yaml_parser_set_input_reader(parser *yaml_parser_t, r io.Reader) { if parser.read_handler != nil { panic("must set the input source only once") } parser.read_handler = yaml_reader_read_handler parser.input_reader = r }
go
{ "resource": "" }
q171197
yaml_emitter_initialize
validation
func yaml_emitter_initialize(emitter *yaml_emitter_t) { *emitter = yaml_emitter_t{ buffer: make([]byte, output_buffer_size), raw_buffer: make([]byte, 0, output_raw_buffer_size), states: make([]yaml_emitter_state_t, 0, initial_stack_size), events: make([]yaml_event_t, 0, initial_queue_size), } }
go
{ "resource": "" }
q171198
yaml_writer_write_handler
validation
func yaml_writer_write_handler(emitter *yaml_emitter_t, buffer []byte) error { _, err := emitter.output_writer.Write(buffer) return err }
go
{ "resource": "" }
q171199
yaml_emitter_set_output_writer
validation
func yaml_emitter_set_output_writer(emitter *yaml_emitter_t, w io.Writer) { if emitter.write_handler != nil { panic("must set the output target only once") } emitter.write_handler = yaml_writer_write_handler emitter.output_writer = w }
go
{ "resource": "" }