// EndOf returns the end of the passed unit for the given time.
484880
func EndOf(t time.Time, unit UnitOfTime) time.Time {
	// Retrieve the individual parts of the given time.
	year := t.Year()
	month := t.Month()
	day := t.Day()
	hour := t.Hour()
	minute := t.Minute()
	second := t.Second()
	loc := t.Location()
	// Build new time.
	switch unit {
	case Second:
		return time.Date(year, month, day, hour, minute, second, 999999999, loc)
	case Minute:
		return time.Date(year, month, day, hour, minute, 59, 999999999, loc)
	case Hour:
		return time.Date(year, month, day, hour, 59, 59, 999999999, loc)
	case Day:
		return time.Date(year, month, day, 23, 59, 59, 999999999, loc)
	case Month:
		// Catching leap years makes the month a bit more complex.
		_, nextMonth, _ := t.AddDate(0, 1, 0).Date()
		return time.Date(year, nextMonth, 1, 23, 59, 59, 999999999, loc).AddDate(0, 0, -1)
	case Year:
		return time.Date(year, time.December, 31, 23, 59, 59, 999999999, loc)
	default:
		return t
	}
}
1052773
func (s *DescribeReservationOutput) SetEnd(v string) *DescribeReservationOutput {
	s.End = &v
	return s
}
1265215
func (sc *scanner) endToken(val *tokenValue) {
	if val.raw == "" {
		val.raw = string(sc.token[:len(sc.token)-len(sc.rest)])
	}
}
862308
func (v *VerbalExpression) EndOfLine() *VerbalExpression {
	if !strings.HasSuffix(v.suffixes, "$") {
		v.suffixes += "$"
	}
	return v
}
1149257
func (t *tracker) end(ctx context.Context, err error) {
	status := getResponseStatus(err)

	ctx, _ = tag.New(ctx, tag.Upsert(StatusCode, strconv.Itoa(int(status.Code))))
	stats.Record(ctx, t.profile.LatencyMeasure.M(float64(time.Since(t.startedAt))/float64(time.Millisecond)))

	if t.span != nil {
		t.span.SetStatus(status)
		t.span.End()
	}
}
303995
func (s *Selection) End() *Selection {
	if s.prevSel != nil {
		return s.prevSel
	}
	return newEmptySelection(s.document)
}
384378
func (dec *Decoder) end() error {
	switch dec.curr.Kind() {
	case reflect.Struct:
		if err := dec.findStructField(); err != nil {
			return err
		}
	case reflect.Map:
		// leave backward compatibility for access to maps by .
		dec.walkInMap(dec.field)
	}
	if dec.value == "" {
		return nil
	}
	return dec.decode()
}
1063176
func (s *FilterLogEventsInput) SetEndTime(v int64) *FilterLogEventsInput {
	s.EndTime = &v
	return s
}
381459
func (s *StartExportTaskInput) SetEndTime(v time.Time) *StartExportTaskInput {
	s.EndTime = &v
	return s
}
742375
func (s *TimeWindow) SetEndTime(v time.Time) *TimeWindow {
	s.EndTime = &v
	return s
}
538393
func (ex *ExitStatus) IsTimedOut() bool {
	return ex.typ == exitTypeTimedOut || ex.typ == exitTypeKilled
}
64297
func (t *Tx) End() Chunk {
	c := Chunk{Begin: t.begin, End: t.r.lastChunk.End}
	t.r = nil
	return c
}
1367277
func (ctx *Context) End(code int, buf ...[]byte) (err error) {
	if ctx.Res.ended.swapTrue() {
		var body []byte
		if len(buf) > 0 {
			body = buf[0]
		}
		err = ctx.Res.respond(code, body)
	} else {
		err = ErrInternalServerError.WithMsg("request ended before ctx.End")
	}
	return
}
1245420
func (l *LineStroker) End() {
	if len(l.vertices) > 1 {
		l.Flattener.MoveTo(l.vertices[0], l.vertices[1])
		for i, j := 2, 3; j < len(l.vertices); i, j = i+2, j+2 {
			l.Flattener.LineTo(l.vertices[i], l.vertices[j])
		}
	}
	for i, j := len(l.rewind)-2, len(l.rewind)-1; j > 0; i, j = i-2, j-2 {
		l.Flattener.LineTo(l.rewind[i], l.rewind[j])
	}
	if len(l.vertices) > 1 {
		l.Flattener.LineTo(l.vertices[0], l.vertices[1])
	}
	l.Flattener.End()
	// reinit vertices
	l.vertices = l.vertices[0:0]
	l.rewind = l.rewind[0:0]
	l.x, l.y, l.nx, l.ny = 0, 0, 0, 0

}
353962
func (b *buffer) eof() error {
	b.Cond.L.Lock()
	b.closed = true
	b.Cond.Signal()
	b.Cond.L.Unlock()
	return nil
}
1018964
func (s *SpanStat) End(success bool) *SpanStat {
	if !s.spanStart.IsZero() {
		d, _ := safetime.TimeSinceSafe(s.spanStart, log)
		if success {
			s.successDuration += d
		} else {
			s.failureDuration += d
		}
	}
	s.spanStart = time.Time{}
	return s
}
486941
func (s *Scanner) EOF() int {
	if s.Err != nil {
		return ScanError
	}
	if s.endTop {
		return ScanEnd
	}
	s.Step(s, ' ')
	if s.endTop {
		return ScanEnd
	}
	if s.Err == nil {
		s.Err = &SyntaxError{"unexpected end of JSON input", s.bytes}
	}
	return ScanError
}