Skip to content

Instantly share code, notes, and snippets.

@mshr-h
Created January 8, 2015 08:57
Show Gist options
  • Save mshr-h/73178e68e6a50035e2e8 to your computer and use it in GitHub Desktop.
Save mshr-h/73178e68e6a50035e2e8 to your computer and use it in GitHub Desktop.
Print the contents of a zip archive.
package main
import (
"archive/zip"
"fmt"
"os"
)
func main() {
var r *zip.ReadCloser
var filename string
if len(os.Args) < 2 {
return
}
filename = os.Args[1]
r, err := zip.OpenReader(filename)
if err != nil {
return
}
for _, f := range r.File {
fmt.Println(f.Name)
}
defer r.Close()
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment