title: Apk unzipping. Not a valid zip file, but unzip worked perfect
body: <p>I have problem with golang zip reader. We have apk builder which build apk and then encrypted this apk with dex protector.</p>
  
  <p>When i try to open apk file, go return err "zip: not a valid zip file". But when i try to open with unzip or zipinfo, worked fine.<br>
  (Also I noticed something interesting: in php 5.5 apk file opened with ZipArchive fine, but in 5.6 return error like golang)</p>
  
  <p>I try open to debug golang archive/zip pckage and found that error returned in this line <a href="https://github.com/golang/go/blob/master/src/archive/zip/reader.go#L269" rel="nofollow">https://github.com/golang/go/blob/master/src/archive/zip/reader.go#L269</a>.</p>
  
  <p>Then i try to debug this line like this:</p>
  
  <pre><code>fmt.Printf("%+v", f)
  fmt.Println(
      "len(f.Extra):", len(f.Extra),
      "len(b):", len(b),
      "tag:", tag,
      "size:", size,
  )
  </code></pre>
  
  <p>And have this results:</p>
  
  <pre><code>&amp;{FileHeader:{
  Name:META-INF/MANIFEST.MF CreatorVersion:20 ReaderVersion:20 Flags:2056 Method:8 
  ModifiedTime:23093 ModifiedDate:18230 CRC32:2569174240 
  CompressedSize:359 UncompressedSize:570 CompressedSize64:359 UncompressedSize64:570 
  Extra:[] ExternalAttrs:0 Comment:
  } zipr:0xc208038038 zipsize:276893 headerOffset:0}
  
  &amp;{FileHeader:{
  Name:res/drawable/ic_launcher.png CreatorVersion:10 ReaderVersion:10 Flags:2048 Method:0 
  ModifiedTime:22030 ModifiedDate:18230 CRC32:2310989215 
  CompressedSize:20418 UncompressedSize:20418 CompressedSize64:20418 UncompressedSize64:20418
  Extra:[] ExternalAttrs:0 Comment:
  } zipr:0xc208038038 zipsize:276893 headerOffset:2066}
  
  ...
  
  ----------------&gt;PROBLEM HERE:-------------------=&gt;
  &amp;{FileHeader:{
  Name:AndroidManifest.xml CreatorVersion:10 ReaderVersion:10 Flags:2048 Method:0 
  ModifiedTime:22030 ModifiedDate:18230 CRC32:1929033187 
  CompressedSize:7268 UncompressedSize:7268 CompressedSize64:7268 UncompressedSize64:7268 
  Extra:[204 94 136 27 148 14 49 95 154 4 231 53 127 242 4 199 243 207 229 161 103 90 116 69 45 31 54 220 113 43 172 4 159 109 211 57 217 2 161 17 196 16 168 19 174 138 107 15 36 181 223 22 15 21 106 153] 
  ExternalAttrs:0 Comment:
  } zipr:0xc208038038 zipsize:276893 headerOffset:22954}
  
  len(f.Extra): 56
  len(b): 52
  tag: 24268 
  size: 7048 
  </code></pre>
  
  <p>Problem in extra headers (i think this extra headers add dex protector when encrypt apk). Size more then length of extra bytes.
  But unzip util and ZipArchive in php5.5 woked perfect with this extras. How to fix this ?</p>
  
  <p>I want to rewrite this piece in go archive/zip package, so that the extras do not interfere golang zip reader.</p>
  
  <p>It's very important for me, because i rewrite build apk from php to golang and I came across a problem that can not decide :(. Please help me.</p>