format code

This commit is contained in:
2023-05-31 16:31:52 +07:00
parent e3453ae127
commit 841a50f8e1
12 changed files with 201 additions and 196 deletions

View File

@ -1,12 +1,12 @@
package main
import (
"ios-wrapper/pkg/ios/macho"
"github.com/alecthomas/kong"
"ios-wrapper/pkg/ios/macho"
"os"
"fmt"
"bytes"
"bytes"
"fmt"
"os"
)
type Argument struct {
@ -18,30 +18,30 @@ func main() {
var cli Argument
kong.Parse(&cli)
compare(cli.One, cli.Two)
compare(cli.One, cli.Two)
}
func compare(one string, two string) {
f1, _ := os.OpenFile(one, os.O_RDONLY, 0644)
f2, _ := os.OpenFile(two, os.O_RDONLY, 0644)
var mc1 macho.MachoContext
var mc2 macho.MachoContext
var mc1 macho.MachoContext
var mc2 macho.MachoContext
mc1.ParseFile(f1, 0)
mc2.ParseFile(f2, 0)
s1 := mc1.FindSection("__text")
s2 := mc2.FindSection("__text")
s1 := mc1.FindSection("__text")
s2 := mc2.FindSection("__text")
if (s1.Size() == s2.Size()) {
fmt.Println("Size is equal")
} else {
fmt.Printf("%x <> %x\n", s1.Size(), s2.Size())
}
if s1.Size() == s2.Size() {
fmt.Println("Size is equal")
} else {
fmt.Printf("%x <> %x\n", s1.Size(), s2.Size())
}
data1 := mc1.Cut(uint64(s1.Offset()), s1.Size())
data2 := mc1.Cut(uint64(s2.Offset()), s2.Size())
if (bytes.Compare(data1, data2) == 0) {
fmt.Println("Data is equal")
}
data1 := mc1.Cut(uint64(s1.Offset()), s1.Size())
data2 := mc1.Cut(uint64(s2.Offset()), s2.Size())
if bytes.Compare(data1, data2) == 0 {
fmt.Println("Data is equal")
}
}