// Remove any Here, Cause, Trace, Context or Subject wrappers from err
494166
func Unwrap(err error) error {
	for {
		switch specific := err.(type) {
		case *HereError:
			err = specific.error
		case *CauseError:
			err = specific.error
		case *TraceError:
			err = specific.error
		case *ContextError:
			err = specific.error
		case *SubjectError:
			err = specific.error
		default:
			return err
		}
	}
}
207386
func (c *Client) Cleanup(removeall bool) (Task, error) {
	task := Task{}
	r := c.NewRequest("POST", "/cleanup")
	var requestBody struct {
		Config struct {
			RemoveAll bool `json:"remove_all"`
		} `json:"config"`
	}
	requestBody.Config.RemoveAll = removeall
	b, err := json.Marshal(&requestBody)
	if err != nil {
		return task, err
	}
	r.body = bytes.NewBuffer(b)
	r.header["Content-Type"] = "application/json"
	resp, err := c.DoRequest(r)
	if err != nil {
		return task, err
	}

	defer resp.Body.Close()

	resBody, err := ioutil.ReadAll(resp.Body)
	if err != nil {
		log.Printf("Error reading task request %v", resBody)
		return task, err
	}
	err = json.Unmarshal(resBody, &task)
	if err != nil {
		log.Printf("Error unmarshaling task %v", err)
	}
	return task, err
}
244201
func (e Error) Ignore(err error) error {
	if err == nil {
		return e
	}
	if e.Error() == err.Error() {
		return nil
	}
	return e
}
393053
func (c *SolverManager) Remove(chlgType challenge.Type) {
	delete(c.solvers, chlgType)
}
1232720
func remove(this []dns.RR, that []dns.RR) []dns.RR {
	var result []dns.RR
	for _, thatRr := range that {
		isUnknown := true
		for _, thisRr := range this {
			switch a := thisRr.(type) {
			case *dns.PTR:
				if ptr, ok := thatRr.(*dns.PTR); ok {
					if a.Ptr == ptr.Ptr && a.Hdr.Name == ptr.Hdr.Name && a.Hdr.Ttl > ptr.Hdr.Ttl/2 {
						isUnknown = false
					}
				}
			case *dns.SRV:
				if srv, ok := thatRr.(*dns.SRV); ok {
					if a.Target == srv.Target && a.Port == srv.Port && a.Hdr.Name == srv.Hdr.Name && a.Hdr.Ttl > srv.Hdr.Ttl/2 {
						isUnknown = false
					}
				}
			case *dns.TXT:
				if txt, ok := thatRr.(*dns.TXT); ok {
					if reflect.DeepEqual(a.Txt, txt.Txt) && a.Hdr.Ttl > txt.Hdr.Ttl/2 {
						isUnknown = false
					}
				}
			}
		}

		if isUnknown {
			result = append(result, thatRr)
		}
	}

	return result
}
1114333
func (client *Client) RemoveInstances(args *RemoveInstancesArgs) (resp *RemoveInstancesResponse, err error) {
	response := RemoveInstancesResponse{}
	err = client.InvokeByFlattenMethod("RemoveInstances", args, &response)

	if err != nil {
		return nil, err
	}
	return &response, nil
}
848205
func (g *graph) Remove(ctx context.Context) error {
	req, err := g.conn.NewRequest("DELETE", g.relPath())
	if err != nil {
		return WithStack(err)
	}
	resp, err := g.conn.Do(ctx, req)
	if err != nil {
		return WithStack(err)
	}
	if err := resp.CheckStatus(201, 202); err != nil {
		return WithStack(err)
	}
	return nil
}
435632
func (e *Errors) Err(format string, a ...interface{}) error {
	return e.add(Error, format, a...)
}
847135
func (c *Client) cleanup(err error, doClose bool, possiblyClosed bool) error {
	// cancel connect future if appropriate
	if atomic.LoadUint32(&c.state) < clientConnacked && c.connectFuture != nil {
		c.connectFuture.Cancel()
	}

	// set state
	atomic.StoreUint32(&c.state, clientDisconnected)

	// ensure that the connection gets closed
	if doClose {
		connErr := c.conn.Close()
		if connErr != nil && err == nil && !possiblyClosed {
			err = connErr
		}
	}

	// reset store
	if c.clean {
		sessErr := c.Session.Reset()
		if sessErr != nil && err == nil {
			err = sessErr
		}
	}

	// cancel all futures
	c.futureStore.Clear()

	return err
}
1060419
func Remove(obj interface{}, pointer string) (rv interface{}, err error) {
	defer func() {
		if e := recover(); e != nil {
			err = fmt.Errorf("invalid JSON pointer: %q: %v", pointer, e)
		}
	}()
	tokens, err := parse(pointer)
	if err != nil {
		return nil, err
	}

	i := 0
	v := reflect.ValueOf(obj)
	var p, pp reflect.Value
	var token, ptoken string
	if len(tokens) > 0 && tokens[0] != "" {
		for i < len(tokens) {
			for v.Kind() == reflect.Interface {
				v = v.Elem()
			}
			pp = p
			p = v
			ptoken = token
			token = tokens[i]
			if n, err := strconv.Atoi(token); err == nil && isIndexed(v) {
				v = v.Index(n)
			} else {
				v = v.MapIndex(reflect.ValueOf(token))
			}
			i++
		}
	} else {
		return nil, fmt.Errorf("pointer should have element")
	}

	var nv reflect.Value
	if p.Kind() == reflect.Map {
		nv = reflect.MakeMap(p.Type())
		for _, mk := range p.MapKeys() {
			if mk.String() != token {
				nv.SetMapIndex(mk, p.MapIndex(mk))
			}
		}
	} else {
		nv = reflect.Zero(p.Type())
		n, _ := strconv.Atoi(token)
		for m := 0; m < p.Len(); m++ {
			if n != m {
				nv = reflect.Append(nv, p.Index(m))
			}
		}
	}

	if !pp.IsValid() {
		obj = nv.Interface()
	} else if pp.Kind() == reflect.Map {
		pp.SetMapIndex(reflect.ValueOf(ptoken), nv)
	} else {
		p.Set(reflect.ValueOf(nv))
	}
	return obj, nil
}
879677
func (m *RegexpMap) Remove(reStr, lookupValue string) (deleted bool) {
	lookupRelation, exists := m.rulesRelation[reStr]
	if !exists {
		return false
	}

	if lookupRelation.Decrement(lookupValue) > 0 {
		return false
	}

	// Making sure that no other rules for the same reStr are in place.
	if len(lookupRelation) > 0 {
		return false
	}

	val, exists := m.lookupValues[lookupValue]
	if exists {
		val.Remove(reStr)
	}

	delete(m.rules, reStr)
	delete(m.rulesRelation, reStr)
	return true
}
856623
func (r *RegexpList) Remove(val string) {
	tmpData := []string{}
	for _, item := range *r {
		if item == val {
			continue
		}
		tmpData = append(tmpData, item)
	}
	*r = tmpData
	return
}
1284324
func (d *DNSProvider) CleanUp(domain, token, keyAuth string) error {
	fqdn, _ := dns01.GetRecord(domain, keyAuth)

	zoneDomain, records, err := d.findTxtRecords(domain, fqdn)
	if err != nil {
		return fmt.Errorf("vultr: %v", err)
	}

	var allErr []string
	for _, rec := range records {
		err := d.client.DeleteDNSRecord(zoneDomain, rec.RecordID)
		if err != nil {
			allErr = append(allErr, err.Error())
		}
	}

	if len(allErr) > 0 {
		return errors.New(strings.Join(allErr, ": "))
	}

	return nil
}
619564
func (s HTTPStore) RemoveAll() error {
	url, err := s.buildMetaURL("")
	if err != nil {
		return err
	}
	req, err := http.NewRequest("DELETE", url.String(), nil)
	if err != nil {
		return err
	}
	resp, err := s.roundTrip.RoundTrip(req)
	if err != nil {
		return NetworkError{Wrapped: err}
	}
	defer resp.Body.Close()
	return translateStatusToError(resp, "DELETE metadata for GUN endpoint")
}
953533
func (_m *FacadeInterface) RemoveServiceTemplate(ctx datastore.Context, templateID string) error {
	ret := _m.Called(ctx, templateID)

	var r0 error
	if rf, ok := ret.Get(0).(func(datastore.Context, string) error); ok {
		r0 = rf(ctx, templateID)
	} else {
		r0 = ret.Error(0)
	}

	return r0
}
254263
func (c *Client) RemoveAll(path string) error {
	rs, err := c.req("DELETE", path, nil, nil)
	if err != nil {
		return newPathError("Remove", path, 400)
	}
	err = rs.Body.Close()
	if err != nil {
		return err
	}

	if rs.StatusCode == 200 || rs.StatusCode == 204 || rs.StatusCode == 404 {
		return nil
	}

	return newPathError("Remove", path, rs.StatusCode)
}
1305571
func (cfgSrcHandler *Handler) Cleanup() error {
	cfgSrcHandler.connsLock.Lock()
	defer cfgSrcHandler.connsLock.Unlock()

	if cfgSrcHandler.dynamicConfigHandler != nil {
		cfgSrcHandler.dynamicConfigHandler.Cleanup()
	}

	cfgSrcHandler.dynamicConfigHandler = nil
	cfgSrcHandler.Configurations = nil

	return nil
}