cmd/gomobile: fix header padding computation in apk generation
fix file data align to 4
Change-Id: Ie88c46521e216b3f83a8dc3495591cd19bce83c6
GitHub-Last-Rev: aebf3cd7ff0d77050659e9269f7eddaeff364eff
GitHub-Pull-Request: golang/mobile#73
Reviewed-on: https://go-review.googlesource.com/c/mobile/+/351789
Reviewed-by: Hyang-Ah Hana Kim <hyangah@gmail.com>
Reviewed-by: Hajime Hoshi <hajimehoshi@gmail.com>
Trust: Hyang-Ah Hana Kim <hyangah@gmail.com>
Run-TryBot: Hyang-Ah Hana Kim <hyangah@gmail.com>
TryBot-Result: Go Bot <gobot@golang.org>
diff --git a/cmd/gomobile/writer.go b/cmd/gomobile/writer.go
index 0f3c29b..8801041 100644
--- a/cmd/gomobile/writer.go
+++ b/cmd/gomobile/writer.go
@@ -115,7 +115,7 @@
}
const fileHeaderLen = 30 // + filename + extra
start := w.offset + fileHeaderLen + len(name)
- extra := start % 4
+ extra := (-start) & 3
zipfw, err := w.w.CreateHeader(&zip.FileHeader{
Name: name,