Skip to content

Instantly share code, notes, and snippets.

@felixge
Last active Nov 2, 2021
Embed
What would you like to do?
{"version":0,"package":"main","goos":"darwin","goarch":"amd64","gc_version":"go1.17.2","file":"/Users/felix.geisendoerfer/go/src/github.com/felixge/dump/inline-test/main.go"}
{"range":{"start":{"line":5,"character":6},"end":{"line":5,"character":6}},"severity":3,"code":"canInlineFunction","source":"go compiler","message":"cost: 59"}
{"range":{"start":{"line":9,"character":6},"end":{"line":9,"character":6}},"severity":3,"code":"cannotInlineFunction","source":"go compiler","message":"function too complex: cost 88 exceeds budget 80"}
{"range":{"start":{"line":11,"character":15},"end":{"line":11,"character":15}},"severity":3,"code":"escape","source":"go compiler","message":"\"Hello World\" escapes to heap","relatedInformation":[{"location":{"uri":"file:///Users/felix.geisendoerfer/go/src/github.com/felixge/dump/inline-test/main.go","range":{"start":{"line":11,"character":15},"end":{"line":11,"character":15}}},"message":"escflow: flow: ~arg0 = \u0026{storage for \"Hello World\"}:"},{"location":{"uri":"file:///Users/felix.geisendoerfer/go/src/github.com/felixge/dump/inline-test/main.go","range":{"start":{"line":11,"character":15},"end":{"line":11,"character":15}}},"message":"escflow: from \"Hello World\" (spill)"},{"location":{"uri":"file:///Users/felix.geisendoerfer/go/src/github.com/felixge/dump/inline-test/main.go","range":{"start":{"line":11,"character":14},"end":{"line":11,"character":14}}},"message":"escflow: from ~arg0 := \"Hello World\" (assign-pair)"},{"location":{"uri":"file:///Users/felix.geisendoerfer/go/src/github.com/felixge/dump/inline-test/main.go","range":{"start":{"line":11,"character":14},"end":{"line":11,"character":14}}},"message":"escflow: flow: {storage for []interface {}{...}} = ~arg0:"},{"location":{"uri":"file:///Users/felix.geisendoerfer/go/src/github.com/felixge/dump/inline-test/main.go","range":{"start":{"line":11,"character":14},"end":{"line":11,"character":14}}},"message":"escflow: from []interface {}{...} (slice-literal-element)"},{"location":{"uri":"file:///Users/felix.geisendoerfer/go/src/github.com/felixge/dump/inline-test/main.go","range":{"start":{"line":11,"character":14},"end":{"line":11,"character":14}}},"message":"escflow: flow: fmt.a = \u0026{storage for []interface {}{...}}:"},{"location":{"uri":"file:///Users/felix.geisendoerfer/go/src/github.com/felixge/dump/inline-test/main.go","range":{"start":{"line":11,"character":14},"end":{"line":11,"character":14}}},"message":"escflow: from []interface {}{...} (spill)"},{"location":{"uri":"file:///Users/felix.geisendoerfer/go/src/github.com/felixge/dump/inline-test/main.go","range":{"start":{"line":11,"character":14},"end":{"line":11,"character":14}}},"message":"escflow: from fmt.a = []interface {}{...} (assign)"},{"location":{"uri":"file:///Users/felix.geisendoerfer/go/src/github.com/felixge/dump/inline-test/main.go","range":{"start":{"line":11,"character":14},"end":{"line":11,"character":14}}},"message":"escflow: flow: {heap} = *fmt.a:"},{"location":{"uri":"file:///usr/local/Cellar/go/1.17.2/libexec/src/fmt/print.go","range":{"start":{"line":274,"character":17},"end":{"line":274,"character":17}}},"message":"inlineLoc"},{"location":{"uri":"file:///Users/felix.geisendoerfer/go/src/github.com/felixge/dump/inline-test/main.go","range":{"start":{"line":11,"character":14},"end":{"line":11,"character":14}}},"message":"escflow: from fmt.Fprintln(io.Writer(os.Stdout), fmt.a...) (call parameter)"},{"location":{"uri":"file:///usr/local/Cellar/go/1.17.2/libexec/src/fmt/print.go","range":{"start":{"line":274,"character":17},"end":{"line":274,"character":17}}},"message":"inlineLoc"}]}
{"range":{"start":{"line":11,"character":15},"end":{"line":11,"character":15}},"severity":3,"code":"escape","source":"go compiler","message":""}
package main
import "fmt"
func main() {
foo()
}
func foo() {
for i := 0; i < 3; i++ {
fmt.Println("Hello World")
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment