n.Const = strconv.Itoa64(n.Type.EnumValues[k])
// Remove injected enum to ensure the value will deep-compare
// equally in future loads of the same constant.
- n.Type.EnumValues[k] = 0, false
+ delete(n.Type.EnumValues, k)
} else if n.Kind == "const" && i < len(enumVal) {
n.Const = strconv.Itoa64(enumVal[i])
}
return reflect.Value{}
}
for k := range m {
- m[k] = reflect.Value{}, false
+ delete(m, k)
}
val = apply(f, val)
if match(m, pat, val) {
// If the parse fails, take the type out of the cache
// so that the next call with this offset doesn't hit
// the cache and return success.
- d.typeCache[off] = nil, false
+ delete(d.typeCache, off)
return nil, err
}
continue
}
// we have a match - eliminate this error
- expected[pos] = "", false
+ delete(expected, pos)
} else {
// To keep in mind when analyzing failed test output:
// If the same error position occurs multiple times in errors,
defFun("close")
defFun("complex")
defFun("copy")
+ defFun("delete")
defFun("imag")
defFun("len")
defFun("make")
decoderMap[remoteId] = enginePtr
*enginePtr, err = dec.compileDec(remoteId, ut)
if err != nil {
- decoderMap[remoteId] = nil, false
+ delete(decoderMap, remoteId)
}
}
return
*enginePtr, err = dec.compileIgnoreSingle(wireId)
}
if err != nil {
- dec.ignorerCache[wireId] = nil, false
+ delete(dec.ignorerCache, wireId)
}
}
return
var type0, type1 gobType
defer func() {
if err != nil {
- types[rt] = nil, false
+ delete(types, rt)
}
}()
// Install the top-level type before the subtypes (e.g. struct before
case typeData:
// If the filter role is implemented, read the data stream here.
case typeAbortRequest:
- requests[rec.h.Id] = nil, false
+ delete(requests, rec.h.Id)
c.conn.writeEndRequest(rec.h.Id, 0, statusRequestComplete)
if !req.keepConn {
// connection will close upon return
// Retrieve the pipeline ID of this request/response pair
sc.lk.Lock()
id, ok := sc.pipereq[req]
- sc.pipereq[req] = 0, false
+ delete(sc.pipereq, req)
if !ok {
sc.lk.Unlock()
return ErrPipeline
// Retrieve the pipeline ID of this request/response pair
cc.lk.Lock()
id, ok := cc.pipereq[req]
- cc.pipereq[req] = 0, false
+ delete(cc.pipereq, req)
if !ok {
cc.lk.Unlock()
return nil, ErrPipeline
return nil, nil
}
- header["Transfer-Encoding"] = nil, false
+ delete(header, "Transfer-Encoding")
// Head responses have no bodies, so the transfer encoding
// should be ignored.
// Chunked encoding trumps Content-Length. See RFC 2616
// Section 4.4. Currently len(te) > 0 implies chunked
// encoding.
- header["Content-Length"] = nil, false
+ delete(header, "Content-Length")
return te, nil
}
}
if len(pconns) == 1 {
pconn = pconns[0]
- t.idleConn[key] = nil, false
+ delete(t.idleConn, key)
} else {
// 2 or more cached connections; pop last
// TODO: queue?
if !ok {
return nil
}
- s.pending[key] = nil, false
+ delete(s.pending, key)
return netfd
}
}
if t > 0 {
if t <= now {
- s.pending[key] = nil, false
+ delete(s.pending, key)
if mode == 'r' {
s.poll.DelFD(fd.sysfd, mode)
fd.rdeadline = -1
if e := syscall.EpollCtl(p.epfd, syscall.EPOLL_CTL_DEL, fd, nil); e != 0 {
print("Epoll delete fd=", fd, ": ", os.Errno(e).String(), "\n")
}
- p.events[fd] = 0, false
+ delete(p.events, fd)
}
}
// Del deletes the values associated with key.
func (h MIMEHeader) Del(key string) {
- h[CanonicalMIMEHeaderKey(key)] = nil, false
+ delete(h, CanonicalMIMEHeaderKey(key))
}
}
c, ok := s.wait[id]
if ok {
- s.wait[id] = nil, false
+ delete(s.wait, id)
}
s.mu.Unlock()
if ok {
// delClient forgets the client existed
func (exp *Exporter) delClient(client *expClient) {
exp.mu.Lock()
- exp.clients[client] = false, false
+ delete(exp.clients, client)
exp.mu.Unlock()
}
exp.mu.Lock()
chDir, ok := exp.names[name]
if ok {
- exp.names[name] = nil, false
+ delete(exp.names, name)
}
// TODO drop all instances of channel from client sets
exp.mu.Unlock()
if nc == nil {
return os.NewError("netchan import: hangup: no such channel: " + name)
}
- imp.names[name] = nil, false
- imp.chans[nc.id] = nil, false
+ delete(imp.names, name)
+ delete(imp.chans, nc.id)
nc.close()
return nil
}
if success == -1 {
return os.NewSyscallError("inotify_rm_watch", errno)
}
- w.watches[path] = nil, false
+ delete(w.watches, path)
return nil
}
fd = inf
}
- mark[t] = false, false
+ delete(mark, t)
return
}
seq := response.Seq
client.mutex.Lock()
c := client.pending[seq]
- client.pending[seq] = c, false
+ delete(client.pending, seq)
client.mutex.Unlock()
if response.Error == "" {
c.mutex.Lock()
r.ServiceMethod = c.pending[c.resp.Id]
- c.pending[c.resp.Id] = "", false
+ delete(c.pending, c.resp.Id)
c.mutex.Unlock()
r.Error = ""
c.mutex.Unlock()
return os.NewError("invalid sequence number in response")
}
- c.pending[r.Seq] = nil, false
+ delete(c.pending, r.Seq)
c.mutex.Unlock()
if b == nil {
if errno := m.munmap(uintptr(unsafe.Pointer(&b[0])), uintptr(len(b))); errno != 0 {
return errno
}
- m.active[p] = nil, false
+ delete(m.active, p)
return 0
}
// Remove class itself.
for _, r := range class {
- m[r] = false, false
+ delete(m, r)
}
// What's left is the exceptions.
if !Is(Scripts[test.script], test.rune) {
t.Errorf("IsScript(%U, %s) = false, want true", test.rune, test.script)
}
- notTested[test.script] = false, false
+ delete(notTested, test.script)
}
for _, test := range outTest {
if Is(Scripts[test.script], test.rune) {
if !Is(Categories[test.script], test.rune) {
t.Errorf("IsCategory(%U, %s) = false, want true", test.rune, test.script)
}
- notTested[test.script] = false, false
+ delete(notTested, test.script)
}
for k := range notTested {
t.Error("category not tested:", k)
if !Is(Properties[test.script], test.rune) {
t.Errorf("IsCategory(%U, %s) = false, want true", test.rune, test.script)
}
- notTested[test.script] = false, false
+ delete(notTested, test.script)
}
for k := range notTested {
t.Error("property not tested:", k)
// Del deletes the values associated with key.
func (v Values) Del(key string) {
- v[key] = nil, false
+ delete(v, key)
}
// ParseQuery parses the URL-encoded query string and returns
// translations that were associated with the element we just closed.
for p.stk != nil && p.stk.kind != stkStart {
s := p.pop()
- p.ns[s.name.Local] = s.name.Space, s.ok
+ if s.ok {
+ p.ns[s.name.Local] = s.name.Space
+ } else {
+ delete(p.ns, s.name.Local)
+ }
}
return true
m[2] = 3
})
shouldPanic(func() {
- m[2] = 0, false
+ delete(m, 2)
})
}