From 9b9b72922ddd370c409da123a59803e7436284c1 Mon Sep 17 00:00:00 2001 From: Mark Bates Date: Wed, 20 Nov 2019 21:50:35 -0500 Subject: [PATCH 1/9] the killing curse --- .github/workflows/release.yml | 28 ++++++++++++++++++++ .github/workflows/tests.yml | 22 ++++++++++++++++ .goreleaser.yml | 49 +++++++++++++++++++---------------- .goreleaser.yml.plush | 30 --------------------- azure-pipelines.yml | 39 ---------------------------- azure-tests.yml | 20 -------------- examples/http/pkger/go.sum | 1 + go.mod | 2 +- go.sum | 3 +-- version.go | 2 +- 10 files changed, 80 insertions(+), 116 deletions(-) create mode 100644 .github/workflows/release.yml create mode 100644 .github/workflows/tests.yml delete mode 100644 .goreleaser.yml.plush delete mode 100644 azure-pipelines.yml delete mode 100644 azure-tests.yml diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml new file mode 100644 index 0000000..787c7f5 --- /dev/null +++ b/.github/workflows/release.yml @@ -0,0 +1,28 @@ +name: Release +on: + release: + types: + - published + +jobs: + release: + name: Release + runs-on: ubuntu-latest + steps: + - + name: Set up Go 1.13 + uses: actions/setup-go@v1 + with: + go-version: 1.13 + id: go + - + name: Checkout + uses: actions/checkout@master + - + name: Run GoReleaser + env: + GITHUB_TOKEN: ${{ secrets.GORELEASER_GITHUB_TOKEN }} + uses: goreleaser/goreleaser-action@v1 + with: + version: latest + args: release --rm-dist diff --git a/.github/workflows/tests.yml b/.github/workflows/tests.yml new file mode 100644 index 0000000..e6c9cb4 --- /dev/null +++ b/.github/workflows/tests.yml @@ -0,0 +1,22 @@ +name: Tests +on: [push] +jobs: + + tests: + name: ${{matrix.os}} Tests + runs-on: ${{ matrix.os }} + strategy: + matrix: + os: [macos-latest, windows-latest, ubuntu-latest] + steps: + - name: Set up Go 1.13 + uses: actions/setup-go@v1 + with: + go-version: 1.13 + id: go + + - name: Check out code into the Go module directory + uses: actions/checkout@v1 + + - name: Test + run: go test -v -race ./... diff --git a/.goreleaser.yml b/.goreleaser.yml index 2547995..ed32ba5 100644 --- a/.goreleaser.yml +++ b/.goreleaser.yml @@ -1,33 +1,36 @@ -# Code generated by github.com/gobuffalo/release. DO NOT EDIT. -# Edit .goreleaser.yml.plush instead - +before: + hooks: + - 'go mod tidy' builds: -- - goos: - - darwin - - linux - - windows - env: - - CGO_ENABLED=0 - main: ./cmd/pkger/main.go - + - + main: ./cmd/pkger/main.go + env: + - CGO_ENABLED=0 + ldflags: + - -s -w -X "github.com/markbates/pkger.Version={{.Tag}}" +archives: + - + replacements: + '386': i386 + darwin: Darwin + linux: Linux + windows: Windows + amd64: x86_64 checksum: - name_template: 'checksums.txt' - + name_template: checksums.txt snapshot: - name_template: "{{ .Tag }}-next" - + name_template: '{{ .Tag }}-next' changelog: sort: asc filters: exclude: - '^docs:' - '^test:' - brews: -- - name: pkger - github: - owner: markbates - name: homebrew-tap - + - + name: 'pkger' + github: + owner: 'markbates' + name: 'homebrew-tap' + install: | + bin.install "pkger" diff --git a/.goreleaser.yml.plush b/.goreleaser.yml.plush deleted file mode 100644 index 6cf5c18..0000000 --- a/.goreleaser.yml.plush +++ /dev/null @@ -1,30 +0,0 @@ -builds: -- - goos: - - darwin - - linux - - windows - env: - - CGO_ENABLED=0 - main: ./cmd/pkger/main.go - -checksum: - name_template: 'checksums.txt' - -snapshot: - name_template: "{{ .Tag }}-next" - -changelog: - sort: asc - filters: - exclude: - - '^docs:' - - '^test:' -<%= if (brew) { %> -brews: -- - name: pkger - github: - owner: markbates - name: homebrew-tap -<% } %> diff --git a/azure-pipelines.yml b/azure-pipelines.yml deleted file mode 100644 index 5fe60c8..0000000 --- a/azure-pipelines.yml +++ /dev/null @@ -1,39 +0,0 @@ -variables: - GOPROXY: "https://proxy.golang.org" - GOBIN: "$(GOPATH)/bin" # Go binaries path - GOPATH: "$(system.defaultWorkingDirectory)/gopath" # Go workspace path - modulePath: "$(GOPATH)/src/github.com/$(build.repository.name)" # Path to the module"s code - -jobs: -- job: Windows - pool: - vmImage: "vs2017-win2016" - strategy: - matrix: - go 1.13 (on): - go_version: "1.13.3" - GO111MODULE: "on" - steps: - - template: azure-tests.yml - -- job: macOS - pool: - vmImage: "macOS-10.13" - strategy: - matrix: - go 1.13 (on): - go_version: "1.13.3" - GO111MODULE: "on" - steps: - - template: azure-tests.yml - -- job: Linux - pool: - vmImage: "ubuntu-16.04" - strategy: - matrix: - go 1.13 (on): - go_version: "1.13.3" - GO111MODULE: "on" - steps: - - template: azure-tests.yml diff --git a/azure-tests.yml b/azure-tests.yml deleted file mode 100644 index d06d203..0000000 --- a/azure-tests.yml +++ /dev/null @@ -1,20 +0,0 @@ -steps: - - task: GoTool@0 - inputs: - version: $(go_version) - - task: Bash@3 - inputs: - targetType: inline - script: | - mkdir -p "$(GOBIN)" - mkdir -p "$(GOPATH)/pkg" - mkdir -p "$(modulePath)" - shopt -s extglob - mv !(gopath) "$(modulePath)" - displayName: "Setup Go Workspace" - - script: | - go get github.com/gobuffalo/buffalo - go get -t -v ./... - go test -race ./... - workingDirectory: "$(modulePath)" - displayName: "Tests" diff --git a/examples/http/pkger/go.sum b/examples/http/pkger/go.sum index 3bc4a9a..d5f5cec 100644 --- a/examples/http/pkger/go.sum +++ b/examples/http/pkger/go.sum @@ -18,3 +18,4 @@ gopkg.in/yaml.v2 v2.2.2 h1:ZCJp+EgiOT7lHqUV2J862kp8Qj64Jo6az82+3Td9dZw= gopkg.in/yaml.v2 v2.2.2/go.mod h1:hI93XBmqTisBFMUTm0b8Fm+jr3Dg1NNxqwp+5A1VGuI= gopkg.in/yaml.v2 v2.2.4 h1:/eiJrUcujPVeJ3xlSWaiNi3uSVmDGBK1pDHUHAnao1I= gopkg.in/yaml.v2 v2.2.4/go.mod h1:hI93XBmqTisBFMUTm0b8Fm+jr3Dg1NNxqwp+5A1VGuI= +gopkg.in/yaml.v2 v2.2.5/go.mod h1:hI93XBmqTisBFMUTm0b8Fm+jr3Dg1NNxqwp+5A1VGuI= diff --git a/go.mod b/go.mod index 435d20f..05c6854 100644 --- a/go.mod +++ b/go.mod @@ -7,5 +7,5 @@ require ( github.com/kr/pretty v0.1.0 // indirect github.com/stretchr/testify v1.4.0 gopkg.in/check.v1 v1.0.0-20180628173108-788fd7840127 // indirect - gopkg.in/yaml.v2 v2.2.4 // indirect + gopkg.in/yaml.v2 v2.2.5 // indirect ) diff --git a/go.sum b/go.sum index 18c4e99..275f28c 100644 --- a/go.sum +++ b/go.sum @@ -18,5 +18,4 @@ gopkg.in/check.v1 v1.0.0-20180628173108-788fd7840127 h1:qIbj1fsPNlZgppZ+VLlY7N33 gopkg.in/check.v1 v1.0.0-20180628173108-788fd7840127/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0= gopkg.in/yaml.v2 v2.2.2 h1:ZCJp+EgiOT7lHqUV2J862kp8Qj64Jo6az82+3Td9dZw= gopkg.in/yaml.v2 v2.2.2/go.mod h1:hI93XBmqTisBFMUTm0b8Fm+jr3Dg1NNxqwp+5A1VGuI= -gopkg.in/yaml.v2 v2.2.4 h1:/eiJrUcujPVeJ3xlSWaiNi3uSVmDGBK1pDHUHAnao1I= -gopkg.in/yaml.v2 v2.2.4/go.mod h1:hI93XBmqTisBFMUTm0b8Fm+jr3Dg1NNxqwp+5A1VGuI= +gopkg.in/yaml.v2 v2.2.5/go.mod h1:hI93XBmqTisBFMUTm0b8Fm+jr3Dg1NNxqwp+5A1VGuI= diff --git a/version.go b/version.go index e9ec8c1..2d5c955 100644 --- a/version.go +++ b/version.go @@ -1,4 +1,4 @@ package pkger // Version of pkger -const Version = "v0.12.5" +var Version = "development" From 8f84b7462f2c2500323df72045e801d1292f4d1b Mon Sep 17 00:00:00 2001 From: Mark Bates Date: Wed, 20 Nov 2019 21:54:48 -0500 Subject: [PATCH 2/9] sum --- go.sum | 2 -- pkging/pkgtest/testdata/ref/go.sum | 1 + 2 files changed, 1 insertion(+), 2 deletions(-) diff --git a/go.sum b/go.sum index 275f28c..eb4f500 100644 --- a/go.sum +++ b/go.sum @@ -1,4 +1,3 @@ -github.com/davecgh/go-spew v1.1.0 h1:ZDRjVQ15GmhC3fiQ8ni8+OwkZQO4DARzQgrnXU1Liz8= github.com/davecgh/go-spew v1.1.0/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38= 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= @@ -12,7 +11,6 @@ github.com/pmezard/go-difflib v1.0.0/go.mod h1:iKH77koFhYxTK1pcRnkKkqfTogsbg7gZN github.com/stretchr/objx v0.1.0/go.mod h1:HFkY916IF+rwdDfMAkV7OtwuqBVzrE8GR6GFx+wExME= github.com/stretchr/testify v1.4.0 h1:2E4SXV/wtOkTonXsotYi4li6zVWxYlZuYNCXe9XRJyk= github.com/stretchr/testify v1.4.0/go.mod h1:j7eGeouHqKxXV5pUuKE4zz7dFj8WfuZ+81PSLYec5m4= -gopkg.in/check.v1 v0.0.0-20161208181325-20d25e280405 h1:yhCVgyC4o1eVCa2tZl7eS0r+SDo693bJlVdllGtEeKM= gopkg.in/check.v1 v0.0.0-20161208181325-20d25e280405/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0= gopkg.in/check.v1 v1.0.0-20180628173108-788fd7840127 h1:qIbj1fsPNlZgppZ+VLlY7N33q108Sa+fhmuc+sWQYwY= gopkg.in/check.v1 v1.0.0-20180628173108-788fd7840127/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0= diff --git a/pkging/pkgtest/testdata/ref/go.sum b/pkging/pkgtest/testdata/ref/go.sum index befa6e2..a243cab 100644 --- a/pkging/pkgtest/testdata/ref/go.sum +++ b/pkging/pkgtest/testdata/ref/go.sum @@ -17,3 +17,4 @@ gopkg.in/check.v1 v1.0.0-20180628173108-788fd7840127/go.mod h1:Co6ibVJAznAaIkqp8 gopkg.in/yaml.v2 v2.2.2/go.mod h1:hI93XBmqTisBFMUTm0b8Fm+jr3Dg1NNxqwp+5A1VGuI= gopkg.in/yaml.v2 v2.2.4 h1:/eiJrUcujPVeJ3xlSWaiNi3uSVmDGBK1pDHUHAnao1I= gopkg.in/yaml.v2 v2.2.4/go.mod h1:hI93XBmqTisBFMUTm0b8Fm+jr3Dg1NNxqwp+5A1VGuI= +gopkg.in/yaml.v2 v2.2.5/go.mod h1:hI93XBmqTisBFMUTm0b8Fm+jr3Dg1NNxqwp+5A1VGuI= From c83687a93226a6f320d5ce591d1a767f6a0fd108 Mon Sep 17 00:00:00 2001 From: Mark Bates Date: Wed, 20 Nov 2019 21:58:48 -0500 Subject: [PATCH 3/9] copy sum too --- pkging/pkgtest/ref.go | 43 ++++++++++++++++++------------------------- 1 file changed, 18 insertions(+), 25 deletions(-) diff --git a/pkging/pkgtest/ref.go b/pkging/pkgtest/ref.go index fa421ad..a9a8dca 100644 --- a/pkging/pkgtest/ref.go +++ b/pkging/pkgtest/ref.go @@ -68,32 +68,25 @@ func newRef(root string) (*Ref, error) { return nil, err } - b, err = ioutil.ReadFile(filepath.Join(root, "go.mod")) - if err != nil { - return nil, err + for _, n := range []string{"go.mod", "go.sum"} { + b, err = ioutil.ReadFile(filepath.Join(root, n)) + if err != nil { + return nil, err + } + + f, err := os.Create(filepath.Join(dir, n)) + if err != nil { + return nil, err + } + + if _, err := f.Write(b); err != nil { + return nil, err + } + + if err := f.Close(); err != nil { + return nil, err + } } - f, err := os.Create(filepath.Join(dir, "go.mod")) - if err != nil { - return nil, err - } - - if _, err := f.Write(b); err != nil { - return nil, err - } - - if err := f.Close(); err != nil { - return nil, err - } - - // c := exec.Command("cp", "-rv", root, dir) - // fmt.Println(strings.Join(c.Args, " ")) - // c.Stdout = os.Stdout - // c.Stderr = os.Stderr - // c.Stdin = os.Stdin - // if err := c.Run(); err != nil { - // return nil, err - // } - return ref, nil } From b40b98d739a50c9e02a28024f7728f10ccaa36b4 Mon Sep 17 00:00:00 2001 From: Mark Bates Date: Wed, 20 Nov 2019 22:02:20 -0500 Subject: [PATCH 4/9] do you? --- .github/workflows/tests.yml | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/.github/workflows/tests.yml b/.github/workflows/tests.yml index e6c9cb4..402573e 100644 --- a/.github/workflows/tests.yml +++ b/.github/workflows/tests.yml @@ -19,4 +19,6 @@ jobs: uses: actions/checkout@v1 - name: Test - run: go test -v -race ./... + run: | + go mod tidy -v + go test -v -race ./... From 0b8a69abe23181ec9452e84e4f0f5436acf95980 Mon Sep 17 00:00:00 2001 From: Mark Bates Date: Thu, 21 Nov 2019 08:07:00 -0500 Subject: [PATCH 5/9] why? --- parser/parser_test.go | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/parser/parser_test.go b/parser/parser_test.go index d47e0bb..183925f 100644 --- a/parser/parser_test.go +++ b/parser/parser_test.go @@ -1,6 +1,7 @@ package parser import ( + "fmt" "os" "os/exec" "path/filepath" @@ -36,6 +37,9 @@ func Test_Parser_Ref(t *testing.T) { files, err := res.Files() r.NoError(err) + for _, f := range files { + fmt.Println(f.Path) + } r.Len(files, 25) for _, f := range files { From e611253b7b078e4764e42f4e7b533558e3af9fe1 Mon Sep 17 00:00:00 2001 From: Mark Bates Date: Thu, 21 Nov 2019 08:53:05 -0500 Subject: [PATCH 6/9] dop --- .github/workflows/tests.yml | 1 + 1 file changed, 1 insertion(+) diff --git a/.github/workflows/tests.yml b/.github/workflows/tests.yml index 402573e..e42c73d 100644 --- a/.github/workflows/tests.yml +++ b/.github/workflows/tests.yml @@ -20,5 +20,6 @@ jobs: - name: Test run: | + go get github.com/gobuffalo/buffalo go mod tidy -v go test -v -race ./... From ddc055cac41e7c9302509e38fc029c5b556a298c Mon Sep 17 00:00:00 2001 From: Mark Bates Date: Thu, 21 Nov 2019 09:02:05 -0500 Subject: [PATCH 7/9] tidy --- .github/workflows/tests.yml | 1 - parser/parser_test.go | 2 +- pkging/pkgtest/testdata/ref/web/web.go | 2 +- 3 files changed, 2 insertions(+), 3 deletions(-) diff --git a/.github/workflows/tests.yml b/.github/workflows/tests.yml index e42c73d..402573e 100644 --- a/.github/workflows/tests.yml +++ b/.github/workflows/tests.yml @@ -20,6 +20,5 @@ jobs: - name: Test run: | - go get github.com/gobuffalo/buffalo go mod tidy -v go test -v -race ./... diff --git a/parser/parser_test.go b/parser/parser_test.go index 183925f..65a0ccc 100644 --- a/parser/parser_test.go +++ b/parser/parser_test.go @@ -69,7 +69,7 @@ func Test_Parser_Ref_Include(t *testing.T) { _, err = pkgtest.LoadFiles("/", ref, disk) r.NoError(err) - res, err := Parse(ref.Info, "github.com/gobuffalo/buffalo:/app.go") + res, err := Parse(ref.Info, "github.com/stretchr/testify:/go.mod") r.NoError(err) diff --git a/pkging/pkgtest/testdata/ref/web/web.go b/pkging/pkgtest/testdata/ref/web/web.go index c63c6bd..2172d41 100644 --- a/pkging/pkgtest/testdata/ref/web/web.go +++ b/pkging/pkgtest/testdata/ref/web/web.go @@ -7,7 +7,7 @@ import ( ) func Serve() { - pkger.Stat("github.com/gobuffalo/buffalo:/logo.svg") + pkger.Stat("github.com/stretchr/testify:/README.md") dir := http.FileServer(pkger.Dir("/public")) http.ListenAndServe(":3000", dir) } From 2560bdca09dfff3e06380ef3712c5a0cc986e684 Mon Sep 17 00:00:00 2001 From: Mark Bates Date: Thu, 21 Nov 2019 11:29:00 -0500 Subject: [PATCH 8/9] in the sun --- .github/workflows/tests.yml | 1 + 1 file changed, 1 insertion(+) diff --git a/.github/workflows/tests.yml b/.github/workflows/tests.yml index 402573e..d9f4c31 100644 --- a/.github/workflows/tests.yml +++ b/.github/workflows/tests.yml @@ -20,5 +20,6 @@ jobs: - name: Test run: | + go mod download go mod tidy -v go test -v -race ./... From 32f1de1b25d27a21e8254bb37cc673b90a635e60 Mon Sep 17 00:00:00 2001 From: Mark Bates Date: Thu, 21 Nov 2019 11:31:06 -0500 Subject: [PATCH 9/9] the ship is leaking --- .github/workflows/tests.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/tests.yml b/.github/workflows/tests.yml index d9f4c31..448a848 100644 --- a/.github/workflows/tests.yml +++ b/.github/workflows/tests.yml @@ -22,4 +22,4 @@ jobs: run: | go mod download go mod tidy -v - go test -v -race ./... + go test -race ./...