You cannot select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
garble/testdata/scripts/strings.txt

99 lines
1.6 KiB
Plaintext

garble -literals build main.go
exec ./main
cmp stdout main.stdout
! binsubstr main$exe 'Lorem' 'ipsum' 'dolor' 'first assign' 'second assign' 'First Line' 'Second Line' 'map value' 'to obfuscate' 'also obfuscate'
binsubstr main$exe 'Skip this block,' 'also skip this'
[short] stop # checking that the build is reproducible is slow
# Also check that the binary is reproducible.
cp main$exe main_old$exe
rm main$exe
garble -literals build main.go
bincmp main$exe main_old$exe
-- main.go --
package main
import "fmt"
type strucTest struct {
field string
anotherfield string
}
const (
cnst = "Lorem"
multiline = `First Line
Second Line`
)
const (
skip1 = "Skip this block,"
i = 1
)
const (
foo = iota
bar
skip2 = "also skip this"
)
const arrayLen = 4
var array [arrayLen]byte
type typeAlias [arrayLen]byte
var variable = "ipsum"
func main() {
empty := ""
localVar := "dolor"
reassign := "first assign"
reassign = "second assign"
fmt.Println(cnst)
fmt.Println(multiline)
fmt.Println(variable)
fmt.Println(localVar)
fmt.Println(reassign)
fmt.Println(empty)
x := strucTest{
field: "to obfuscate",
anotherfield: "also obfuscate",
}
fmt.Println(x.field)
fmt.Println(x.anotherfield)
testMap := map[string]string{"map key": "map value"}
fmt.Println(testMap["map key"])
fmt.Println("another literal")
fmt.Println(skip1, skip2)
fmt.Println(i, foo, bar)
}
-- main.stdout --
Lorem
First Line
Second Line
ipsum
dolor
second assign
to obfuscate
also obfuscate
map value
another literal
Skip this block, also skip this
1 0 1