Skip to content

Commit

Permalink
add comment for ziptree package
Browse files Browse the repository at this point in the history
  • Loading branch information
Songmu committed Mar 23, 2019
1 parent f877403 commit c7bcca1
Showing 1 changed file with 5 additions and 0 deletions.
5 changes: 5 additions & 0 deletions ziptree/zipper.go
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
// Package ziptree contains code to zip a directory tree and write it out.
package ziptree

import (
Expand All @@ -10,6 +11,7 @@ import (
"time"
)

// Option for zipping
type Option func(*config)

type config struct {
Expand All @@ -21,18 +23,21 @@ func newConfig() *config {
return &config{Compress: true}
}

// Compress is an Option to compress a zip or not
func Compress(f bool) Option {
return func(c *config) {
c.Compress = f
}
}

// FixMtime is an Option to fix mtimes of the file in the zip
func FixMtime(t time.Time) Option {
return func(c *config) {
c.Mtime = t
}
}

// Zip a directory tree
func Zip(srcPath string, opts ...Option) ([]byte, error) {
c := newConfig()
for _, opt := range opts {
Expand Down

0 comments on commit c7bcca1

Please sign in to comment.