mirror of
https://github.com/burrowers/garble.git
synced 2026-04-22 23:57:14 +08:00
e08dd99c1e
The problem with the "grep" built-in command is that it prints the entire data if there is an error. We don't want megabytes of binary output for a test.
29 lines
460 B
Plaintext
29 lines
460 B
Plaintext
garble build main.go
|
|
exec ./main
|
|
cmp stdout main.stdout
|
|
|
|
! bingrep main$exe 'unexportedMethod'
|
|
|
|
-- main.go --
|
|
package main
|
|
|
|
import "fmt"
|
|
|
|
type T string
|
|
|
|
func (t T) String() string {
|
|
return "String method for " + string(t)
|
|
}
|
|
|
|
func (t T) unexportedMethod() string {
|
|
return "unexported method for " + string(t)
|
|
}
|
|
|
|
func main() {
|
|
fmt.Println(T("foo"))
|
|
fmt.Println(T("foo").unexportedMethod())
|
|
}
|
|
-- main.stdout --
|
|
String method for foo
|
|
unexported method for foo
|