mirror of
https://github.com/burrowers/garble.git
synced 2025-12-24 12:58:05 +08:00
This mainly cleans up the few bits of code where we explicitly kept support for Go 1.15.x. With v0.1.0 released, we can drop support now, since the next v0.2.0 release will only support Go 1.16.x. Also updates all modules, including test ones, to 'go 1.16'. Note that the TOOLEXEC_IMPORTPATH refactor is not done here, despite all the TODOs about doing so when we drop 1.15 support. This is because that refactor needs to be done carefully and might have side effects, so it's best to keep it to a separate commit. Finally, update the deps.
52 lines
1.2 KiB
Plaintext
52 lines
1.2 KiB
Plaintext
env GOPRIVATE=test/main
|
|
|
|
# Tiny mode
|
|
garble -tiny build
|
|
! binsubstr main$exe 'main.go' 'fmt/print.go'
|
|
env GODEBUG='allocfreetrace=1,gcpacertrace=1,gctrace=1,inittrace=1,scavenge=1,scavtrace=1,scheddetail=1,schedtrace=10'
|
|
! exec ./main$exe
|
|
stderr '^\(0x[\d\w]{4,8},0x[\d\w]{4,8}\)' # interfaces/pointers print correctly
|
|
# TODO: Make -tiny remove all line information again.
|
|
# Right now, we reset each declaration's start line to 1.
|
|
# Better than nothing, but we could still make *all* line numbers 1.
|
|
# stderr '^caller: \? 0$' # position info is removed
|
|
stderr '^caller: \?\? ' # position info is removed
|
|
stderr '^recovered: ya like jazz?'
|
|
! stderr 'panic: oh noes' # panics are hidden
|
|
|
|
[short] stop # no need to verify this with -short
|
|
|
|
# Default mode
|
|
env GODEBUG=
|
|
garble build
|
|
! exec ./main$exe
|
|
stderr '^caller: \w\.go [1-9]'
|
|
stderr '^recovered: ya like jazz?'
|
|
stderr 'panic: oh noes'
|
|
|
|
-- go.mod --
|
|
module test/main
|
|
|
|
go 1.16
|
|
-- main.go --
|
|
package main
|
|
|
|
import "runtime"
|
|
|
|
func main() {
|
|
var v interface{} = "tada"
|
|
println(v)
|
|
|
|
defer func() {
|
|
if r := recover(); r != nil {
|
|
println("recovered:", r.(string))
|
|
panic("oh noes")
|
|
}
|
|
}()
|
|
|
|
_, file, line, _ := runtime.Caller(0)
|
|
println("caller:", file, line)
|
|
|
|
panic("ya like jazz?")
|
|
}
|