0x00, 0x50, 0x00, 0x00, 0x00, 0x00, 0x00,
}
// Read in the archive.
- _, err := NewReader(bytes.NewReader([]byte(data)), int64(len(data)))
+ _, err := NewReader(bytes.NewReader(data), int64(len(data)))
if err != nil {
t.Errorf("Error reading the archive: %v", err)
}
0x00, 0x00, 0x01, 0x00, 0x01, 0x00, 0x39, 0x00,
0x00, 0x00, 0x59, 0x00, 0x00, 0x00, 0x00, 0x00,
}
- r, err := NewReader(bytes.NewReader([]byte(data)), int64(len(data)))
+ r, err := NewReader(bytes.NewReader(data), int64(len(data)))
if err != ErrInsecurePath {
t.Fatalf("Error reading the archive: %v", err)
}
0x00, 0x04, 0x00, 0x04, 0x00, 0x31, 0x01, 0x00,
0x00, 0x90, 0x00, 0x00, 0x00, 0x00, 0x00,
}
- r, err := NewReader(bytes.NewReader([]byte(data)), int64(len(data)))
+ r, err := NewReader(bytes.NewReader(data), int64(len(data)))
if err != ErrInsecurePath {
t.Fatalf("Error reading the archive: %v", err)
}
}
func LFStackPop(head *uint64) *LFNode {
- return (*LFNode)(unsafe.Pointer((*lfstack)(head).pop()))
+ return (*LFNode)((*lfstack)(head).pop())
}
func LFNodeValidate(node *LFNode) {
lfnodeValidate((*lfnode)(unsafe.Pointer(node)))
func CountPagesInUse() (pagesInUse, counted uintptr) {
stopTheWorld(stwForTestCountPagesInUse)
- pagesInUse = uintptr(mheap_.pagesInUse.Load())
+ pagesInUse = mheap_.pagesInUse.Load()
for _, s := range mheap_.allspans {
if s.state.get() == mSpanInUse {
)
func (p *ProfBuf) Read(mode profBufReadMode) ([]uint64, []unsafe.Pointer, bool) {
- return (*profBuf)(p).read(profBufReadMode(mode))
+ return (*profBuf)(p).read(mode)
}
func (p *ProfBuf) Close() {
// Collect per-sizeclass free stats.
var smallFree uint64
for i := 0; i < _NumSizeClasses; i++ {
- slow.Frees += uint64(m.smallFreeCount[i])
- bySize[i].Frees += uint64(m.smallFreeCount[i])
- bySize[i].Mallocs += uint64(m.smallFreeCount[i])
- smallFree += uint64(m.smallFreeCount[i]) * uint64(class_to_size[i])
+ slow.Frees += m.smallFreeCount[i]
+ bySize[i].Frees += m.smallFreeCount[i]
+ bySize[i].Mallocs += m.smallFreeCount[i]
+ smallFree += m.smallFreeCount[i] * uint64(class_to_size[i])
}
- slow.Frees += uint64(m.tinyAllocCount) + uint64(m.largeFreeCount)
+ slow.Frees += m.tinyAllocCount + m.largeFreeCount
slow.Mallocs += slow.Frees
- slow.TotalAlloc = slow.Alloc + uint64(m.largeFree) + smallFree
+ slow.TotalAlloc = slow.Alloc + m.largeFree + smallFree
for i := range slow.BySize {
slow.BySize[i].Mallocs = bySize[i].Mallocs
testOne := func(ti, tns, di int64) bool {
t.Helper()
- t0 := Unix(ti, int64(tns)).UTC()
+ t0 := Unix(ti, tns).UTC()
d := Duration(di)
if d < 0 {
d = -d
// The commented out code would round half to even instead of up,
// but that makes it time-zone dependent, which is a bit strange.
if r > int64(d)/2 || r+r == int64(d) /*&& bq.Bit(0) == 1*/ {
- t1 = t1.Add(Duration(d))
+ t1 = t1.Add(d)
}
// Check that time.Round works.
{Date(2009, 11, 23, 0, 0, 0, 0, UTC), Date(2009, 11, 24, 0, 0, 0, 0, UTC), -24 * Hour},
{Date(2009, 11, 24, 0, 0, 0, 0, UTC), Date(2009, 11, 23, 0, 0, 0, 0, UTC), 24 * Hour},
{Date(-2009, 11, 24, 0, 0, 0, 0, UTC), Date(-2009, 11, 23, 0, 0, 0, 0, UTC), 24 * Hour},
- {Time{}, Date(2109, 11, 23, 0, 0, 0, 0, UTC), Duration(minDuration)},
- {Date(2109, 11, 23, 0, 0, 0, 0, UTC), Time{}, Duration(maxDuration)},
- {Time{}, Date(-2109, 11, 23, 0, 0, 0, 0, UTC), Duration(maxDuration)},
- {Date(-2109, 11, 23, 0, 0, 0, 0, UTC), Time{}, Duration(minDuration)},
+ {Time{}, Date(2109, 11, 23, 0, 0, 0, 0, UTC), minDuration},
+ {Date(2109, 11, 23, 0, 0, 0, 0, UTC), Time{}, maxDuration},
+ {Time{}, Date(-2109, 11, 23, 0, 0, 0, 0, UTC), maxDuration},
+ {Date(-2109, 11, 23, 0, 0, 0, 0, UTC), Time{}, minDuration},
{Date(2290, 1, 1, 0, 0, 0, 0, UTC), Date(2000, 1, 1, 0, 0, 0, 0, UTC), 290*365*24*Hour + 71*24*Hour},
- {Date(2300, 1, 1, 0, 0, 0, 0, UTC), Date(2000, 1, 1, 0, 0, 0, 0, UTC), Duration(maxDuration)},
+ {Date(2300, 1, 1, 0, 0, 0, 0, UTC), Date(2000, 1, 1, 0, 0, 0, 0, UTC), maxDuration},
{Date(2000, 1, 1, 0, 0, 0, 0, UTC), Date(2290, 1, 1, 0, 0, 0, 0, UTC), -290*365*24*Hour - 71*24*Hour},
- {Date(2000, 1, 1, 0, 0, 0, 0, UTC), Date(2300, 1, 1, 0, 0, 0, 0, UTC), Duration(minDuration)},
+ {Date(2000, 1, 1, 0, 0, 0, 0, UTC), Date(2300, 1, 1, 0, 0, 0, 0, UTC), minDuration},
{Date(2311, 11, 26, 02, 16, 47, 63535996, UTC), Date(2019, 8, 16, 2, 29, 30, 268436582, UTC), 9223372036795099414},
{MinMonoTime, MaxMonoTime, minDuration},
{MaxMonoTime, MinMonoTime, maxDuration},
// Issue 24692: Out of range weekday panics
func TestWeekdayString(t *testing.T) {
- if got, want := Weekday(Tuesday).String(), "Tuesday"; got != want {
+ if got, want := Tuesday.String(), "Tuesday"; got != want {
t.Errorf("Tuesday weekday = %q; want %q", got, want)
}
if got, want := Weekday(14).String(), "%!Weekday(14)"; got != want {