manhattan i'm done
|
@ -1,30 +1,34 @@
|
|||
package main
|
||||
|
||||
import (
|
||||
"fmt"
|
||||
"log"
|
||||
"os"
|
||||
"os/exec"
|
||||
)
|
||||
|
||||
func main() {
|
||||
defer func() {
|
||||
clean := func() {
|
||||
c := exec.Command("go", "mod", "tidy", "-v")
|
||||
fmt.Println(c.Args)
|
||||
c.Stdout = os.Stdout
|
||||
c.Stderr = os.Stderr
|
||||
c.Stdin = os.Stdin
|
||||
c.Run()
|
||||
}()
|
||||
|
||||
root, err := New()
|
||||
if err != nil {
|
||||
log.Fatal(err)
|
||||
}
|
||||
defer clean()
|
||||
|
||||
if err := root.Route(os.Args[1:]); err != nil {
|
||||
if err := run(); err != nil {
|
||||
clean()
|
||||
log.Fatal(err)
|
||||
}
|
||||
}
|
||||
|
||||
func run() error {
|
||||
root, err := New()
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
|
||||
return root.Route(os.Args[1:])
|
||||
}
|
||||
|
||||
// does not computee
|
||||
|
|
|
@ -0,0 +1,7 @@
|
|||
module github.com/markbates/pkger/examples/app
|
||||
|
||||
go 1.12
|
||||
|
||||
require github.com/markbates/pkger v0.0.0
|
||||
|
||||
replace github.com/markbates/pkger => ../../
|
Before Width: | Height: | Size: 634 KiB After Width: | Height: | Size: 634 KiB |
Before Width: | Height: | Size: 48 MiB After Width: | Height: | Size: 48 MiB |
Before Width: | Height: | Size: 27 KiB After Width: | Height: | Size: 27 KiB |
Before Width: | Height: | Size: 62 KiB After Width: | Height: | Size: 62 KiB |
|
@ -0,0 +1,7 @@
|
|||
module github.com/markbates/pkger/examples/extfile
|
||||
|
||||
go 1.12
|
||||
|
||||
require github.com/markbates/pkger v0.0.0
|
||||
|
||||
replace github.com/markbates/pkger => ../../
|
|
@ -3,6 +3,9 @@ github.com/davecgh/go-spew v1.1.1 h1:vj9j/u1bqnvCEfJOwUhtlOARqs3+rkHYY13jYWTU97c
|
|||
github.com/davecgh/go-spew v1.1.1/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38=
|
||||
github.com/gobuffalo/here v0.2.1 h1:YWZUvrHnxNCIY2nnHPnF5Ob99Z5Iq29wHioLgcY+2G0=
|
||||
github.com/gobuffalo/here v0.2.1/go.mod h1:2a6G14FaAKOGJMK/5UNa4Og/+iyFS5cq3MnlvFR7YDk=
|
||||
github.com/kr/pretty v0.1.0/go.mod h1:dAy3ld7l9f0ibDNOQOHHMYYIIbhfbHSm3C4ZsoJORNo=
|
||||
github.com/kr/pty v1.1.1/go.mod h1:pFQYn66WHrOpPYNljwOMqo10TkYh1fy3cYio2l3bCsQ=
|
||||
github.com/kr/text v0.1.0/go.mod h1:4Jbv+DJW3UT/LiOwJeYQe1efqtUx/iVham/4vfdArNI=
|
||||
github.com/markbates/errx v1.1.0/go.mod h1:PLa46Oex9KNbVDZhKel8v1OT7hD5JZ2eI7AHhA0wswc=
|
||||
github.com/markbates/pkger/internal/examples/app v0.0.0-20190830010658-89a072f8d2d2/go.mod h1:f2mBLD6G47JQTp9vdB0Q8UJhoj96fX1cNyGTn13XG9g=
|
||||
github.com/pmezard/go-difflib v1.0.0 h1:4DBwDE0NGyQoBHbLQYPwSUPoCMWR5BEzIk/f1lZbAQM=
|
||||
|
@ -12,4 +15,5 @@ github.com/stretchr/testify v1.3.0 h1:TivCn/peBQ7UY8ooIcPgZFpTNSz0Q2U6UrFlUfqbe0
|
|||
github.com/stretchr/testify v1.3.0/go.mod h1:M5WIy9Dh21IEIfnGCwXGc5bZfKNJtfHm1UVUgZn+9EI=
|
||||
github.com/stretchr/testify v1.4.0/go.mod h1:j7eGeouHqKxXV5pUuKE4zz7dFj8WfuZ+81PSLYec5m4=
|
||||
gopkg.in/check.v1 v0.0.0-20161208181325-20d25e280405/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0=
|
||||
gopkg.in/check.v1 v1.0.0-20180628173108-788fd7840127/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0=
|
||||
gopkg.in/yaml.v2 v2.2.2/go.mod h1:hI93XBmqTisBFMUTm0b8Fm+jr3Dg1NNxqwp+5A1VGuI=
|
|
@ -0,0 +1,7 @@
|
|||
module github.com/markbates/pkger/examples/httpserver
|
||||
|
||||
go 1.12
|
||||
|
||||
require github.com/markbates/pkger v0.0.0
|
||||
|
||||
replace github.com/markbates/pkger => ../../
|
|
@ -0,0 +1,7 @@
|
|||
module github.com/markbates/pkger/examples/walk
|
||||
|
||||
go 1.12
|
||||
|
||||
require github.com/markbates/pkger v0.0.0
|
||||
|
||||
replace github.com/markbates/pkger => ../../
|
|
@ -1,7 +0,0 @@
|
|||
module github.com/markbates/pkger/internal/examples/app
|
||||
|
||||
go 1.12
|
||||
|
||||
require github.com/markbates/pkger v0.0.0
|
||||
|
||||
replace github.com/markbates/pkger => ../../../
|
|
@ -1,7 +0,0 @@
|
|||
module github.com/markbates/pkger/internal/examples/extfile
|
||||
|
||||
go 1.12
|
||||
|
||||
require github.com/markbates/pkger v0.0.0
|
||||
|
||||
replace github.com/markbates/pkger => ../../../
|
|
@ -1,7 +0,0 @@
|
|||
module github.com/markbates/pkger/internal/examples/httpserver
|
||||
|
||||
go 1.12
|
||||
|
||||
require github.com/markbates/pkger v0.0.0
|
||||
|
||||
replace github.com/markbates/pkger => ../../../
|
|
@ -1,7 +0,0 @@
|
|||
module github.com/markbates/pkger/internal/examples/walk
|
||||
|
||||
go 1.12
|
||||
|
||||
require github.com/markbates/pkger v0.0.0
|
||||
|
||||
replace github.com/markbates/pkger => ../../../
|
|
@ -10,28 +10,10 @@ import (
|
|||
)
|
||||
|
||||
func Test_Parser(t *testing.T) {
|
||||
// unsure why, but it seems the gproxy
|
||||
// has trouble handing this request.
|
||||
// finding github.com/markbates/pkger v0.0.0
|
||||
// github.com/markbates/pkger@v0.0.0: unexpected status (https://proxy.golang.org/github.com/markbates/pkger/@v/v0.0.0.info): 410 Gone
|
||||
// turning it off works just fine, so this
|
||||
// might be a bug.
|
||||
// module github.com/markbates/pkger/internal/examples/app
|
||||
//
|
||||
// go 1.12
|
||||
//
|
||||
// require github.com/markbates/pkger v0.0.0-20190803203656-a4a55a52dc5d
|
||||
// const env = "GOPROXY"
|
||||
// prxy := os.Getenv(env)
|
||||
// os.Setenv(env, "")
|
||||
// defer func() {
|
||||
// os.Setenv(env, prxy)
|
||||
// }()
|
||||
|
||||
r := require.New(t)
|
||||
pwd, err := os.Getwd()
|
||||
r.NoError(err)
|
||||
r.NoError(os.Chdir(filepath.Join("..", "internal", "examples", "app")))
|
||||
r.NoError(os.Chdir(filepath.Join("..", "examples", "app")))
|
||||
defer os.Chdir(pwd)
|
||||
|
||||
res, err := Parse("")
|
||||
|
@ -39,17 +21,17 @@ func Test_Parser(t *testing.T) {
|
|||
r.NoError(err)
|
||||
|
||||
exp := []string{
|
||||
"github.com/markbates/pkger/internal/examples/app:/",
|
||||
"github.com/markbates/pkger/internal/examples/app:/public",
|
||||
"github.com/markbates/pkger/internal/examples/app:/templates",
|
||||
"github.com/markbates/pkger/internal/examples/app:/templates/a.txt",
|
||||
"github.com/markbates/pkger/internal/examples/app:/templates/b",
|
||||
"github.com/markbates/pkger/internal/examples/app:/public/images/mark-small.png",
|
||||
"github.com/markbates/pkger/internal/examples/app:/public/images",
|
||||
"github.com/markbates/pkger/internal/examples/app:/public/images/mark.png",
|
||||
"github.com/markbates/pkger/internal/examples/app:/public/images/mark_250px.png",
|
||||
"github.com/markbates/pkger/internal/examples/app:/public/images/mark_400px.png",
|
||||
"github.com/markbates/pkger/internal/examples/app:/public/index.html",
|
||||
"github.com/markbates/pkger/examples/app:/",
|
||||
"github.com/markbates/pkger/examples/app:/public",
|
||||
"github.com/markbates/pkger/examples/app:/templates",
|
||||
"github.com/markbates/pkger/examples/app:/templates/a.txt",
|
||||
"github.com/markbates/pkger/examples/app:/templates/b",
|
||||
"github.com/markbates/pkger/examples/app:/public/images/mark-small.png",
|
||||
"github.com/markbates/pkger/examples/app:/public/images",
|
||||
"github.com/markbates/pkger/examples/app:/public/images/mark.png",
|
||||
"github.com/markbates/pkger/examples/app:/public/images/mark_250px.png",
|
||||
"github.com/markbates/pkger/examples/app:/public/images/mark_400px.png",
|
||||
"github.com/markbates/pkger/examples/app:/public/index.html",
|
||||
}
|
||||
sort.Strings(exp)
|
||||
|
||||
|
|