Skip to content

Commit

Permalink
cmd/compile: rename init function from init.ializers back to init
Browse files Browse the repository at this point in the history
The name change init -> init.ializers was initially required for
initialization code.

With CL 161337 there's no wrapper code any more, there's a data
structure instead (named .inittask). So we can go back to just
plain init appearing in tracebacks.

RELNOTE=yes

Update #29919. Followon to CL 161337.

Change-Id: I5a4a49d286df24b53b2baa193dfda482f3ea82a5
Reviewed-on: https://go-review.googlesource.com/c/go/+/167780
Run-TryBot: Keith Randall <[email protected]>
Reviewed-by: Josh Bleecher Snyder <[email protected]>
TryBot-Result: Gobot Gobot <[email protected]>
  • Loading branch information
randall77 committed Mar 18, 2019
1 parent 27e444d commit 7b91624
Show file tree
Hide file tree
Showing 3 changed files with 7 additions and 7 deletions.
2 changes: 1 addition & 1 deletion src/cmd/compile/internal/gc/init.go
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,7 @@ func fninit(n []*Node) {
// Make a function that contains all the initialization statements.
if len(nf) > 0 {
lineno = nf[0].Pos // prolog/epilog gets line number of first init stmt
initializers := lookup("init.ializers")
initializers := lookup("init")
disableExport(initializers)
fn := dclfunc(initializers, nod(OTFUNC, nil, nil))
for _, dcl := range dummyInitFn.Func.Dcl {
Expand Down
2 changes: 1 addition & 1 deletion src/fmt/errors_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -157,7 +157,7 @@ func TestErrorFormatter(t *testing.T) {
want: "fallback:" +
"\n somefile.go:123" +
"\n - file does not exist:" +
"\n os.init.ializers" +
"\n os.init" +
"\n .+/os/error.go:\\d\\d",
regexp: true,
}, {
Expand Down
10 changes: 5 additions & 5 deletions test/fixedbugs/issue29919.dir/a.go
Original file line number Diff line number Diff line change
Expand Up @@ -34,8 +34,8 @@ func f() int {
if !strings.Contains(s, "a.go:19") {
panic("missing a.go:19")
}
if !strings.Contains(s, "a.init.ializers") {
panic("missing a.init.ializers")
if !strings.Contains(s, "a.init") {
panic("missing a.init")
}

// Check the CallersFrames results.
Expand All @@ -58,11 +58,11 @@ func f() int {
panic("traceback truncated after f")
}
f, more = iter.Next()
if f.Function != "a.init.ializers" || !strings.HasSuffix(f.File, "a.go") || f.Line != 15 {
panic(fmt.Sprintf("bad init.ializers %v\n", f))
if f.Function != "a.init" || !strings.HasSuffix(f.File, "a.go") || f.Line != 15 {
panic(fmt.Sprintf("bad init %v\n", f))
}
if !more {
panic("traceback truncated after init.ializers")
panic("traceback truncated after init")
}
f, _ = iter.Next()
if !strings.HasPrefix(f.Function, "runtime.") {
Expand Down

0 comments on commit 7b91624

Please sign in to comment.