Codebase list golang-github-gobuffalo-packr / 26ec37e3-c9b1-4045-a350-a767ed6a285c/upstream
Import upstream version 2.8.1 Kali Janitor 3 years ago
86 changed file(s) with 567 addition(s) and 924 deletion(s). Raw diff Collapse all Expand all
0 # Default owner
1 * @gobuffalo/core-managers
0 # These are supported funding model platforms
1
2 github: markbates
3 patreon: buffalo
0 name: Tests
1 on: [push, pull_request]
2 jobs:
3
4 tests:
5 name: ${{matrix.go-version}} ${{matrix.os}}
6 runs-on: ${{ matrix.os }}
7 strategy:
8 matrix:
9 go-version: [1.12.x, 1.13.x]
10 os: [macos-latest, windows-latest, ubuntu-latest]
11 steps:
12 - name: Checkout Code
13 uses: actions/checkout@v1
14 with:
15 fetch-depth: 1
16 - name: Test v1
17 run: |
18 go get -t -v ./...
19 go test -race ./...
20 go install -v ./packr
21 - name: Test v2
22 run: |
23 cd v2
24 go get -t -v ./...
25 go test -race ./...
26 go install -v ./packr2
3232 debug.test
3333 .grifter/
3434 *-packr.go
35 .idea/
3536
0 **NOTICE: Please consider migrating your projects to [github.com/markbates/pkger](https://github.com/markbates/pkger). It has an idiomatic API, minimal dependencies, a stronger test suite (tested directly against the std lib counterparts), transparent tooling, and more.**
1
2 https://blog.gobuffalo.io/introducing-pkger-static-file-embedding-in-go-1ce76dc79c65
3
4
05 # packr (v1)
16
27 [![GoDoc](https://godoc.org/github.com/gobuffalo/packr?status.svg)](https://godoc.org/github.com/gobuffalo/packr)
3944 html, err := box.FindString("index.html")
4045
4146 // Get the []byte representation of a file, or an error if it doesn't exist:
42 html, err := box.FindBytes("index.html")
47 html, err := box.Find("index.html")
4348 ```
4449
4550 ### What is a Box?
+0
-71
azure-pipelines.yml less more
0 variables:
1 GOBIN: "$(GOPATH)/bin" # Go binaries path
2 GOPATH: "$(system.defaultWorkingDirectory)/gopath" # Go workspace path
3 modulePath: "$(GOPATH)/src/github.com/$(build.repository.name)" # Path to the module"s code
4
5 jobs:
6 - job: Windows
7 pool:
8 vmImage: "vs2017-win2016"
9 strategy:
10 matrix:
11 go 1.10:
12 go_version: "1.10"
13 go 1.11 (on):
14 go_version: "1.11.5"
15 GO111MODULE: "on"
16 go 1.11 (off):
17 go_version: "1.11.5"
18 GO111MODULE: "off"
19 go 1.12 (on):
20 go_version: "1.12"
21 GO111MODULE: "on"
22 go 1.12 (off):
23 go_version: "1.12"
24 GO111MODULE: "off"
25 steps:
26 - template: azure-tests.yml
27
28 - job: macOS
29 pool:
30 vmImage: "macOS-10.13"
31 strategy:
32 matrix:
33 go 1.10:
34 go_version: "1.10"
35 go 1.11 (on):
36 go_version: "1.11.5"
37 GO111MODULE: "on"
38 go 1.11 (off):
39 go_version: "1.11.5"
40 GO111MODULE: "off"
41 go 1.12 (on):
42 go_version: "1.12"
43 GO111MODULE: "on"
44 go 1.12 (off):
45 go_version: "1.12"
46 GO111MODULE: "off"
47 steps:
48 - template: azure-tests.yml
49
50 - job: Linux
51 pool:
52 vmImage: "ubuntu-16.04"
53 strategy:
54 matrix:
55 go 1.10:
56 go_version: "1.10"
57 go 1.11 (on):
58 go_version: "1.11.5"
59 GO111MODULE: "on"
60 go 1.11 (off):
61 go_version: "1.11.5"
62 GO111MODULE: "off"
63 go 1.12 (on):
64 go_version: "1.12"
65 GO111MODULE: "on"
66 go 1.12 (off):
67 go_version: "1.12"
68 GO111MODULE: "off"
69 steps:
70 - template: azure-tests.yml
+0
-24
azure-tests.yml less more
0 steps:
1 - task: GoTool@0
2 inputs:
3 version: $(go_version)
4 - task: Bash@3
5 inputs:
6 targetType: inline
7 script: |
8 mkdir -p "$(GOBIN)"
9 mkdir -p "$(GOPATH)/pkg"
10 mkdir -p "$(modulePath)"
11 shopt -s extglob
12 mv !(gopath) "$(modulePath)"
13 displayName: "Setup Go Workspace"
14 - script: |
15 go get -t -v ./...
16 go test -race ./...
17 go install -v ./packr
18 cd v2
19 go get -t -v ./...
20 go test -race ./...
21 go install -v ./packr2
22 workingDirectory: "$(modulePath)"
23 displayName: "Tests"
1010 func init() {
1111 {{- range $box := .Boxes }}
1212 {{- range .Files }}
13 packr.PackJSONBytes("{{$box.Name}}", "{{.Name}}", "{{.Contents}}")
13 _ = packr.PackJSONBytes("{{$box.Name}}", "{{.Name}}", "{{.Contents}}")
1414 {{- end }}
1515 {{- end }}
1616 }
44 require (
55 github.com/gobuffalo/envy v1.7.0
66 github.com/gobuffalo/packd v0.3.0
7 github.com/gobuffalo/packr/v2 v2.5.1
7 github.com/gobuffalo/packr/v2 v2.5.2
88 github.com/spf13/cobra v0.0.5
99 github.com/stretchr/testify v1.3.0
1010 golang.org/x/sync v0.0.0-20190423024810-112230192c58
1313 github.com/gobuffalo/logger v1.0.0/go.mod h1:2zbswyIUa45I+c+FLXuWl9zSWEiVuthsk8ze5s8JvPs=
1414 github.com/gobuffalo/packd v0.3.0 h1:eMwymTkA1uXsqxS0Tpoop3Lc0u3kTfiMBE6nKtQU4g4=
1515 github.com/gobuffalo/packd v0.3.0/go.mod h1:zC7QkmNkYVGKPw4tHpBQ+ml7W/3tIebgeo1b36chA3Q=
16 github.com/gobuffalo/packr/v2 v2.5.1 h1:TFOeY2VoGamPjQLiNDT3mn//ytzk236VMO2j7iHxJR4=
17 github.com/gobuffalo/packr/v2 v2.5.1/go.mod h1:8f9c96ITobJlPzI44jj+4tHnEKNt0xXWSVlXRN9X1Iw=
16 github.com/gobuffalo/packr/v2 v2.5.2 h1:4EvjeIpQLZuRIljwnidYgbRXbr1yIzVRrESiLjqKj6s=
17 github.com/gobuffalo/packr/v2 v2.5.2/go.mod h1:sgEE1xNZ6G0FNN5xn9pevVu4nywaxHvgup67xisti08=
1818 github.com/hashicorp/hcl v1.0.0/go.mod h1:E5yfLk+7swimpb2L/Alb/PJmXilQ/rhwaUYs4T20WEQ=
1919 github.com/inconshreveable/mousetrap v1.0.0 h1:Z8tu5sraLXCXIcARxBp/8cbvlwVa7Z1NHg9XEKhtSvM=
2020 github.com/inconshreveable/mousetrap v1.0.0/go.mod h1:PxqpIevigyE2G7u3NXJIT2ANytuPF1OarO4DADm73n8=
7070 golang.org/x/sys v0.0.0-20190515120540-06a5c4944438 h1:khxRGsvPk4n2y8I/mLLjp7e5dMTJmH75wvqS6nMwUtY=
7171 golang.org/x/sys v0.0.0-20190515120540-06a5c4944438/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=
7272 golang.org/x/text v0.3.0/go.mod h1:NqM8EUOU14njkJ3fqMW+pc6Ldnwhi/IjpwHt7yyuwOQ=
73 golang.org/x/tools v0.0.0-20190624180213-70d37148ca0c h1:KfpJVdWhuRqNk4XVXzjXf2KAV4TBEP77SYdFGjeGuIE=
74 golang.org/x/tools v0.0.0-20190624180213-70d37148ca0c/go.mod h1:/rFqwRUd4F7ZHNgwSSTFct+R/Kf4OFW1sUzUTQQTgfc=
73 golang.org/x/tools v0.0.0-20190628153133-6cdbf07be9d0 h1:Dh6fw+p6FyRl5x/FvNswO1ji0lIGzm3KP8Y9VkS9PTE=
74 golang.org/x/tools v0.0.0-20190628153133-6cdbf07be9d0/go.mod h1:/rFqwRUd4F7ZHNgwSSTFct+R/Kf4OFW1sUzUTQQTgfc=
7575 gopkg.in/check.v1 v0.0.0-20161208181325-20d25e280405/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0=
7676 gopkg.in/check.v1 v1.0.0-20180628173108-788fd7840127/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0=
7777 gopkg.in/errgo.v2 v2.1.0/go.mod h1:hNsd1EY+bozCKY1Ytp96fpM3vjJbqLJn88ws8XvfDNI=
1010 Use: "version",
1111 Short: "prints packr version",
1212 Run: func(cmd *cobra.Command, args []string) {
13 fmt.Print(packr.Version)
13 fmt.Println(packr.Version)
1414 },
1515 }
1616
3333 - '^docs:'
3434 - '^test:'
3535
36 brew:
37 github:
38 owner: gobuffalo
39 name: homebrew-tap
36 brews:
37 -
38 github:
39 owner: gobuffalo
40 name: homebrew-tap
4041
3030 - '^docs:'
3131 - '^test:'
3232 <%= if (brew) { %>
33 brew:
34 github:
35 owner: gobuffalo
36 name: homebrew-tap
33 brews:
34 -
35 github:
36 owner: gobuffalo
37 name: homebrew-tap
3738 <% } %>
1313 endif
1414
1515 deps:
16 $(GO_BIN) get github.com/gobuffalo/release
1716 $(GO_BIN) get -tags ${TAGS} -t ./...
1817 $(GO_BIN) install -v ./packr2
1918 make tidy
0 **NOTICE: Please consider migrating your projects to github.com/markbates/pkger. It has an idiomatic API, minimal dependencies, a stronger test suite (tested directly against the std lib counterparts), transparent tooling, and more.**
1
2 https://blog.gobuffalo.io/introducing-pkger-static-file-embedding-in-go-1ce76dc79c65
3
04 # Packr (v2)
15
26 [![GoDoc](https://godoc.org/github.com/gobuffalo/packr/v2?status.svg)](https://godoc.org/github.com/gobuffalo/packr/v2)
0 # github.com/gobuffalo/packr/v2 Stands on the Shoulders of Giants
0 # /Users/smichalak/dev/packr/v2 Stands on the Shoulders of Giants
11
2 github.com/gobuffalo/packr/v2 does not try to reinvent the wheel! Instead, it uses the already great wheels developed by the Go community and puts them all together in the best way possible. Without these giants, this project would not be possible. Please make sure to check them out and thank them for all of their hard work.
2 /Users/smichalak/dev/packr/v2 does not try to reinvent the wheel! Instead, it uses the already great wheels developed by the Go community and puts them all together in the best way possible. Without these giants, this project would not be possible. Please make sure to check them out and thank them for all of their hard work.
33
44 Thank you to the following **GIANTS**:
55
6
7 * [github.com/gobuffalo/envy](https://godoc.org/github.com/gobuffalo/envy)
86
97 * [github.com/gobuffalo/logger](https://godoc.org/github.com/gobuffalo/logger)
108
119 * [github.com/gobuffalo/packd](https://godoc.org/github.com/gobuffalo/packd)
1210
1311 * [github.com/karrick/godirwalk](https://godoc.org/github.com/karrick/godirwalk)
12
13 * [github.com/konsorten/go-windows-terminal-sequences](https://godoc.org/github.com/konsorten/go-windows-terminal-sequences)
14
15 * [github.com/markbates/errx](https://godoc.org/github.com/markbates/errx)
16
17 * [github.com/markbates/oncer](https://godoc.org/github.com/markbates/oncer)
18
19 * [github.com/markbates/safe](https://godoc.org/github.com/markbates/safe)
1420
1521 * [github.com/rogpeppe/go-internal](https://godoc.org/github.com/rogpeppe/go-internal)
1622
1515 "github.com/gobuffalo/packr/v2/file"
1616 "github.com/gobuffalo/packr/v2/file/resolver"
1717 "github.com/gobuffalo/packr/v2/plog"
18 "github.com/gobuffalo/packr/v2/internal/takeon/github.com/markbates/oncer"
18 "github.com/markbates/oncer"
1919 )
2020
2121 var _ packd.Box = &Box{}
2727 // Box represent a folder on a disk you want to
2828 // have access to in the built Go binary.
2929 type Box struct {
30 Path string `json:"path"`
31 Name string `json:"name"`
32 ResolutionDir string `json:"resolution_dir"`
33 DefaultResolver resolver.Resolver `json:"default_resolver"`
34 resolvers resolversMap
35 dirs dirsMap
30 Path string `json:"path"`
31 Name string `json:"name"`
32 ResolutionDir string `json:"resolution_dir"`
33 DefaultResolver resolver.Resolver `json:"default_resolver"`
34 resolvers resolversMap
35 dirs dirsMap
3636 }
3737
3838 // NewBox returns a Box that can be used to
214214
215215 f, err := r.Resolve(b.Name, key)
216216 if err != nil {
217 z := filepath.Join(resolver.OsPath(b.ResolutionDir), filepath.FromSlash(path.Clean("/"+resolver.OsPath(key))))
217 z, err := resolver.ResolvePathInBase(resolver.OsPath(b.ResolutionDir), filepath.FromSlash(path.Clean("/"+resolver.OsPath(key))))
218 if err != nil {
219 plog.Debug(r, "Resolve", "box", b.Name, "key", key, "err", err)
220 return f, err
221 }
222
218223 f, err = r.Resolve(b.Name, z)
219224 if err != nil {
220225 plog.Debug(r, "Resolve", "box", b.Name, "key", z, "err", err)
181181 r := require.New(t)
182182
183183 d := resolver.NewInMemory(map[string]file.File{
184 "foo.txt": qfile("foo.txt", "foo!"),
185 "bar": qfile("bar", "bar!"),
186 "baz/index.html": qfile("baz", "baz!"),
184 "foo.txt": qfile("foo.txt", "foo!"),
185 "bar": qfile("bar", "bar!"),
186 "baz/index.html": qfile("baz", "baz!"),
187187 })
188188 box := New("Test_Box_Open", "./templates")
189189
222222 r.True(box.HasDir("c"))
223223 r.False(box.HasDir("a"))
224224 }
225
226 func Test_Box_Traversal_Standard(t *testing.T) {
227 r := require.New(t)
228 box := New("Test_Box_Traversal_Standard", "")
229 _, err := box.FindString("../fixtures/hello.txt")
230 r.Error(err)
231 }
232
233 func Test_Box_Traversal_Standard_Depth2(t *testing.T) {
234 r := require.New(t)
235 box := New("Test_Box_Traversal_Standard_Depth2", "")
236 _, err := box.FindString("../../packr/fixtures/hello.txt")
237 r.Error(err)
238 }
239
240 func Test_Box_Traversal_Backslash(t *testing.T) {
241 r := require.New(t)
242 box := New("Test_Box_Traversal_Backslash", "")
243 _, err := box.FindString("..\\fixtures\\hello.txt")
244 r.Error(err)
245 }
246
247 func Test_Box_Traversal_Backslash_Depth2(t *testing.T) {
248 r := require.New(t)
249 box := New("Test_Box_Traversal_Backslash_Depth2", "")
250 _, err := box.FindString("..\\..\\packr2\\fixtures\\hello.txt")
251 r.Error(err)
252 }
55
66 "github.com/gobuffalo/packr/v2/file"
77 "github.com/gobuffalo/packr/v2/file/resolver"
8 "github.com/gobuffalo/packr/v2/internal/takeon/github.com/markbates/oncer"
8 "github.com/markbates/oncer"
99 )
1010
1111 // File has been deprecated and file.File should be used instead
55 )
66
77 type info struct {
8 Path string
9 Contents []byte
10 size int64
11 modTime time.Time
12 isDir bool
8 Path string
9 Contents []byte
10 size int64
11 modTime time.Time
12 isDir bool
1313 }
1414
1515 func (f info) Name() string {
2222 }
2323
2424 func (d *Disk) Resolve(box string, name string) (file.File, error) {
25 var err error
2526 path := OsPath(name)
2627 if !filepath.IsAbs(path) {
27 path = filepath.Join(OsPath(d.Root), path)
28 path, err = ResolvePathInBase(OsPath(d.Root), path)
29 if err != nil {
30 return nil, err
31 }
2832 }
33
2934 fi, err := os.Stat(path)
3035 if err != nil {
3136 return nil, err
3237 }
3338 if fi.IsDir() {
34 return file.NewDir(OsPath(name))
39 return nil, os.ErrNotExist
3540 }
3641 if bb, err := ioutil.ReadFile(path); err == nil {
3742 return file.NewFile(OsPath(name), bb)
3843 }
3944 return nil, os.ErrNotExist
45 }
46
47 // ResolvePathInBase returns a path that is guaranteed to be inside of the base directory or an error
48 func ResolvePathInBase(base, path string) (string, error) {
49 // Determine the absolute file path of the base directory
50 d, err := filepath.Abs(base)
51 if err != nil {
52 return "", err
53 }
54
55 // Return the base directory if no file was requested
56 if path == "/" || path == "\\" {
57 return d, nil
58 }
59
60 // Resolve the absolute file path after combining the key with base
61 p, err := filepath.Abs(filepath.Join(d, path))
62 if err != nil {
63 return "", err
64 }
65
66 // Verify that the resolved path is inside of the base directory
67 if !strings.HasPrefix(p, d+string(filepath.Separator)) {
68 return "", os.ErrNotExist
69 }
70 return p, nil
4071 }
4172
4273 var _ file.FileMappable = &Disk{}
69100 return nil
70101 }
71102 err := godirwalk.Walk(root, &godirwalk.Options{
72 FollowSymbolicLinks: true,
73 Callback: callback,
103 FollowSymbolicLinks: true,
104 Callback: callback,
74105 })
75106 if err != nil {
76107 plog.Logger.Errorf("[%s] error walking %v", root, err)
1414
1515 // EncodedLen returns the length of an encoding of n source bytes.
1616 // Specifically, it returns n * 2.
17 func EncodedLen(n int) int { return n * 2 }
17 func EncodedLen(n int) int { return n * 2 }
1818
1919 // Encode encodes src into EncodedLen(len(src))
2020 // bytes of dst. As a convenience, it returns the number
4343
4444 // DecodedLen returns the length of a decoding of x source bytes.
4545 // Specifically, it returns x / 2.
46 func DecodedLen(x int) int { return x / 2 }
46 func DecodedLen(x int) int { return x / 2 }
4747
4848 // Decode decodes src into DecodedLen(len(src)) bytes,
4949 // returning the actual number of bytes written to dst.
125125 const bufferSize = 1024
126126
127127 type encoder struct {
128 w io.Writer
129 err error
130 out [bufferSize]byte // output buffer
128 w io.Writer
129 err error
130 out [bufferSize]byte // output buffer
131131 }
132132
133133 // NewEncoder returns an io.Writer that writes lowercase hexadecimal characters to w.
152152 }
153153
154154 type decoder struct {
155 r io.Reader
156 err error
157 in []byte // input buffer (encoded form)
158 arr [bufferSize]byte // backing array for in
155 r io.Reader
156 err error
157 in []byte // input buffer (encoded form)
158 arr [bufferSize]byte // backing array for in
159159 }
160160
161161 // NewDecoder returns an io.Reader that decodes hexadecimal characters from r.
168168 // Fill internal buffer with sufficient bytes to decode
169169 if len(d.in) < 2 && d.err == nil {
170170 var numCopy, numRead int
171 numCopy = copy(d.arr[:], d.in) // Copies either 0 or 1 bytes
171 numCopy = copy(d.arr[:], d.in) // Copies either 0 or 1 bytes
172172 numRead, d.err = d.r.Read(d.arr[numCopy:])
173173 d.in = d.arr[:numCopy+numRead]
174174 if d.err == io.EOF && len(d.in)%2 != 0 {
187187 numDec, err := Decode(p, d.in[:len(p)*2])
188188 d.in = d.in[2*numDec:]
189189 if err != nil {
190 d.in, d.err = nil, err // Decode error; discard input remainder
190 d.in, d.err = nil, err // Decode error; discard input remainder
191191 }
192192
193193 if len(d.in) < 2 {
194 return numDec, d.err // Only expose errors when buffer fully consumed
194 return numDec, d.err // Only expose errors when buffer fully consumed
195195 }
196196 return numDec, nil
197197 }
204204 }
205205
206206 type dumper struct {
207 w io.Writer
208 rightChars [18]byte
209 buf [14]byte
210 used int // number of bytes in the current line
211 n uint // number of bytes, total
212 closed bool
207 w io.Writer
208 rightChars [18]byte
209 buf [14]byte
210 used int // number of bytes in the current line
211 n uint // number of bytes, total
212 closed bool
213213 }
214214
215215 func toChar(b byte) byte {
1717 var _ Resolver = &HexGzip{}
1818
1919 type HexGzip struct {
20 packed map[string]string
21 unpacked map[string]string
22 moot *sync.RWMutex
20 packed map[string]string
21 unpacked map[string]string
22 moot *sync.RWMutex
2323 }
2424
2525 func (hg HexGzip) String() string {
7676 }
7777
7878 hg := &HexGzip{
79 packed: files,
80 unpacked: map[string]string{},
81 moot: &sync.RWMutex{},
79 packed: files,
80 unpacked: map[string]string{},
81 moot: &sync.RWMutex{},
8282 }
8383
8484 return hg, nil
88
99 func Test_Ident_OsPath(t *testing.T) {
1010 table := map[string]string{
11 "foo/bar/baz": "foo/bar/baz",
12 "foo\\bar\\baz": "foo/bar/baz",
11 "foo/bar/baz": "foo/bar/baz",
12 "foo\\bar\\baz": "foo/bar/baz",
1313 }
1414
1515 if runtime.GOOS == "windows" {
2626
2727 func ident_OsPath_Windows_Table() map[string]string {
2828 return map[string]string{
29 "foo/bar/baz": "foo\\bar\\baz",
30 "foo\\bar\\baz": "foo\\bar\\baz",
29 "foo/bar/baz": "foo\\bar\\baz",
30 "foo\\bar\\baz": "foo\\bar\\baz",
3131 }
3232 }
00 module github.com/gobuffalo/packr/v2
11
2 go 1.12
2 go 1.13
33
44 require (
5 github.com/gobuffalo/envy v1.7.0
6 github.com/gobuffalo/logger v1.0.0
7 github.com/gobuffalo/packd v0.3.0
8 github.com/karrick/godirwalk v1.10.12
9 github.com/rogpeppe/go-internal v1.3.0
5 github.com/gobuffalo/logger v1.0.3
6 github.com/gobuffalo/packd v1.0.0
7 github.com/karrick/godirwalk v1.15.8
8 github.com/konsorten/go-windows-terminal-sequences v1.0.2 // indirect
9 github.com/markbates/errx v1.1.0
10 github.com/markbates/oncer v1.0.0
11 github.com/markbates/safe v1.0.1
12 github.com/rogpeppe/go-internal v1.5.2
1013 github.com/sirupsen/logrus v1.4.2
11 github.com/spf13/cobra v0.0.5
12 github.com/stretchr/testify v1.3.0
13 golang.org/x/sync v0.0.0-20190423024810-112230192c58
14 golang.org/x/tools v0.0.0-20190624180213-70d37148ca0c
14 github.com/spf13/cobra v0.0.6
15 github.com/stretchr/testify v1.5.1
16 golang.org/x/sync v0.0.0-20190911185100-cd5d95a43a6e
17 golang.org/x/tools v0.0.0-20200308013534-11ec41452d41
1518 )
0 cloud.google.com/go v0.26.0/go.mod h1:aQUYkXzVsufM+DwF1aE+0xfcU+56JwCaLick0ClmMTw=
01 github.com/BurntSushi/toml v0.3.1/go.mod h1:xHWCNGjB5oqiDr8zfno3MHue2Ht5sIBksp03qcyfWMU=
2 github.com/OneOfOne/xxhash v1.2.2/go.mod h1:HSdplMjZKSmBqAxg5vPj2TmRDmfkzw+cTzAElWljhcU=
3 github.com/alecthomas/template v0.0.0-20160405071501-a0175ee3bccc/go.mod h1:LOuyumcjzFXgccqObfd/Ljyb9UuFJ6TxHnclSeseNhc=
4 github.com/alecthomas/units v0.0.0-20151022065526-2efee857e7cf/go.mod h1:ybxpYRFXyAe+OPACYpWeL0wqObRcbAqCMya13uyzqw0=
15 github.com/armon/consul-api v0.0.0-20180202201655-eb2c6b5be1b6/go.mod h1:grANhF5doyWs3UAsr3K4I6qtAmlQcZDesFNEHPZAzj8=
6 github.com/beorn7/perks v0.0.0-20180321164747-3a771d992973/go.mod h1:Dwedo/Wpr24TaqPxmxbtue+5NUziq4I4S80YR8gNf3Q=
7 github.com/beorn7/perks v1.0.0/go.mod h1:KWe93zE9D1o94FZ5RNwFwVgaQK1VOXiVxmqh+CedLV8=
8 github.com/cespare/xxhash v1.1.0/go.mod h1:XrSqR1VqqWfGrhpAt58auRo0WTKS1nRRg3ghfAqPWnc=
9 github.com/client9/misspell v0.3.4/go.mod h1:qj6jICC3Q7zFZvVWo7KLAzC3yx5G7kyvSDkc90ppPyw=
10 github.com/coreos/bbolt v1.3.2/go.mod h1:iRUV2dpdMOn7Bo10OQBFzIJO9kkE559Wcmn+qkEiiKk=
211 github.com/coreos/etcd v3.3.10+incompatible/go.mod h1:uF7uidLiAD3TWHmW31ZFd/JWoc32PjwdhPthX9715RE=
3 github.com/coreos/go-etcd v2.0.0+incompatible/go.mod h1:Jez6KQU2B/sWsbdaef3ED8NzMklzPG4d5KIOhIy30Tk=
412 github.com/coreos/go-semver v0.2.0/go.mod h1:nnelYz7RCh+5ahJtPPxZlU+153eP4D4r3EedlOD2RNk=
5 github.com/cpuguy83/go-md2man v1.0.10/go.mod h1:SmD6nW6nTyfqj6ABTjUi3V3JVMnlJmwcJI5acqYI6dE=
13 github.com/coreos/go-systemd v0.0.0-20190321100706-95778dfbb74e/go.mod h1:F5haX7vjVVG0kc13fIWeqUViNPyEJxv/OmvnBo0Yme4=
14 github.com/coreos/pkg v0.0.0-20180928190104-399ea9e2e55f/go.mod h1:E3G3o1h8I7cfcXa63jLwjI0eiQQMgzzUDFVpN/nH/eA=
15 github.com/cpuguy83/go-md2man/v2 v2.0.0/go.mod h1:maD7wRr/U5Z6m/iR4s+kqSMx2CaBsrgA7czyZG/E6dU=
616 github.com/davecgh/go-spew v1.1.0/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38=
717 github.com/davecgh/go-spew v1.1.1 h1:vj9j/u1bqnvCEfJOwUhtlOARqs3+rkHYY13jYWTU97c=
818 github.com/davecgh/go-spew v1.1.1/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38=
19 github.com/dgrijalva/jwt-go v3.2.0+incompatible/go.mod h1:E3ru+11k8xSBh+hMPgOLZmtrrCbhqsmaPHjLKYnJCaQ=
20 github.com/dgryski/go-sip13 v0.0.0-20181026042036-e10d5fee7954/go.mod h1:vAd38F8PWV+bWy6jNmig1y/TA+kYO4g3RSRF0IAv0no=
921 github.com/fsnotify/fsnotify v1.4.7/go.mod h1:jwhsz4b93w/PPRr/qN1Yymfu8t87LnFCMoQvtojpjFo=
10 github.com/gobuffalo/envy v1.7.0 h1:GlXgaiBkmrYMHco6t4j7SacKO4XUjvh5pwXh0f4uxXU=
11 github.com/gobuffalo/envy v1.7.0/go.mod h1:n7DRkBerg/aorDM8kbduw5dN3oXGswK5liaSCx4T5NI=
12 github.com/gobuffalo/logger v1.0.0 h1:xw9Ko9EcC5iAFprrjJ6oZco9UpzS5MQ4jAwghsLHdy4=
13 github.com/gobuffalo/logger v1.0.0/go.mod h1:2zbswyIUa45I+c+FLXuWl9zSWEiVuthsk8ze5s8JvPs=
14 github.com/gobuffalo/packd v0.3.0 h1:eMwymTkA1uXsqxS0Tpoop3Lc0u3kTfiMBE6nKtQU4g4=
15 github.com/gobuffalo/packd v0.3.0/go.mod h1:zC7QkmNkYVGKPw4tHpBQ+ml7W/3tIebgeo1b36chA3Q=
22 github.com/ghodss/yaml v1.0.0/go.mod h1:4dBDuWmgqj2HViK6kFavaiC9ZROes6MMH2rRYeMEF04=
23 github.com/go-kit/kit v0.8.0/go.mod h1:xBxKIO96dXMWWy0MnWVtmwkA9/13aqxPnvrjFYMA2as=
24 github.com/go-logfmt/logfmt v0.3.0/go.mod h1:Qt1PoO58o5twSAckw1HlFXLmHsOX5/0LbT9GBnD5lWE=
25 github.com/go-logfmt/logfmt v0.4.0/go.mod h1:3RMwSq7FuexP4Kalkev3ejPJsZTpXXBr9+V4qmtdjCk=
26 github.com/go-stack/stack v1.8.0/go.mod h1:v0f6uXyyMGvRgIKkXu+yp6POWl0qKG85gN/melR3HDY=
27 github.com/gobuffalo/logger v1.0.3 h1:YaXOTHNPCvkqqA7w05A4v0k2tCdpr+sgFlgINbQ6gqc=
28 github.com/gobuffalo/logger v1.0.3/go.mod h1:SoeejUwldiS7ZsyCBphOGURmWdwUFXs0J7TCjEhjKxM=
29 github.com/gobuffalo/packd v1.0.0 h1:6ERZvJHfe24rfFmA9OaoKBdC7+c9sydrytMg8SdFGBM=
30 github.com/gobuffalo/packd v1.0.0/go.mod h1:6VTc4htmJRFB7u1m/4LeMTWjFoYrUiBkU9Fdec9hrhI=
31 github.com/gogo/protobuf v1.1.1/go.mod h1:r8qH/GZQm5c6nD/R0oafs1akxWv10x8SbQlK7atdtwQ=
32 github.com/gogo/protobuf v1.2.1/go.mod h1:hp+jE20tsWTFYpLwKvXlhS1hjn+gTNwPg2I6zVXpSg4=
33 github.com/golang/glog v0.0.0-20160126235308-23def4e6c14b/go.mod h1:SBH7ygxi8pfUlaOkMMuAQtPIUF8ecWP5IEl/CR7VP2Q=
34 github.com/golang/groupcache v0.0.0-20190129154638-5b532d6fd5ef/go.mod h1:cIg4eruTrX1D+g88fzRXU5OdNfaM+9IcxsU14FzY7Hc=
35 github.com/golang/mock v1.1.1/go.mod h1:oTYuIxOrZwtPieC+H1uAHpcLFnEyAGVDL/k47Jfbm0A=
36 github.com/golang/protobuf v1.2.0/go.mod h1:6lQm79b+lXiMfvg/cZm0SGofjICqVBUtrP5yJMmIC1U=
37 github.com/golang/protobuf v1.3.1/go.mod h1:6lQm79b+lXiMfvg/cZm0SGofjICqVBUtrP5yJMmIC1U=
38 github.com/google/btree v1.0.0/go.mod h1:lNA+9X1NB3Zf8V7Ke586lFgjr2dZNuvo3lPJSGZ5JPQ=
39 github.com/google/go-cmp v0.2.0/go.mod h1:oXzfMopK8JAjlY9xF4vHSVASa0yLyX7SntLO5aqRK0M=
40 github.com/gorilla/websocket v1.4.0/go.mod h1:E7qHFY5m1UJ88s3WnNqhKjPHQ0heANvMoAMk2YaljkQ=
41 github.com/grpc-ecosystem/go-grpc-middleware v1.0.0/go.mod h1:FiyG127CGDf3tlThmgyCl78X/SZQqEOJBCDaAfeWzPs=
42 github.com/grpc-ecosystem/go-grpc-prometheus v1.2.0/go.mod h1:8NvIoxWQoOIhqOTXgfV/d3M/q6VIi02HzZEHgUlZvzk=
43 github.com/grpc-ecosystem/grpc-gateway v1.9.0/go.mod h1:vNeuVxBJEsws4ogUvrchl83t/GYV9WGTSLVdBhOQFDY=
1644 github.com/hashicorp/hcl v1.0.0/go.mod h1:E5yfLk+7swimpb2L/Alb/PJmXilQ/rhwaUYs4T20WEQ=
1745 github.com/inconshreveable/mousetrap v1.0.0 h1:Z8tu5sraLXCXIcARxBp/8cbvlwVa7Z1NHg9XEKhtSvM=
1846 github.com/inconshreveable/mousetrap v1.0.0/go.mod h1:PxqpIevigyE2G7u3NXJIT2ANytuPF1OarO4DADm73n8=
19 github.com/joho/godotenv v1.3.0 h1:Zjp+RcGpHhGlrMbJzXTrZZPrWj+1vfm90La1wgB6Bhc=
20 github.com/joho/godotenv v1.3.0/go.mod h1:7hK45KPybAkOC6peb+G5yklZfMxEjkZhHbwpqxOKXbg=
21 github.com/karrick/godirwalk v1.10.12 h1:BqUm+LuJcXjGv1d2mj3gBiQyrQ57a0rYoAmhvJQ7RDU=
22 github.com/karrick/godirwalk v1.10.12/go.mod h1:RoGL9dQei4vP9ilrpETWE8CLOZ1kiN0LhBygSwrAsHA=
47 github.com/jonboulle/clockwork v0.1.0/go.mod h1:Ii8DK3G1RaLaWxj9trq07+26W01tbo22gdxWY5EU2bo=
48 github.com/julienschmidt/httprouter v1.2.0/go.mod h1:SYymIcj16QtmaHHD7aYtjjsJG7VTCxuUUipMqKk8s4w=
49 github.com/karrick/godirwalk v1.15.8 h1:7+rWAZPn9zuRxaIqqT8Ohs2Q2Ac0msBqwRdxNCr2VVs=
50 github.com/karrick/godirwalk v1.15.8/go.mod h1:j4mkqPuvaLI8mp1DroR3P6ad7cyYd4c1qeJ3RV7ULlk=
51 github.com/kisielk/errcheck v1.1.0/go.mod h1:EZBBE59ingxPouuu3KfxchcWSUPOHkagtvWXihfKN4Q=
52 github.com/kisielk/gotool v1.0.0/go.mod h1:XhKaO+MFFWcvkIS/tQcRk01m1F5IRFswLeQ+oQHNcck=
53 github.com/konsorten/go-windows-terminal-sequences v1.0.1 h1:mweAR1A6xJ3oS2pRaGiHgQ4OO8tzTaLawm8vnODuwDk=
2354 github.com/konsorten/go-windows-terminal-sequences v1.0.1/go.mod h1:T0+1ngSBFLxvqU3pZ+m/2kptfBszLMUkC4ZK/EgS/cQ=
2455 github.com/konsorten/go-windows-terminal-sequences v1.0.2 h1:DB17ag19krx9CFsz4o3enTrPXyIXCl+2iCXH/aMAp9s=
2556 github.com/konsorten/go-windows-terminal-sequences v1.0.2/go.mod h1:T0+1ngSBFLxvqU3pZ+m/2kptfBszLMUkC4ZK/EgS/cQ=
57 github.com/kr/logfmt v0.0.0-20140226030751-b84e30acd515/go.mod h1:+0opPa2QZZtGFBFZlji/RkVcI2GknAs/DXo4wKdlNEc=
58 github.com/kr/pretty v0.1.0 h1:L/CwN0zerZDmRFUapSPitk6f+Q3+0za1rQkzVuMiMFI=
2659 github.com/kr/pretty v0.1.0/go.mod h1:dAy3ld7l9f0ibDNOQOHHMYYIIbhfbHSm3C4ZsoJORNo=
2760 github.com/kr/pty v1.1.1/go.mod h1:pFQYn66WHrOpPYNljwOMqo10TkYh1fy3cYio2l3bCsQ=
61 github.com/kr/text v0.1.0 h1:45sCR5RtlFHMR4UwH9sdQ5TC8v0qDQCHnXt+kaKSTVE=
2862 github.com/kr/text v0.1.0/go.mod h1:4Jbv+DJW3UT/LiOwJeYQe1efqtUx/iVham/4vfdArNI=
2963 github.com/magiconair/properties v1.8.0/go.mod h1:PppfXfuXeibc/6YijjN8zIbojt8czPbwD3XqdrwzmxQ=
64 github.com/markbates/errx v1.1.0 h1:QDFeR+UP95dO12JgW+tgi2UVfo0V8YBHiUIOaeBPiEI=
65 github.com/markbates/errx v1.1.0/go.mod h1:PLa46Oex9KNbVDZhKel8v1OT7hD5JZ2eI7AHhA0wswc=
66 github.com/markbates/oncer v1.0.0 h1:E83IaVAHygyndzPimgUYJjbshhDTALZyXxvk9FOlQRY=
67 github.com/markbates/oncer v1.0.0/go.mod h1:Z59JA581E9GP6w96jai+TGqafHPW+cPfRxz2aSZ0mcI=
68 github.com/markbates/safe v1.0.1 h1:yjZkbvRM6IzKj9tlu/zMJLS0n/V351OZWRnF3QfaUxI=
69 github.com/markbates/safe v1.0.1/go.mod h1:nAqgmRi7cY2nqMc92/bSEeQA+R4OheNU2T1kNSCBdG0=
70 github.com/matttproud/golang_protobuf_extensions v1.0.1/go.mod h1:D8He9yQNgCq6Z5Ld7szi9bcBfOoFv/3dc6xSMkL2PC0=
3071 github.com/mitchellh/go-homedir v1.1.0/go.mod h1:SfyaCUpYCn1Vlf4IUYiD9fPX4A5wJrkLzIz1N1q0pr0=
3172 github.com/mitchellh/mapstructure v1.1.2/go.mod h1:FVVH3fgwuzCH5S8UJGiWEs2h04kUh9fWfEaFds41c1Y=
73 github.com/mwitkow/go-conntrack v0.0.0-20161129095857-cc309e4a2223/go.mod h1:qRWi+5nqEBWmkhHvq77mSJWrCKwh8bxhgT7d/eI7P4U=
74 github.com/oklog/ulid v1.3.1/go.mod h1:CirwcVhetQ6Lv90oh/F+FBtV6XMibvdAFo93nm5qn4U=
3275 github.com/pelletier/go-toml v1.2.0/go.mod h1:5z9KED0ma1S8pY6P1sdut58dfprrGBbd/94hg7ilaic=
76 github.com/pkg/errors v0.8.0/go.mod h1:bwawxfHBFNV+L2hUp1rHADufV3IMtnDRdf1r5NINEl0=
3377 github.com/pmezard/go-difflib v1.0.0 h1:4DBwDE0NGyQoBHbLQYPwSUPoCMWR5BEzIk/f1lZbAQM=
3478 github.com/pmezard/go-difflib v1.0.0/go.mod h1:iKH77koFhYxTK1pcRnkKkqfTogsbg7gZNVY4sRDYZ/4=
35 github.com/rogpeppe/go-internal v1.1.0/go.mod h1:M8bDsm7K2OlrFYOpmOWEs/qY81heoFRclV5y23lUDJ4=
36 github.com/rogpeppe/go-internal v1.3.0 h1:RR9dF3JtopPvtkroDZuVD7qquD0bnHlKSqaQhgwt8yk=
37 github.com/rogpeppe/go-internal v1.3.0/go.mod h1:M8bDsm7K2OlrFYOpmOWEs/qY81heoFRclV5y23lUDJ4=
38 github.com/russross/blackfriday v1.5.2/go.mod h1:JO/DiYxRf+HjHt06OyowR9PTA263kcR/rfWxYHBV53g=
79 github.com/prometheus/client_golang v0.9.1/go.mod h1:7SWBe2y4D6OKWSNQJUaRYU/AaXPKyh/dDVn+NZz0KFw=
80 github.com/prometheus/client_golang v0.9.3/go.mod h1:/TN21ttK/J9q6uSwhBd54HahCDft0ttaMvbicHlPoso=
81 github.com/prometheus/client_model v0.0.0-20180712105110-5c3871d89910/go.mod h1:MbSGuTsp3dbXC40dX6PRTWyKYBIrTGTE9sqQNg2J8bo=
82 github.com/prometheus/client_model v0.0.0-20190129233127-fd36f4220a90/go.mod h1:xMI15A0UPsDsEKsMN9yxemIoYk6Tm2C1GtYGdfGttqA=
83 github.com/prometheus/common v0.0.0-20181113130724-41aa239b4cce/go.mod h1:daVV7qP5qjZbuso7PdcryaAu0sAZbrN9i7WWcTMWvro=
84 github.com/prometheus/common v0.4.0/go.mod h1:TNfzLD0ON7rHzMJeJkieUDPYmFC7Snx/y86RQel1bk4=
85 github.com/prometheus/procfs v0.0.0-20181005140218-185b4288413d/go.mod h1:c3At6R/oaqEKCNdg8wHV1ftS6bRYblBhIjjI8uT2IGk=
86 github.com/prometheus/procfs v0.0.0-20190507164030-5867b95ac084/go.mod h1:TjEm7ze935MbeOT/UhFTIMYKhuLP4wbCsTZCD3I8kEA=
87 github.com/prometheus/tsdb v0.7.1/go.mod h1:qhTCs0VvXwvX/y3TZrWD7rabWM+ijKTux40TwIPHuXU=
88 github.com/rogpeppe/fastuuid v0.0.0-20150106093220-6724a57986af/go.mod h1:XWv6SoW27p1b0cqNHllgS5HIMJraePCO15w5zCzIWYg=
89 github.com/rogpeppe/go-internal v1.5.2 h1:qLvObTrvO/XRCqmkKxUlOBc48bI3efyDuAZe25QiF0w=
90 github.com/rogpeppe/go-internal v1.5.2/go.mod h1:xXDCJY+GAPziupqXw64V24skbSoqbTEfhy4qGm1nDQc=
91 github.com/russross/blackfriday/v2 v2.0.1/go.mod h1:+Rmxgy9KzJVeS9/2gXHxylqXiyQDYRxCVz55jmeOWTM=
92 github.com/shurcooL/sanitized_anchor_name v1.0.0/go.mod h1:1NzhyTcUVG4SuEtjjoZeVRXNmyL/1OwPU0+IJeTBvfc=
93 github.com/sirupsen/logrus v1.2.0/go.mod h1:LxeOpSwHxABJmUn/MG1IvRgCAasNZTLOkJPxbbu5VWo=
3994 github.com/sirupsen/logrus v1.4.2 h1:SPIRibHv4MatM3XXNO2BJeFLZwZ2LvZgfQ5+UNI2im4=
4095 github.com/sirupsen/logrus v1.4.2/go.mod h1:tLMulIdttU9McNUspp0xgXVQah82FyeX6MwdIuYE2rE=
96 github.com/soheilhy/cmux v0.1.4/go.mod h1:IM3LyeVVIOuxMH7sFAkER9+bJ4dT7Ms6E4xg4kGIyLM=
97 github.com/spaolacci/murmur3 v0.0.0-20180118202830-f09979ecbc72/go.mod h1:JwIasOWyU6f++ZhiEuf87xNszmSA2myDM2Kzu9HwQUA=
4198 github.com/spf13/afero v1.1.2/go.mod h1:j4pytiNVoe2o6bmDsKpLACNPDBIoEAkihy7loJ1B0CQ=
4299 github.com/spf13/cast v1.3.0/go.mod h1:Qx5cxh0v+4UWYiBimWS+eyWzqEqokIECu5etghLkUJE=
43 github.com/spf13/cobra v0.0.5 h1:f0B+LkLX6DtmRH1isoNA9VTtNUK9K8xYd28JNNfOv/s=
44 github.com/spf13/cobra v0.0.5/go.mod h1:3K3wKZymM7VvHMDS9+Akkh4K60UwM26emMESw8tLCHU=
100 github.com/spf13/cobra v0.0.6 h1:breEStsVwemnKh2/s6gMvSdMEkwW0sK8vGStnlVBMCs=
101 github.com/spf13/cobra v0.0.6/go.mod h1:/6GTrnGXV9HjY+aR4k0oJ5tcvakLuG6EuKReYlHNrgE=
45102 github.com/spf13/jwalterweatherman v1.0.0/go.mod h1:cQK4TGJAtQXfYWX+Ddv3mKDzgVb68N+wFjFa4jdeBTo=
46103 github.com/spf13/pflag v1.0.3 h1:zPAT6CGy6wXeQ7NtTnaTerfKOsV6V6F8agHXFiazDkg=
47104 github.com/spf13/pflag v1.0.3/go.mod h1:DYY7MBk1bdzusC3SYhjObp+wFpr4gzcvqqNjLnInEg4=
48 github.com/spf13/viper v1.3.2/go.mod h1:ZiWeW+zYFKm7srdB9IoDzzZXaJaI5eL9QjNiN/DMA2s=
105 github.com/spf13/viper v1.4.0/go.mod h1:PTJ7Z/lr49W6bUbkmS1V3by4uWynFiR9p7+dSq/yZzE=
49106 github.com/stretchr/objx v0.1.0/go.mod h1:HFkY916IF+rwdDfMAkV7OtwuqBVzrE8GR6GFx+wExME=
50107 github.com/stretchr/objx v0.1.1/go.mod h1:HFkY916IF+rwdDfMAkV7OtwuqBVzrE8GR6GFx+wExME=
51108 github.com/stretchr/testify v1.2.2/go.mod h1:a8OnRcib4nhh0OaRAV+Yts87kKdq0PP7pXfy6kDkUVs=
52 github.com/stretchr/testify v1.3.0 h1:TivCn/peBQ7UY8ooIcPgZFpTNSz0Q2U6UrFlUfqbe0Q=
53109 github.com/stretchr/testify v1.3.0/go.mod h1:M5WIy9Dh21IEIfnGCwXGc5bZfKNJtfHm1UVUgZn+9EI=
54 github.com/ugorji/go/codec v0.0.0-20181204163529-d75b2dcb6bc8/go.mod h1:VFNgLljTbGfSG7qAOspJ7OScBnGdDN/yBr0sguwnwf0=
110 github.com/stretchr/testify v1.4.0 h1:2E4SXV/wtOkTonXsotYi4li6zVWxYlZuYNCXe9XRJyk=
111 github.com/stretchr/testify v1.4.0/go.mod h1:j7eGeouHqKxXV5pUuKE4zz7dFj8WfuZ+81PSLYec5m4=
112 github.com/stretchr/testify v1.5.1 h1:nOGnQDM7FYENwehXlg/kFVnos3rEvtKTjRvOWSzb6H4=
113 github.com/stretchr/testify v1.5.1/go.mod h1:5W2xD1RspED5o8YsWQXVCued0rvSQ+mT+I5cxcmMvtA=
114 github.com/tmc/grpc-websocket-proxy v0.0.0-20190109142713-0ad062ec5ee5/go.mod h1:ncp9v5uamzpCO7NfCPTXjqaC+bZgJeR0sMTm6dMHP7U=
115 github.com/ugorji/go v1.1.4/go.mod h1:uQMGLiO92mf5W77hV/PUCpI3pbzQx3CRekS0kk+RGrc=
116 github.com/xiang90/probing v0.0.0-20190116061207-43a291ad63a2/go.mod h1:UETIi67q53MR2AWcXfiuqkDkRtnGDLqkBTpCHuJHxtU=
55117 github.com/xordataexchange/crypt v0.0.3-0.20170626215501-b2862e3d0a77/go.mod h1:aYKd//L2LvnjZzWKhF00oedf4jCCReLcmhLdhm1A27Q=
56 golang.org/x/crypto v0.0.0-20181203042331-505ab145d0a9/go.mod h1:6SG95UA2DQfeDnfUPMdvaQW0Q7yPrPDi9nlGo2tz2b4=
118 go.etcd.io/bbolt v1.3.2/go.mod h1:IbVyRI1SCnLcuJnV2u8VeU0CEYM7e686BmAb1XKL+uU=
119 go.uber.org/atomic v1.4.0/go.mod h1:gD2HeocX3+yG+ygLZcrzQJaqmWj9AIm7n08wl/qW/PE=
120 go.uber.org/multierr v1.1.0/go.mod h1:wR5kodmAFQ0UK8QlbwjlSNy0Z68gJhDJUG5sjR94q/0=
121 go.uber.org/zap v1.10.0/go.mod h1:vwi/ZaCAaUcBkycHslxD9B2zi4UTXhF60s6SWpuDF0Q=
122 golang.org/x/crypto v0.0.0-20180904163835-0709b304e793/go.mod h1:6SG95UA2DQfeDnfUPMdvaQW0Q7yPrPDi9nlGo2tz2b4=
57123 golang.org/x/crypto v0.0.0-20190308221718-c2843e01d9a2/go.mod h1:djNgcEr1/C05ACkg1iLfiJU5Ep61QUkGW8qpdssI0+w=
58 golang.org/x/crypto v0.0.0-20190621222207-cc06ce4a13d4 h1:ydJNl0ENAG67pFbB+9tfhiL2pYqLhfoaZFw/cjLhY4A=
59 golang.org/x/crypto v0.0.0-20190621222207-cc06ce4a13d4/go.mod h1:yigFU9vqHzYiE8UmvKecakEJjdnWj3jj499lnFckfCI=
124 golang.org/x/crypto v0.0.0-20191011191535-87dc89f01550/go.mod h1:yigFU9vqHzYiE8UmvKecakEJjdnWj3jj499lnFckfCI=
125 golang.org/x/crypto v0.0.0-20191122220453-ac88ee75c92c h1:/nJuwDLoL/zrqY6gf57vxC+Pi+pZ8bfhpPkicO5H7W4=
126 golang.org/x/crypto v0.0.0-20191122220453-ac88ee75c92c/go.mod h1:LzIPMQfyMNhhGPhUkYOs5KpL4U8rLKemX1yGLhDgUto=
127 golang.org/x/lint v0.0.0-20181026193005-c67002cb31c3/go.mod h1:UVdnD1Gm6xHRNCYTkRU2/jEulfH38KcIWyp/GAMgvoE=
128 golang.org/x/lint v0.0.0-20190313153728-d0100b6bd8b3/go.mod h1:6SW0HCj/g11FgYtHlgUYUwCkIfeOF89ocIRzGO/8vkc=
129 golang.org/x/mod v0.2.0/go.mod h1:s0Qsj1ACt9ePp/hMypM3fl4fZqREWJwdYDEqhRiZZUA=
130 golang.org/x/net v0.0.0-20180826012351-8a410e7b638d/go.mod h1:mL1N/T3taQHkDXs73rZJwtUhF3w3ftmwwsq0BUmARs4=
131 golang.org/x/net v0.0.0-20181114220301-adae6a3d119a/go.mod h1:mL1N/T3taQHkDXs73rZJwtUhF3w3ftmwwsq0BUmARs4=
132 golang.org/x/net v0.0.0-20181220203305-927f97764cc3/go.mod h1:mL1N/T3taQHkDXs73rZJwtUhF3w3ftmwwsq0BUmARs4=
60133 golang.org/x/net v0.0.0-20190311183353-d8887717615a/go.mod h1:t9HGtf8HONx5eT2rtn7q6eTqICYqUVnKs3thJo3Qplg=
61134 golang.org/x/net v0.0.0-20190404232315-eb5bcb51f2a3/go.mod h1:t9HGtf8HONx5eT2rtn7q6eTqICYqUVnKs3thJo3Qplg=
62 golang.org/x/sync v0.0.0-20190423024810-112230192c58 h1:8gQV6CLnAEikrhgkHFbMAEhagSSnXWGV915qUMm9mrU=
135 golang.org/x/net v0.0.0-20190522155817-f3200d17e092/go.mod h1:HSz+uSET+XFnRR8LxR5pz3Of3rY3CfYBVs4xY44aLks=
136 golang.org/x/net v0.0.0-20190620200207-3b0461eec859 h1:R/3boaszxrf1GEUWTVDzSKVwLmSJpwZ1yqXm8j0v2QI=
137 golang.org/x/net v0.0.0-20190620200207-3b0461eec859/go.mod h1:z5CRVTTTmAJ677TzLLGU+0bjPO0LkuOLi4/5GtJWs/s=
138 golang.org/x/net v0.0.0-20200226121028-0de0cce0169b/go.mod h1:z5CRVTTTmAJ677TzLLGU+0bjPO0LkuOLi4/5GtJWs/s=
139 golang.org/x/oauth2 v0.0.0-20180821212333-d2e6202438be/go.mod h1:N/0e6XlmueqKjAGxoOufVs8QHGRruUQn6yWY3a++T0U=
140 golang.org/x/sync v0.0.0-20180314180146-1d60e4601c6f/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM=
141 golang.org/x/sync v0.0.0-20181108010431-42b317875d0f/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM=
142 golang.org/x/sync v0.0.0-20181221193216-37e7f081c4d4/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM=
63143 golang.org/x/sync v0.0.0-20190423024810-112230192c58/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM=
64 golang.org/x/sys v0.0.0-20181205085412-a5c9d58dba9a/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY=
144 golang.org/x/sync v0.0.0-20190911185100-cd5d95a43a6e h1:vcxGaoTs7kV8m5Np9uUNQin4BrLOthgV7252N8V+FwY=
145 golang.org/x/sync v0.0.0-20190911185100-cd5d95a43a6e/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM=
146 golang.org/x/sys v0.0.0-20180830151530-49385e6e1522/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY=
147 golang.org/x/sys v0.0.0-20180905080454-ebe1bf3edb33/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY=
148 golang.org/x/sys v0.0.0-20181107165924-66b7b1311ac8/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY=
149 golang.org/x/sys v0.0.0-20181116152217-5ac8a444bdc5/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY=
65150 golang.org/x/sys v0.0.0-20190215142949-d0b11bdaac8a/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY=
66151 golang.org/x/sys v0.0.0-20190412213103-97732733099d/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=
152 golang.org/x/sys v0.0.0-20190422165155-953cdadca894 h1:Cz4ceDQGXuKRnVBDTS23GTn/pU5OE2C0WrNTOYK1Uuc=
67153 golang.org/x/sys v0.0.0-20190422165155-953cdadca894/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=
68 golang.org/x/sys v0.0.0-20190515120540-06a5c4944438 h1:khxRGsvPk4n2y8I/mLLjp7e5dMTJmH75wvqS6nMwUtY=
69 golang.org/x/sys v0.0.0-20190515120540-06a5c4944438/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=
70154 golang.org/x/text v0.3.0/go.mod h1:NqM8EUOU14njkJ3fqMW+pc6Ldnwhi/IjpwHt7yyuwOQ=
71 golang.org/x/tools v0.0.0-20190624180213-70d37148ca0c h1:KfpJVdWhuRqNk4XVXzjXf2KAV4TBEP77SYdFGjeGuIE=
72 golang.org/x/tools v0.0.0-20190624180213-70d37148ca0c/go.mod h1:/rFqwRUd4F7ZHNgwSSTFct+R/Kf4OFW1sUzUTQQTgfc=
155 golang.org/x/time v0.0.0-20190308202827-9d24e82272b4/go.mod h1:tRJNPiyCQ0inRvYxbN9jk5I+vvW/OXSQhTDSoE431IQ=
156 golang.org/x/tools v0.0.0-20180221164845-07fd8470d635/go.mod h1:n7NCudcB/nEzxVGmLbDWY5pfWTLqBcC2KZ6jyYvM4mQ=
157 golang.org/x/tools v0.0.0-20190114222345-bf090417da8b/go.mod h1:n7NCudcB/nEzxVGmLbDWY5pfWTLqBcC2KZ6jyYvM4mQ=
158 golang.org/x/tools v0.0.0-20190311212946-11955173bddd/go.mod h1:LCzVGOaR6xXOjkQ3onu1FJEFr0SW1gC7cKk1uF8kGRs=
159 golang.org/x/tools v0.0.0-20191119224855-298f0cb1881e/go.mod h1:b+2E5dAYhXwXZwtnZ6UAqBI28+e2cm9otk0dWdXHAEo=
160 golang.org/x/tools v0.0.0-20200308013534-11ec41452d41 h1:9Di9iYgOt9ThCipBxChBVhgNipDoE5mxO84rQV7D0FE=
161 golang.org/x/tools v0.0.0-20200308013534-11ec41452d41/go.mod h1:o4KQGtdN14AW+yjsvvwRTJJuXz8XRtIHtEnmAXLyFUw=
162 golang.org/x/xerrors v0.0.0-20190717185122-a985d3407aa7/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0=
163 golang.org/x/xerrors v0.0.0-20191011141410-1b5146add898/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0=
164 golang.org/x/xerrors v0.0.0-20191204190536-9bdfabe68543/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0=
165 google.golang.org/appengine v1.1.0/go.mod h1:EbEs0AVv82hx2wNQdGPgUI5lhzA/G0D9YwlJXL52JkM=
166 google.golang.org/genproto v0.0.0-20180817151627-c66870c02cf8/go.mod h1:JiN7NxoALGmiZfu7CAH4rXhgtRTLTxftemlI0sWmxmc=
167 google.golang.org/grpc v1.19.0/go.mod h1:mqu4LbDTu4XGKhr4mRzUsmM4RtVoemTSY81AxZiDr8c=
168 google.golang.org/grpc v1.21.0/go.mod h1:oYelfM1adQP15Ek0mdvEgi9Df8B9CZIaU1084ijfRaM=
169 gopkg.in/alecthomas/kingpin.v2 v2.2.6/go.mod h1:FMv+mEhP44yOT+4EoQTLFTRgOQ1FBLkstjWtayDeSgw=
73170 gopkg.in/check.v1 v0.0.0-20161208181325-20d25e280405/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0=
171 gopkg.in/check.v1 v1.0.0-20180628173108-788fd7840127 h1:qIbj1fsPNlZgppZ+VLlY7N33q108Sa+fhmuc+sWQYwY=
74172 gopkg.in/check.v1 v1.0.0-20180628173108-788fd7840127/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0=
75173 gopkg.in/errgo.v2 v2.1.0/go.mod h1:hNsd1EY+bozCKY1Ytp96fpM3vjJbqLJn88ws8XvfDNI=
174 gopkg.in/resty.v1 v1.12.0/go.mod h1:mDo4pnntr5jdWRML875a/NmxYqAlA73dVijT2AXvQQo=
175 gopkg.in/yaml.v2 v2.0.0-20170812160011-eb3733d160e7/go.mod h1:JAlM8MvJe8wmxCU4Bli9HhUf9+ttbYbLASfIpnQbh74=
176 gopkg.in/yaml.v2 v2.2.1/go.mod h1:hI93XBmqTisBFMUTm0b8Fm+jr3Dg1NNxqwp+5A1VGuI=
177 gopkg.in/yaml.v2 v2.2.2 h1:ZCJp+EgiOT7lHqUV2J862kp8Qj64Jo6az82+3Td9dZw=
76178 gopkg.in/yaml.v2 v2.2.2/go.mod h1:hI93XBmqTisBFMUTm0b8Fm+jr3Dg1NNxqwp+5A1VGuI=
179 honnef.co/go/tools v0.0.0-20190102054323-c2f93a96b099/go.mod h1:rf3lG4BRIbNafJWhAfAdb/ePZxsR/4RtNHQocxwk9r4=
55 "runtime"
66 "strings"
77
8 "github.com/gobuffalo/envy"
98 "github.com/gobuffalo/packr/v2/plog"
109 )
1110
1211 func construct(name string, path string) *Box {
1312 return &Box{
14 Path: path,
15 Name: name,
16 ResolutionDir: resolutionDir(path),
17 resolvers: resolversMap{},
18 dirs: dirsMap{},
13 Path: path,
14 Name: name,
15 ResolutionDir: resolutionDir(path),
16 resolvers: resolversMap{},
17 dirs: dirsMap{},
1918 }
2019 }
2120
3029 return ng, true
3130 }
3231
33 ng = filepath.Join(envy.GoPath(), "src", ng)
32 ng = filepath.Join(os.Getenv("GOPATH"), "src", ng)
3433 if resolutionDirExists(ng, og) {
3534 return ng, true
3635 }
2424 }
2525
2626 hg, err := resolver.NewHexGzip(map[string]string{
27 "index.html": ind,
28 "hello.txt": hello,
27 "index.html": ind,
28 "hello.txt": hello,
2929 })
3030 if err != nil {
3131 panic(err)
128128 })
129129 }
130130 }
131
132 func Test_HTTPBox_Disk(t *testing.T) {
133 r := require.New(t)
134
135 box := New("http disk box", "./_fixtures/http_test")
136 mux := http.NewServeMux()
137 mux.Handle("/", http.FileServer(box))
138
139 type testcase struct {
140 URL, Content, Location string
141 Code int
142 }
143
144 testcases := []testcase{
145 {"/", "Index", "", 200},
146 {"/sub", "Sub", "", 200},
147 {"/index.html", "", "./", 301},
148 {"/sub/index.html", "", "./", 301},
149 {"/sub/", "", "../sub", 301},
150 {"/footer.html", "Footer", "", 200},
151 {"/css/main.css", "Css", "", 200},
152 {"/css", "404 page not found", "", 404},
153 {"/css/", "404 page not found", "", 404},
154 }
155
156 for _, tc := range testcases {
157 t.Run("path"+tc.URL, func(t *testing.T) {
158 req, err := http.NewRequest("GET", tc.URL, nil)
159 r.NoError(err)
160 res := httptest.NewRecorder()
161 mux.ServeHTTP(res, req)
162
163 r.Equal(tc.Code, res.Code)
164 r.Equal(tc.Location, res.Header().Get("location"))
165 r.Equal(tc.Content, strings.TrimSpace(res.Body.String()))
166 })
167 }
168 }
0 package internal
1
2 import (
3 "os"
4 "runtime"
5 "strings"
6 )
7
8 // Mods returns true when go modules supports is enabled
9 func Mods() bool {
10 go111 := os.Getenv("GO111MODULE")
11
12 if !inGoPath() {
13 return go111 != "off"
14 }
15
16 return go111 == "on"
17 }
18
19 func inGoPath() bool {
20 pwd, _ := os.Getwd()
21 for _, p := range GoPaths() {
22 if strings.HasPrefix(pwd, p) {
23 return true
24 }
25 }
26 return false
27 }
28
29 // GoPaths return the defined gopath list.
30 func GoPaths() []string {
31 gp := os.Getenv("GOPATH")
32 if runtime.GOOS == "windows" {
33 return strings.Split(gp, ";") // Windows uses a different separator
34 }
35 return strings.Split(gp, ":")
36 }
+0
-29
v2/internal/takeon/github.com/markbates/errx/.gitignore less more
0 *.log
1 .DS_Store
2 doc
3 tmp
4 pkg
5 *.gem
6 *.pid
7 coverage
8 coverage.data
9 build/*
10 *.pbxuser
11 *.mode1v3
12 .svn
13 profile
14 .console_history
15 .sass-cache/*
16 .rake_tasks~
17 *.log.lck
18 solr/
19 .jhw-cache/
20 jhw.*
21 *.sublime*
22 node_modules/
23 dist/
24 generated/
25 .vendor/
26 bin/*
27 gin-bin
28 .idea/
+0
-21
v2/internal/takeon/github.com/markbates/errx/LICENSE less more
0 The MIT License (MIT)
1
2 Copyright (c) 2019 Mark Bates
3
4 Permission is hereby granted, free of charge, to any person obtaining a copy
5 of this software and associated documentation files (the "Software"), to deal
6 in the Software without restriction, including without limitation the rights
7 to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
8 copies of the Software, and to permit persons to whom the Software is
9 furnished to do so, subject to the following conditions:
10
11 The above copyright notice and this permission notice shall be included in all
12 copies or substantial portions of the Software.
13
14 THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
15 IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
16 FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
17 AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
18 LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
19 OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
20 SOFTWARE.
+0
-61
v2/internal/takeon/github.com/markbates/errx/Makefile less more
0 TAGS ?= ""
1 GO_BIN ?= "go"
2
3 install:
4 $(GO_BIN) install -tags ${TAGS} -v .
5 make tidy
6
7 tidy:
8 ifeq ($(GO111MODULE),on)
9 $(GO_BIN) mod tidy
10 else
11 echo skipping go mod tidy
12 endif
13
14 deps:
15 $(GO_BIN) get -tags ${TAGS} -t ./...
16 make tidy
17
18 build:
19 $(GO_BIN) build -v .
20 make tidy
21
22 test:
23 $(GO_BIN) test -cover -tags ${TAGS} ./...
24 make tidy
25
26 ci-deps:
27 $(GO_BIN) get -tags ${TAGS} -t ./...
28
29 ci-test:
30 $(GO_BIN) test -tags ${TAGS} -race ./...
31
32 lint:
33 go get github.com/golangci/golangci-lint/cmd/golangci-lint
34 golangci-lint run --enable-all
35 make tidy
36
37 update:
38 ifeq ($(GO111MODULE),on)
39 rm go.*
40 $(GO_BIN) mod init
41 $(GO_BIN) mod tidy
42 else
43 $(GO_BIN) get -u -tags ${TAGS}
44 endif
45 make test
46 make install
47 make tidy
48
49 release-test:
50 $(GO_BIN) test -tags ${TAGS} -race ./...
51 make tidy
52
53 release:
54 $(GO_BIN) get github.com/gobuffalo/release
55 make tidy
56 release -y -f version.go --skip-packr
57 make tidy
58
59
60
+0
-6
v2/internal/takeon/github.com/markbates/errx/SHOULDERS.md less more
0 # github.com/markbates/errx Stands on the Shoulders of Giants
1
2 github.com/markbates/errx does not try to reinvent the wheel! Instead, it uses the already great wheels developed by the Go community and puts them all together in the best way possible. Without these giants, this project would not be possible. Please make sure to check them out and thank them for all of their hard work.
3
4 Thank you to the following **GIANTS**:
5
+0
-71
v2/internal/takeon/github.com/markbates/errx/azure-pipelines.yml less more
0 variables:
1 GOBIN: "$(GOPATH)/bin" # Go binaries path
2 GOPATH: "$(system.defaultWorkingDirectory)/gopath" # Go workspace path
3 modulePath: "$(GOPATH)/src/github.com/$(build.repository.name)" # Path to the module"s code
4
5 jobs:
6 - job: Windows
7 pool:
8 vmImage: "vs2017-win2016"
9 strategy:
10 matrix:
11 go 1.10:
12 go_version: "1.10"
13 go 1.11 (on):
14 go_version: "1.11.5"
15 GO111MODULE: "on"
16 go 1.11 (off):
17 go_version: "1.11.5"
18 GO111MODULE: "off"
19 go 1.12 (on):
20 go_version: "1.12"
21 GO111MODULE: "on"
22 go 1.12 (off):
23 go_version: "1.12"
24 GO111MODULE: "off"
25 steps:
26 - template: azure-tests.yml
27
28 - job: macOS
29 pool:
30 vmImage: "macOS-10.13"
31 strategy:
32 matrix:
33 go 1.10:
34 go_version: "1.10"
35 go 1.11 (on):
36 go_version: "1.11.5"
37 GO111MODULE: "on"
38 go 1.11 (off):
39 go_version: "1.11.5"
40 GO111MODULE: "off"
41 go 1.12 (on):
42 go_version: "1.12"
43 GO111MODULE: "on"
44 go 1.12 (off):
45 go_version: "1.12"
46 GO111MODULE: "off"
47 steps:
48 - template: azure-tests.yml
49
50 - job: Linux
51 pool:
52 vmImage: "ubuntu-16.04"
53 strategy:
54 matrix:
55 go 1.10:
56 go_version: "1.10"
57 go 1.11 (on):
58 go_version: "1.11.5"
59 GO111MODULE: "on"
60 go 1.11 (off):
61 go_version: "1.11.5"
62 GO111MODULE: "off"
63 go 1.12 (on):
64 go_version: "1.12"
65 GO111MODULE: "on"
66 go 1.12 (off):
67 go_version: "1.12"
68 GO111MODULE: "off"
69 steps:
70 - template: azure-tests.yml
+0
-19
v2/internal/takeon/github.com/markbates/errx/azure-tests.yml less more
0 steps:
1 - task: GoTool@0
2 inputs:
3 version: $(go_version)
4 - task: Bash@3
5 inputs:
6 targetType: inline
7 script: |
8 mkdir -p "$(GOBIN)"
9 mkdir -p "$(GOPATH)/pkg"
10 mkdir -p "$(modulePath)"
11 shopt -s extglob
12 mv !(gopath) "$(modulePath)"
13 displayName: "Setup Go Workspace"
14 - script: |
15 go get -t -v ./...
16 go test -race ./...
17 workingDirectory: "$(modulePath)"
18 displayName: "Tests"
+0
-23
v2/internal/takeon/github.com/markbates/errx/errx.go less more
0 package errx
1
2 // go2 errors
3 type Wrapper interface {
4 Unwrap() error
5 }
6
7 // pkg/errors
8 type Causer interface {
9 Cause() error
10 }
11
12 func Unwrap(err error) error {
13 switch e := err.(type) {
14 case Wrapper:
15 return e.Unwrap()
16 case Causer:
17 return e.Cause()
18 }
19 return err
20 }
21
22 var Cause = Unwrap
+0
-4
v2/internal/takeon/github.com/markbates/errx/version.go less more
0 package errx
1
2 // Version of errx
3 const Version = "v1.0.0"
+0
-29
v2/internal/takeon/github.com/markbates/oncer/.gitignore less more
0 *.log
1 .DS_Store
2 doc
3 tmp
4 pkg
5 *.gem
6 *.pid
7 coverage
8 coverage.data
9 build/*
10 *.pbxuser
11 *.mode1v3
12 .svn
13 profile
14 .console_history
15 .sass-cache/*
16 .rake_tasks~
17 *.log.lck
18 solr/
19 .jhw-cache/
20 jhw.*
21 *.sublime*
22 node_modules/
23 dist/
24 generated/
25 .vendor/
26 bin/*
27 gin-bin
28 .idea/
+0
-21
v2/internal/takeon/github.com/markbates/oncer/LICENSE less more
0 The MIT License (MIT)
1
2 Copyright (c) 2018 Mark Bates
3
4 Permission is hereby granted, free of charge, to any person obtaining a copy
5 of this software and associated documentation files (the "Software"), to deal
6 in the Software without restriction, including without limitation the rights
7 to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
8 copies of the Software, and to permit persons to whom the Software is
9 furnished to do so, subject to the following conditions:
10
11 The above copyright notice and this permission notice shall be included in all
12 copies or substantial portions of the Software.
13
14 THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
15 IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
16 FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
17 AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
18 LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
19 OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
20 SOFTWARE.
+0
-40
v2/internal/takeon/github.com/markbates/oncer/Makefile less more
0 TAGS ?= "sqlite"
1 GO_BIN ?= go
2
3 install:
4 packr
5 $(GO_BIN) install -v .
6
7 deps:
8 $(GO_BIN) get github.com/gobuffalo/release
9 $(GO_BIN) get github.com/gobuffalo/packr/packr
10 $(GO_BIN) get -tags ${TAGS} -t ./...
11 $(GO_BIN) mod tidy
12
13 build:
14 packr
15 $(GO_BIN) build -v .
16
17 test:
18 packr
19 $(GO_BIN) test -tags ${TAGS} ./...
20
21 ci-test: deps
22 $(GO_BIN) test -tags ${TAGS} -race ./...
23
24 lint:
25 gometalinter --vendor ./... --deadline=1m --skip=internal
26
27 update:
28 $(GO_BIN) get -u -tags ${TAGS}
29 $(GO_BIN) mod tidy
30 packr
31 make test
32 make install
33 $(GO_BIN) mod tidy
34
35 release-test:
36 $(GO_BIN) test -tags ${TAGS} -race ./...
37
38 release:
39 release -y -f version.go
+0
-20
v2/internal/takeon/github.com/markbates/oncer/deprecate.go less more
0 package oncer
1
2 import (
3 "fmt"
4 "io"
5 "os"
6 )
7
8 const deprecated = "DEPRECATED"
9
10 var deprecationWriter io.Writer = os.Stdout
11
12 func Deprecate(depth int, name string, msg string) {
13 Do(deprecated+name, func() {
14 fmt.Fprintf(deprecationWriter, "[%s] %s has been deprecated.\n", deprecated, name)
15 if len(msg) > 0 {
16 fmt.Fprintf(deprecationWriter, "\t%s\n", msg)
17 }
18 })
19 }
+0
-7
v2/internal/takeon/github.com/markbates/oncer/log.go less more
0 //+build !debug
1
2 package oncer
3
4 func log(name string, fn func()) func() {
5 return fn
6 }
+0
-19
v2/internal/takeon/github.com/markbates/oncer/log_debug.go less more
0 //+build debug
1
2 package oncer
3
4 import (
5 "fmt"
6 "time"
7 )
8
9 func log(name string, fn func()) func() {
10 return func() {
11 start := time.Now()
12 if len(name) > 80 {
13 name = name[(len(name) - 80):]
14 }
15 defer fmt.Println(name, time.Now().Sub(start))
16 fn()
17 }
18 }
+0
-26
v2/internal/takeon/github.com/markbates/oncer/oncer.go less more
0 package oncer
1
2 import (
3 "sync"
4 )
5
6 var onces = &sync.Map{}
7
8 func Do(name string, fn func()) {
9 o, _ := onces.LoadOrStore(name, &sync.Once{})
10 if once, ok := o.(*sync.Once); ok {
11 once.Do(log(name, fn))
12 }
13 }
14
15 func Reset(names ...string) {
16 if len(names) == 0 {
17 onces = &sync.Map{}
18 return
19 }
20
21 for _, n := range names {
22 onces.Delete(n)
23 onces.Delete(deprecated + n)
24 }
25 }
+0
-29
v2/internal/takeon/github.com/markbates/safe/.gitignore less more
0 *.log
1 .DS_Store
2 doc
3 tmp
4 pkg
5 *.gem
6 *.pid
7 coverage
8 coverage.data
9 build/*
10 *.pbxuser
11 *.mode1v3
12 .svn
13 profile
14 .console_history
15 .sass-cache/*
16 .rake_tasks~
17 *.log.lck
18 solr/
19 .jhw-cache/
20 jhw.*
21 *.sublime*
22 node_modules/
23 dist/
24 generated/
25 .vendor/
26 bin/*
27 gin-bin
28 .idea/
+0
-3
v2/internal/takeon/github.com/markbates/safe/.gometalinter.json less more
0 {
1 "Enable": ["vet", "golint", "goimports", "deadcode", "gotype", "ineffassign", "misspell", "nakedret", "unconvert", "megacheck", "varcheck"]
2 }
+0
-26
v2/internal/takeon/github.com/markbates/safe/.travis.yml less more
0 language: go
1
2 sudo: false
3
4 matrix:
5 include:
6 - go: "1.9.x"
7 - go: "1.10.x"
8 - go: "1.11.x"
9 env:
10 - GO111MODULE=off
11 - go: "1.11.x"
12 env:
13 - GO111MODULE=on
14 - go: "tip"
15 env:
16 - GO111MODULE=off
17 - go: "tip"
18 env:
19 - GO111MODULE=on
20 allow_failures:
21 - go: "tip"
22
23 install: make deps
24
25 script: make ci-test
+0
-21
v2/internal/takeon/github.com/markbates/safe/LICENSE less more
0 The MIT License (MIT)
1
2 Copyright (c) 2018 Mark Bates
3
4 Permission is hereby granted, free of charge, to any person obtaining a copy
5 of this software and associated documentation files (the "Software"), to deal
6 in the Software without restriction, including without limitation the rights
7 to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
8 copies of the Software, and to permit persons to whom the Software is
9 furnished to do so, subject to the following conditions:
10
11 The above copyright notice and this permission notice shall be included in all
12 copies or substantial portions of the Software.
13
14 THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
15 IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
16 FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
17 AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
18 LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
19 OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
20 SOFTWARE.
+0
-55
v2/internal/takeon/github.com/markbates/safe/Makefile less more
0 TAGS ?= "sqlite"
1 GO_BIN ?= go
2
3 install:
4 packr
5 $(GO_BIN) install -tags ${TAGS} -v .
6 make tidy
7
8 tidy:
9 ifeq ($(GO111MODULE),on)
10 $(GO_BIN) mod tidy
11 else
12 echo skipping go mod tidy
13 endif
14
15 deps:
16 $(GO_BIN) get github.com/gobuffalo/release
17 $(GO_BIN) get github.com/gobuffalo/packr/packr
18 $(GO_BIN) get -tags ${TAGS} -t ./...
19 make tidy
20
21 build:
22 packr
23 $(GO_BIN) build -v .
24 make tidy
25
26 test:
27 packr
28 $(GO_BIN) test -tags ${TAGS} ./...
29 make tidy
30
31 ci-test:
32 $(GO_BIN) test -tags ${TAGS} -race ./...
33 make tidy
34
35 lint:
36 gometalinter --vendor ./... --deadline=1m --skip=internal
37 make tidy
38
39 update:
40 $(GO_BIN) get -u -tags ${TAGS}
41 make tidy
42 packr
43 make test
44 make install
45 make tidy
46
47 release-test:
48 $(GO_BIN) test -tags ${TAGS} -race ./...
49 make tidy
50
51 release:
52 make tidy
53 release -y -f version.go
54 make tidy
+0
-33
v2/internal/takeon/github.com/markbates/safe/safe.go less more
0 package safe
1
2 import (
3 "errors"
4 "fmt"
5 )
6
7 // Run the function safely knowing that if it panics
8 // the panic will be caught and returned as an error
9 func Run(fn func()) (err error) {
10 return RunE(func() error {
11 fn()
12 return nil
13 })
14 }
15
16 // Run the function safely knowing that if it panics
17 // the panic will be caught and returned as an error
18 func RunE(fn func() error) (err error) {
19 defer func() {
20 if err != nil {
21 return
22 }
23 if ex := recover(); ex != nil {
24 if e, ok := ex.(error); ok {
25 err = e
26 return
27 }
28 err = errors.New(fmt.Sprint(ex))
29 }
30 }()
31 return fn()
32 }
+0
-8
v2/internal/takeon/github.com/markbates/safe/shoulders.md less more
0 # github.com/markbates/safe Stands on the Shoulders of Giants
1
2 github.com/markbates/safe does not try to reinvent the wheel! Instead, it uses the already great wheels developed by the Go community and puts them all together in the best way possible. Without these giants this project would not be possible. Please make sure to check them out and thank them for all of their hard work.
3
4 Thank you to the following **GIANTS**:
5
6
7 * [github.com/markbates/safe](https://godoc.org/github.com/markbates/safe)
+0
-3
v2/internal/takeon/github.com/markbates/safe/version.go less more
0 package safe
1
2 const Version = "v1.0.1"
1414
1515 // PackOptions ...
1616 type PackOptions struct {
17 IgnoreImports bool
18 Legacy bool
19 StoreCmd string
20 Roots []string
21 RootsOptions *parser.RootsOptions
17 IgnoreImports bool
18 Legacy bool
19 StoreCmd string
20 Roots []string
21 RootsOptions *parser.RootsOptions
2222 }
2323
2424 // Pack the roots given + PWD
77
88 // Box found while parsing a file
99 type Box struct {
10 Name string // name of the box
11 Path string // relative path of folder NewBox("./templates")
12 AbsPath string // absolute path of Path
13 Package string // the package name the box was found in
14 PWD string // the PWD when the parser was run
15 PackageDir string // the absolute path of the package where the box was found
10 Name string // name of the box
11 Path string // relative path of folder NewBox("./templates")
12 AbsPath string // absolute path of Path
13 Package string // the package name the box was found in
14 PWD string // the PWD when the parser was run
15 PackageDir string // the absolute path of the package where the box was found
1616 }
1717
1818 type Boxes []*Box
3131 name = strings.Replace(name, "\"", "", -1)
3232 pwd, _ := os.Getwd()
3333 box := &Box{
34 Name: name,
35 Path: path,
36 PWD: pwd,
34 Name: name,
35 Path: path,
36 PWD: pwd,
3737 }
3838 return box
3939 }
99 // File that is to be parsed
1010 type File struct {
1111 io.Reader
12 Path string
13 AbsPath string
12 Path string
13 AbsPath string
1414 }
1515
1616 // Name of the file "app.go"
4646 abs, _ = filepath.Abs(path)
4747 }
4848 return &File{
49 Reader: r,
50 Path: path,
51 AbsPath: abs,
49 Reader: r,
50 Path: path,
51 AbsPath: abs,
5252 }
5353 }
22 import (
33 "fmt"
44 "go/build"
5 "os"
56 "path/filepath"
67 "strings"
78 "time"
89
910 "github.com/gobuffalo/packr/v2/plog"
1011 "github.com/karrick/godirwalk"
11 "github.com/gobuffalo/packr/v2/internal/takeon/github.com/markbates/errx"
12 "github.com/gobuffalo/packr/v2/internal/takeon/github.com/markbates/oncer"
12 "github.com/markbates/errx"
13 "github.com/markbates/oncer"
1314 )
1415
1516 type finder struct {
3233 if ext != ".go" {
3334 return nil
3435 }
36 //check if path is a dir
37 fi, err := os.Stat(path)
38 if err != nil {
39 return nil
40 }
41
42 if fi.IsDir() {
43 return nil
44 }
45
3546 names = append(names, path)
3647 return nil
3748 }
3849 err = godirwalk.Walk(dir, &godirwalk.Options{
39 FollowSymbolicLinks: true,
40 Callback: callback,
50 FollowSymbolicLinks: true,
51 Callback: callback,
4152 })
4253 })
4354
77 "strings"
88
99 "github.com/gobuffalo/packd"
10 "github.com/gobuffalo/packr/v2/internal/takeon/github.com/markbates/errx"
10 "github.com/markbates/errx"
1111 )
1212
1313 // ParsedFile ...
1414 type ParsedFile struct {
15 File packd.SimpleFile
16 FileSet *token.FileSet
17 Ast *ast.File
18 Lines []string
15 File packd.SimpleFile
16 FileSet *token.FileSet
17 Ast *ast.File
18 Lines []string
1919 }
2020
2121 // ParseFileMode ...
2222 func ParseFileMode(gf packd.SimpleFile, mode parser.Mode) (ParsedFile, error) {
2323 pf := ParsedFile{
24 FileSet: token.NewFileSet(),
25 File: gf,
24 FileSet: token.NewFileSet(),
25 File: gf,
2626 }
2727
2828 src := gf.String()
99
1010 // Parser to find boxes
1111 type Parser struct {
12 Prospects []*File // a list of files to check for boxes
13 IgnoreImports bool
12 Prospects []*File // a list of files to check for boxes
13 IgnoreImports bool
1414 }
1515
1616 // Run the parser and run any boxes found
66
77 "github.com/gobuffalo/packr/v2/jam/parser"
88 "github.com/gobuffalo/packr/v2/jam/store"
9 "github.com/gobuffalo/packr/v2/internal/takeon/github.com/markbates/oncer"
9 "github.com/markbates/oncer"
1010 "github.com/stretchr/testify/require"
1111 )
1212
77
88 func Test_IsProspect(t *testing.T) {
99 table := []struct {
10 path string
11 pass bool
10 path string
11 pass bool
1212 }{
1313 {"foo/.git/config", false},
1414 {"foo/.git/baz.go", false},
1212 )
1313
1414 type RootsOptions struct {
15 IgnoreImports bool
16 Ignores []string
15 IgnoreImports bool
16 Ignores []string
1717 }
1818
1919 func (r RootsOptions) String() string {
4848 return nil
4949 }
5050 wopts := &godirwalk.Options{
51 FollowSymbolicLinks: true,
52 Callback: callback,
51 FollowSymbolicLinks: true,
52 Callback: callback,
5353 }
5454 for _, root := range roots {
5555 plog.Debug(p, "NewFromRoots", "walking", root)
1111 )
1212
1313 type Visitor struct {
14 File packd.SimpleFile
15 Package string
16 boxes map[string]*Box
17 errors []error
14 File packd.SimpleFile
15 Package string
16 boxes map[string]*Box
17 errors []error
1818 }
1919
2020 func NewVisitor(f *File) *Visitor {
2121 return &Visitor{
22 File: f,
23 boxes: map[string]*Box{},
24 errors: []error{},
22 File: f,
23 boxes: map[string]*Box{},
24 errors: []error{},
2525 }
2626 }
2727
00 module foo
1
2 go 1.14
13
24 require (
35 github.com/gobuffalo/packr/v2 v2.0.0-rc.2 // indirect
0 errors v0.8.0 h1:WdK/asTD0HN+q6hsWO3/vpuAkAr+tw6aNJNDFFf0+qw=
1 errors v0.8.0/go.mod h1:bwawxfHBFNV+L2hUp1rHADufV3IMtnDRdf1r5NINEl0=
02 github.com/BurntSushi/toml v0.3.1 h1:WXkYYl6Yr3qBf1K79EBnL4mak0OimBfB0XUf9Vl28OQ=
13 github.com/BurntSushi/toml v0.3.1/go.mod h1:xHWCNGjB5oqiDr8zfno3MHue2Ht5sIBksp03qcyfWMU=
24 github.com/Masterminds/semver v1.4.2/go.mod h1:MB6lktGJrhw8PrUyiEoblNEGEQ+RzHPF078ddwwvV3Y=
190192 github.com/onsi/gomega v1.4.1/go.mod h1:C1qb7wdrVGGVU+Z6iS04AVkA3Q65CEZX59MT0QO5uiA=
191193 github.com/onsi/gomega v1.4.2/go.mod h1:ex+gbHU/CVuBBDIJjb2X0qEXbFg53c61hWP/1CpauHY=
192194 github.com/pelletier/go-toml v1.2.0/go.mod h1:5z9KED0ma1S8pY6P1sdut58dfprrGBbd/94hg7ilaic=
193 errors v0.8.0 h1:WdK/asTD0HN+q6hsWO3/vpuAkAr+tw6aNJNDFFf0+qw=
194 errors v0.8.0/go.mod h1:bwawxfHBFNV+L2hUp1rHADufV3IMtnDRdf1r5NINEl0=
195 github.com/pkg/errors v0.8.0/go.mod h1:bwawxfHBFNV+L2hUp1rHADufV3IMtnDRdf1r5NINEl0=
195196 github.com/pmezard/go-difflib v1.0.0/go.mod h1:iKH77koFhYxTK1pcRnkKkqfTogsbg7gZNVY4sRDYZ/4=
196197 github.com/satori/go.uuid v1.2.0/go.mod h1:dA0hQrYB0VpLJoorglMZABFdXlWrHn1NEOzdhQKdks0=
197198 github.com/serenize/snaker v0.0.0-20171204205717-a683aaf2d516/go.mod h1:Yow6lPLSAXx2ifx470yD/nUe22Dv5vBvxK/UK9UUTVs=
1616 "strings"
1717 "sync"
1818
19 "github.com/gobuffalo/envy"
19 "github.com/gobuffalo/packr/v2/internal"
20 "github.com/karrick/godirwalk"
21
2022 "github.com/gobuffalo/packr/v2/file/resolver/encoding/hex"
2123 "github.com/gobuffalo/packr/v2/plog"
2224 "github.com/rogpeppe/go-internal/modfile"
2325
2426 "github.com/gobuffalo/packr/v2/jam/parser"
25 "github.com/karrick/godirwalk"
2627 "golang.org/x/sync/errgroup"
2728 )
2829
3132 const DISK_GLOBAL_KEY = "__packr_global__"
3233
3334 type Disk struct {
34 DBPath string
35 DBPackage string
36 global map[string]string
37 boxes map[string]*parser.Box
38 moot *sync.RWMutex
35 DBPath string
36 DBPackage string
37 global map[string]string
38 boxes map[string]*parser.Box
39 moot *sync.RWMutex
3940 }
4041
4142 func NewDisk(path string, pkg string) *Disk {
4950 path, _ = filepath.Abs(path)
5051 }
5152 return &Disk{
52 DBPath: path,
53 DBPackage: pkg,
54 global: map[string]string{},
55 boxes: map[string]*parser.Box{},
56 moot: &sync.RWMutex{},
53 DBPath: path,
54 DBPackage: pkg,
55 global: map[string]string{},
56 boxes: map[string]*parser.Box{},
57 moot: &sync.RWMutex{},
5758 }
5859 }
5960
6768 return names, nil
6869 }
6970 err := godirwalk.Walk(path, &godirwalk.Options{
70 FollowSymbolicLinks: true,
71 FollowSymbolicLinks: true,
7172 Callback: func(path string, de *godirwalk.Dirent) error {
7273 if !de.IsRegular() {
7374 return nil
125126 }
126127
127128 type options struct {
128 Package string
129 GlobalFiles map[string]string
130 Boxes []optsBox
131 GK string
129 Package string
130 GlobalFiles map[string]string
131 Boxes []optsBox
132 GK string
132133 }
133134
134135 type optsBox struct {
135 Name string
136 Path string
136 Name string
137 Path string
137138 }
138139
139140 // Close ...
144145
145146 xb := &parser.Box{Name: DISK_GLOBAL_KEY}
146147 opts := options{
147 Package: d.DBPackage,
148 GlobalFiles: map[string]string{},
149 GK: makeKey(xb, d.DBPath),
148 Package: d.DBPackage,
149 GlobalFiles: map[string]string{},
150 GK: makeKey(xb, d.DBPath),
150151 }
151152
152153 wg := errgroup.Group{}
203204 }
204205
205206 type file struct {
206 Resolver string
207 ForwardPath string
207 Resolver string
208 ForwardPath string
208209 }
209210
210211 tmpl, err := template.New("box.go").Parse(diskGlobalBoxTmpl)
217218 p := strings.TrimPrefix(s, box.AbsPath)
218219 p = strings.TrimPrefix(p, string(filepath.Separator))
219220 files = append(files, file{
220 Resolver: strings.Replace(p, "\\", "/", -1),
221 ForwardPath: makeKey(box, s),
221 Resolver: strings.Replace(p, "\\", "/", -1),
222 ForwardPath: makeKey(box, s),
222223 })
223224 }
224225 opts := map[string]interface{}{
225 "Box": box,
226 "Files": files,
226 "Box": box,
227 "Files": files,
227228 }
228229
229230 bb := &bytes.Buffer{}
253254 }
254255
255256 var ip string
256 if envy.Mods() {
257 if internal.Mods() {
257258 // Starting in 1.12, we can rely on Go's method for
258259 // resolving where go.mod resides. Prior versions will
259260 // simply return an empty string.
284285 ip = strings.Replace(ip, "\\", "/", -1)
285286 } else {
286287 ip = filepath.Dir(d.DBPath)
287 srcs := envy.GoPaths()
288 srcs := internal.GoPaths()
288289 srcs = append(srcs, build.Default.SrcDirs()...)
289290 for _, x := range srcs {
290291 ip = strings.TrimPrefix(ip, "/private")
311312 defer f.Close()
312313
313314 o := struct {
314 Package string
315 Import string
315 Package string
316 Import string
316317 }{
317 Package: b.Package,
318 Import: ip,
318 Package: b.Package,
319 Import: ip,
319320 }
320321
321322 tmpl, err := template.New(p).Parse(diskImportTmpl)
99 g := packr.New(gk, "")
1010
1111 hgr, err := resolver.NewHexGzip(map[string]string{
12 "4abf3a9b652ecec6b347eb6acb7ce363": "1f8b08000000000000fff2750c72775508cecc2d28cecfe302040000fffffb1d273b0e000000",
13 "5cfc8f95f98237a10affc14a76e3e20b": "1f8b08000000000000fff2757477f7745508cecc2d28cecfe302040000ffffb09167470f000000",
14 "6d8be986fa35821e7e869fbb118e51ba": "1f8b08000000000000fff2f0f7750d5208cecc2d28cecfe302040000fffffb2ef0a60e000000",
15 "99e5497ae5f5988fafafbcd15ed74d22": "1f8b08000000000000fff2f10c765408cecc2d28cecfe302040000ffffab9bc93e0d000000",
16 "bb006aa6261a80f6c52c640f713659c1": "1f8b08000000000000ff72720c0a5108cecc2d28cecfe302040000ffff89742ac20d000000",
12 "4abf3a9b652ecec6b347eb6acb7ce363": "1f8b08000000000000fff2750c72775508cecc2d28cecfe302040000fffffb1d273b0e000000",
13 "5cfc8f95f98237a10affc14a76e3e20b": "1f8b08000000000000fff2757477f7745508cecc2d28cecfe302040000ffffb09167470f000000",
14 "6d8be986fa35821e7e869fbb118e51ba": "1f8b08000000000000fff2f0f7750d5208cecc2d28cecfe302040000fffffb2ef0a60e000000",
15 "99e5497ae5f5988fafafbcd15ed74d22": "1f8b08000000000000fff2f10c765408cecc2d28cecfe302040000ffffab9bc93e0d000000",
16 "bb006aa6261a80f6c52c640f713659c1": "1f8b08000000000000ff72720c0a5108cecc2d28cecfe302040000ffff89742ac20d000000",
1717 })
1818 if err != nil {
1919 return err
4444 const diskGlobalBoxTmpl = `
4545 func() {
4646 b := packr.New("{{.Box.Name}}", "{{.Box.Path}}")
47 {{ range $file := .Files -}}
47 {{- range $file := .Files }}
4848 b.SetResolver("{{$file.Resolver}}", packr.Pointer{ForwardBox: gk, ForwardPath: "{{$file.ForwardPath}}"})
49 {{ end -}}
50 }()
51 `
49 {{- end }}
50 }()`
88 var _ Store = &FnStore{}
99
1010 type FnStore struct {
11 FileNamesFn func(*parser.Box) ([]string, error)
12 FilesFn func(*parser.Box) ([]*parser.File, error)
13 PackFn func(*parser.Box) error
14 CleanFn func(*parser.Box) error
11 FileNamesFn func(*parser.Box) ([]string, error)
12 FilesFn func(*parser.Box) ([]*parser.File, error)
13 PackFn func(*parser.Box) error
14 CleanFn func(*parser.Box) error
1515 }
1616
1717 func (f *FnStore) FileNames(box *parser.Box) ([]string, error) {
1616
1717 type Legacy struct {
1818 *Disk
19 boxes map[string][]legacyBox
19 boxes map[string][]legacyBox
2020 }
2121
2222 func NewLegacy() *Legacy {
2323 return &Legacy{
24 Disk: NewDisk("", ""),
25 boxes: map[string][]legacyBox{},
24 Disk: NewDisk("", ""),
25 boxes: map[string][]legacyBox{},
2626 }
2727 }
2828
4949
5050 lbs := l.boxes[box.PackageDir]
5151 lbs = append(lbs, legacyBox{
52 Box: box,
53 Files: fcs,
52 Box: box,
53 Files: fcs,
5454 })
5555 l.boxes[box.PackageDir] = lbs
5656 return nil
7777 bx := b[0].Box
7878 pkg := bx.Package
7979 opts := map[string]interface{}{
80 "Package": pkg,
81 "Boxes": b,
80 "Package": pkg,
81 "Boxes": b,
8282 }
8383 p := filepath.Join(bx.PackageDir, "a_"+bx.Package+"-packr.go.tmpl")
8484 tmpl, err := template.New(p).Parse(legacyTmpl)
101101 }
102102
103103 type legacyBox struct {
104 Box *parser.Box
105 Files []legacyFile
104 Box *parser.Box
105 Files []legacyFile
106106 }
107107
108108 type legacyFile struct {
109 Name string
110 Contents string
109 Name string
110 Contents string
111111 }
112112
113113 var legacyTmpl = `// Code generated by github.com/gobuffalo/packr. DO NOT EDIT.
121121 func init() {
122122 {{- range $box := .Boxes }}
123123 {{- range $box.Files }}
124 packr.PackJSONBytes("{{$box.Box.Name}}", "{{.Name}}", "{{.Contents}}")
124 _ = packr.PackJSONBytes("{{$box.Box.Name}}", "{{.Name}}", "{{.Contents}}")
125125 {{- end }}
126126 {{- end }}
127127 }
33 "fmt"
44
55 "github.com/gobuffalo/packr/v2/file/resolver"
6 "github.com/gobuffalo/packr/v2/internal/takeon/github.com/markbates/safe"
76 "github.com/gobuffalo/packr/v2/jam/parser"
87 "github.com/gobuffalo/packr/v2/plog"
8 "github.com/markbates/safe"
99 )
1010
1111 var boxes = &boxMap{}
77 )
88
99 var buildCmd = &cobra.Command{
10 Use: "build",
11 Short: "Wraps the go build command with packr",
12 DisableFlagParsing: true,
10 Use: "build",
11 Short: "Wraps the go build command with packr",
12 DisableFlagParsing: true,
1313 RunE: func(cmd *cobra.Command, args []string) error {
1414 cargs := parseArgs(args)
1515 if globalOptions.Verbose {
55 )
66
77 var cleanCmd = &cobra.Command{
8 Use: "clean",
9 Short: "removes any *-packr.go files",
8 Use: "clean",
9 Short: "removes any *-packr.go files",
1010 RunE: func(cmd *cobra.Command, args []string) error {
1111 return jam.Clean(args...)
1212 },
55 "os"
66 "strings"
77
8 "github.com/gobuffalo/envy"
98 "github.com/gobuffalo/packr/v2/jam/store"
109 )
11
12 var modsOn = (strings.TrimSpace(envy.Get("GO111MODULE", "off")) == "on")
1310
1411 //YesToAll will be used by the command to skip the questions
1512 var YesToAll bool
99
1010 // fixCmd represents the info command
1111 var fixCmd = &cobra.Command{
12 Use: "fix",
13 Short: fmt.Sprintf("will attempt to fix a application's API to match packr version %s", packr.Version),
12 Use: "fix",
13 Short: fmt.Sprintf("will attempt to fix a application's API to match packr version %s", packr.Version),
1414 RunE: func(cmd *cobra.Command, args []string) error {
1515 return fix.Run()
1616 },
66 "path/filepath"
77 "strings"
88
9 "github.com/gobuffalo/envy"
109 "github.com/gobuffalo/packr/v2/plog"
1110 )
1211
5453 }
5554 }
5655
57 cp := exec.Command(envy.Get("GO_BIN", "go"), cargs...)
56 goBin := os.Getenv("GO_BIN")
57 if goBin == "" {
58 goBin = "go"
59 }
60 cp := exec.Command(goBin, cargs...)
5861 plog.Logger.Debug(strings.Join(cp.Args, " "))
5962 cp.Stderr = os.Stderr
6063 cp.Stdin = os.Stdin
2222 `
2323
2424 var installCmd = &cobra.Command{
25 Use: "install",
26 Short: "Don't. ru",
27 DisableFlagParsing: true,
25 Use: "install",
26 Short: "Don't. ru",
27 DisableFlagParsing: true,
2828 RunE: func(cmd *cobra.Command, args []string) error {
2929 cargs := parseArgs(args)
3030 if globalOptions.Verbose {
1111
1212 var globalOptions = struct {
1313 jam.PackOptions
14 Verbose bool
15 Silent bool
14 Verbose bool
15 Silent bool
1616 }{
1717 PackOptions: jam.PackOptions{},
1818 }
1919
2020 var rootCmd = &cobra.Command{
21 Use: "packr2",
22 Short: "Packr is a simple solution for bundling static assets inside of Go binaries.",
21 Use: "packr2",
22 Short: "Packr is a simple solution for bundling static assets inside of Go binaries.",
2323 PersistentPreRunE: func(cmd *cobra.Command, args []string) error {
2424 for _, a := range args {
2525 if a == "--legacy" {
77 )
88
99 var versionCmd = &cobra.Command{
10 Use: "version",
11 Short: "shows packr version",
10 Use: "version",
11 Short: "shows packr version",
1212 RunE: func(cmd *cobra.Command, args []string) error {
13 fmt.Print(packr.Version)
13 fmt.Println(packr.Version)
1414 return nil
1515 },
1616 }
88 // Pointer is a resolvr which resolves
99 // a file from a different box.
1010 type Pointer struct {
11 ForwardBox string
12 ForwardPath string
11 ForwardBox string
12 ForwardPath string
1313 }
1414
1515 var _ resolver.Resolver = Pointer{}
1414
1515 b2 := New("b2", "")
1616 b2.SetResolver("bar.txt", &Pointer{
17 ForwardBox: "b1",
18 ForwardPath: "foo.txt",
17 ForwardBox: "b1",
18 ForwardPath: "foo.txt",
1919 })
2020
2121 s, err := b2.FindString("bar.txt")
00 package packr
11
22 // Version of Packr
3 const Version = "v2.5.1"
3 const Version = "v2.8.1"
00 package packr
11
2 const Version = "v1.30.1"
2 const Version = "v2.5.3"