got.Write(b)
}
if !Equal(got.Bytes(), want) {
- t.Fatalf("Bytes() = %q, want %q", got, want)
+ t.Fatalf("Bytes() = %q, want %q", &got, want)
}
// With a sufficiently sized buffer, there should be no allocations.
// if we do external relocations.
w := l.pw.NewEncoderRaw(k)
- l.relocCommon(pr, &w, k, idx)
+ l.relocCommon(pr, w, k, idx)
newidx = w.Idx
}
assert(wname.Idx == w.Idx)
assert(wdict.Idx == w.Idx)
- l.relocCommon(pr, &w, pkgbits.SectionObj, idx)
- l.relocCommon(pr, &wname, pkgbits.SectionName, idx)
- l.relocCommon(pr, &wdict, pkgbits.SectionObjDict, idx)
+ l.relocCommon(pr, w, pkgbits.SectionObj, idx)
+ l.relocCommon(pr, wname, pkgbits.SectionName, idx)
+ l.relocCommon(pr, wdict, pkgbits.SectionObjDict, idx)
// Generic types and functions won't have definitions, and imported
// objects may not either.
wext.Sync(pkgbits.SyncObject1)
switch tag {
case pkgbits.ObjFunc:
- l.relocFuncExt(&wext, obj)
+ l.relocFuncExt(wext, obj)
case pkgbits.ObjType:
- l.relocTypeExt(&wext, obj)
+ l.relocTypeExt(wext, obj)
case pkgbits.ObjVar:
- l.relocVarExt(&wext, obj)
+ l.relocVarExt(wext, obj)
}
wext.Flush()
} else {
- l.relocCommon(pr, &wext, pkgbits.SectionObjExt, idx)
+ l.relocCommon(pr, wext, pkgbits.SectionObjExt, idx)
}
// Check if we need to export the inline bodies for functions and
type writer struct {
p *pkgWriter
- pkgbits.Encoder
+ *pkgbits.Encoder
// sig holds the signature for the current function body, if any.
sig *types2.Signature
for i, s := range ss {
if s != inflated[i].String() {
- t.Errorf("inflated[%d]:\ngot %q\nwant %q", i, inflated[i], s)
+ t.Errorf("inflated[%d]:\ngot %q\nwant %q", i, &inflated[i], s)
}
}
}
for i, s := range ss {
if s != inflated[i].String() {
- t.Errorf("inflated[%d]:\ngot %q\nwant %q", i, inflated[i], s)
+ t.Errorf("inflated[%d]:\ngot %q\nwant %q", i, &inflated[i], s)
}
}
}
// NewEncoder returns an Encoder for a new element within the given
// section, and encodes the given SyncMarker as the start of the
// element bitstream.
-func (pw *PkgEncoder) NewEncoder(k SectionKind, marker SyncMarker) Encoder {
+func (pw *PkgEncoder) NewEncoder(k SectionKind, marker SyncMarker) *Encoder {
e := pw.NewEncoderRaw(k)
e.Sync(marker)
return e
// section.
//
// Most callers should use NewEncoder instead.
-func (pw *PkgEncoder) NewEncoderRaw(k SectionKind) Encoder {
+func (pw *PkgEncoder) NewEncoderRaw(k SectionKind) *Encoder {
idx := RelIndex(len(pw.elems[k]))
pw.elems[k] = append(pw.elems[k], "") // placeholder
- return Encoder{
+ return &Encoder{
p: pw,
k: k,
Idx: idx,
f(duration)
StopCPUProfile()
- if p, ok := profileOk(t, matches, prof, duration); ok {
+ if p, ok := profileOk(t, matches, &prof, duration); ok {
return p
}
type sampleMatchFunc func(spec string, count uintptr, stk []*profile.Location, labels map[string][]string) bool
-func profileOk(t *testing.T, matches profileMatchFunc, prof bytes.Buffer, duration time.Duration) (_ *profile.Profile, ok bool) {
+func profileOk(t *testing.T, matches profileMatchFunc, prof *bytes.Buffer, duration time.Duration) (_ *profile.Profile, ok bool) {
ok = true
var samples uintptr