Skip to content
This repository has been archived by the owner on Feb 24, 2024. It is now read-only.

Commit

Permalink
v0.14.3 (#1648)
Browse files Browse the repository at this point in the history
  • Loading branch information
markbates authored Apr 10, 2019
1 parent 98c7d0b commit 33305e0
Show file tree
Hide file tree
Showing 110 changed files with 880 additions and 663 deletions.
4 changes: 1 addition & 3 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -18,9 +18,7 @@ deps:
$(GO_BIN) get github.com/gobuffalo/release
$(GO_BIN) get github.com/gobuffalo/packr/v2/packr2
packr2 clean
ifeq ($(GO111MODULE),on)
$(GO_BIN) get -tags ${TAGS} -t ./...
else
ifneq ($(GO111MODULE),on)
$(GO_BIN) get -tags ${TAGS} -u -t ./...
endif
make tidy
Expand Down
2 changes: 1 addition & 1 deletion SHOULDERS.md
Original file line number Diff line number Diff line change
Expand Up @@ -81,7 +81,7 @@ Thank you to the following **GIANTS**:

* [github.com/monoculum/formam](https://godoc.org/github.com/monoculum/formam)

* [github.com/pkg/errors](https://godoc.org/github.com/pkg/errors)
* [errors](https://godoc.org/errors)

* [github.com/sirupsen/logrus](https://godoc.org/github.com/sirupsen/logrus)

Expand Down
4 changes: 2 additions & 2 deletions app.go
Original file line number Diff line number Diff line change
@@ -1,12 +1,12 @@
package buffalo

import (
"fmt"
"net/http"
"sync"

"github.com/gobuffalo/envy"
"github.com/gorilla/mux"
"github.com/pkg/errors"
)

// App is where it all happens! It holds on to options,
Expand Down Expand Up @@ -55,7 +55,7 @@ func New(opts Options) *App {
notFoundHandler := func(errorf string, code int) http.HandlerFunc {
return func(res http.ResponseWriter, req *http.Request) {
c := a.newContext(RouteInfo{}, res, req)
err := errors.Errorf(errorf, req.Method, req.URL.Path)
err := fmt.Errorf(errorf, req.Method, req.URL.Path)
a.ErrorHandlers.Get(code)(code, err, c)
}
}
Expand Down
14 changes: 8 additions & 6 deletions binding/binding.go
Original file line number Diff line number Diff line change
Expand Up @@ -3,15 +3,17 @@ package binding
import (
"encoding/json"
"encoding/xml"
"fmt"
"net/http"
"strings"
"sync"
"time"

"errors"

"github.com/gobuffalo/nulls"
"github.com/gobuffalo/x/httpx"
"github.com/monoculum/formam"
"github.com/pkg/errors"
)

// Binder takes a request and binds it to an interface.
Expand Down Expand Up @@ -85,7 +87,7 @@ func Exec(req *http.Request, value interface{}) error {
if b, ok := binders[ct]; ok {
return b(req, value)
}
return errors.Errorf("could not find a binder for %s", ct)
return fmt.Errorf("could not find a binder for %s", ct)
}

func init() {
Expand All @@ -103,7 +105,7 @@ func init() {

t, err := parseTime(vals)
if err != nil {
return ti, errors.WithStack(err)
return ti, err
}
ti.Time = t
ti.Valid = true
Expand All @@ -114,11 +116,11 @@ func init() {
sb := func(req *http.Request, i interface{}) error {
err := req.ParseForm()
if err != nil {
return errors.WithStack(err)
return err
}

if err := decoder.Decode(req.Form, i); err != nil {
return errors.WithStack(err)
return err
}
return nil
}
Expand Down Expand Up @@ -166,7 +168,7 @@ func parseTime(vals []string) (time.Time, error) {
}

if err != nil {
return t, errors.WithStack(err)
return t, err
}

return t, nil
Expand Down
8 changes: 3 additions & 5 deletions binding/file.go
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,6 @@ import (
"mime/multipart"
"net/http"
"reflect"

"github.com/pkg/errors"
)

// MaxFileMemory can be used to set the maximum size, in bytes, for files to be
Expand Down Expand Up @@ -36,10 +34,10 @@ func init() {
sb := func(req *http.Request, i interface{}) error {
err := req.ParseMultipartForm(MaxFileMemory)
if err != nil {
return errors.WithStack(err)
return err
}
if err := decoder.Decode(req.Form, i); err != nil {
return errors.WithStack(err)
return err
}

form := req.MultipartForm.File
Expand Down Expand Up @@ -68,7 +66,7 @@ func init() {
}
mf, mh, err := req.FormFile(n)
if err != nil {
return errors.WithStack(err)
return err
}
f.Set(reflect.ValueOf(File{
File: mf,
Expand Down
7 changes: 3 additions & 4 deletions binding/file_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,6 @@ import (
"github.com/gobuffalo/buffalo"
"github.com/gobuffalo/buffalo/binding"
"github.com/gobuffalo/buffalo/render"
"github.com/pkg/errors"
"github.com/stretchr/testify/require"
)

Expand All @@ -30,21 +29,21 @@ func App() *buffalo.App {
a.POST("/on-struct", func(c buffalo.Context) error {
wf := &WithFile{}
if err := c.Bind(wf); err != nil {
return errors.WithStack(err)
return err
}
return c.Render(201, render.String(wf.MyFile.Filename))
})
a.POST("/named-file", func(c buffalo.Context) error {
wf := &NamedFile{}
if err := c.Bind(wf); err != nil {
return errors.WithStack(err)
return err
}
return c.Render(201, render.String(wf.MyFile.Filename))
})
a.POST("/on-context", func(c buffalo.Context) error {
f, err := c.File("MyFile")
if err != nil {
return errors.WithStack(err)
return err
}
return c.Render(201, render.String(f.Filename))
})
Expand Down
7 changes: 4 additions & 3 deletions buffalo/cmd/destroy/resource.go
Original file line number Diff line number Diff line change
Expand Up @@ -3,13 +3,14 @@ package destroy
import (
"bufio"
"fmt"
"github.com/gobuffalo/flect"
"io/ioutil"
"os"
"path/filepath"
"strings"

"github.com/pkg/errors"
"github.com/gobuffalo/flect"

"errors"

"github.com/sirupsen/logrus"
"github.com/spf13/cobra"
Expand All @@ -34,7 +35,7 @@ var ResourceCmd = &cobra.Command{

removeTemplates(fileName)
if err := removeActions(fileName); err != nil {
return errors.WithStack(err)
return err
}

removeLocales(fileName)
Expand Down
12 changes: 6 additions & 6 deletions buffalo/cmd/dev.go
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@ package cmd

import (
"context"
"fmt"
"os"
"os/exec"
"path/filepath"
Expand All @@ -15,7 +16,6 @@ import (
"github.com/gobuffalo/genny"
"github.com/gobuffalo/meta"
"github.com/markbates/refresh/refresh"
"github.com/pkg/errors"
"github.com/sirupsen/logrus"
"github.com/spf13/cobra"
"golang.org/x/sync/errgroup"
Expand Down Expand Up @@ -72,7 +72,7 @@ This behavior can be changed in .buffalo.dev.yml file.`,

err := wg.Wait()
if err != context.Canceled {
return errors.WithStack(err)
return err
}
return nil
},
Expand All @@ -91,13 +91,13 @@ func startWebpack(ctx context.Context) error {
tool = "npm"
}
if _, err := exec.LookPath(tool); err != nil {
return errors.Errorf("no node_modules directory found, and couldn't find %s to install it with", tool)
return fmt.Errorf("no node_modules directory found, and couldn't find %s to install it with", tool)
}
cmd := exec.CommandContext(ctx, tool, "install")
cmd.Stderr = os.Stderr
cmd.Stdout = os.Stdout
if err := cmd.Run(); err != nil {
return errors.WithStack(err)
return err
}
}

Expand All @@ -115,11 +115,11 @@ func startDevServer(ctx context.Context, args []string) error {
run := genny.WetRunner(ctx)
err = run.WithNew(rg.New(&rg.Options{App: app}))
if err != nil {
return errors.WithStack(err)
return err
}

if err := run.Run(); err != nil {
return errors.WithStack(err)
return err
}
}
c := &refresh.Configuration{}
Expand Down
5 changes: 2 additions & 3 deletions buffalo/cmd/fix/dep.go
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,6 @@ import (
"github.com/gobuffalo/buffalo/runtime"
"github.com/gobuffalo/genny"
"github.com/gobuffalo/gogen"
"github.com/pkg/errors"
)

// packages to add to Gopkg.toml
Expand Down Expand Up @@ -55,15 +54,15 @@ func runDepEnsure(r *Runner) error {
if err := depRunner(args); err != nil {
// *sigh* - yeah, i know
if !strings.Contains(err.Error(), "is already in Gopkg.toml") {
return errors.WithStack(err)
return err
}
}
}

if len(upkg) > 0 {
args := []string{"ensure", "-v", "-update"}
if err := depRunner(args); err != nil {
return errors.WithStack(err)
return err
}
}

Expand Down
6 changes: 2 additions & 4 deletions buffalo/cmd/fix/deprecations.go
Original file line number Diff line number Diff line change
Expand Up @@ -6,16 +6,14 @@ import (
"io/ioutil"
"os"
"path/filepath"

"github.com/pkg/errors"
)

// DeprecrationsCheck will either log, or fix, deprecated items in the application
func DeprecrationsCheck(r *Runner) error {
fmt.Println("~~~ Checking for deprecations ~~~")
b, err := ioutil.ReadFile("main.go")
if err != nil {
return errors.WithStack(err)
return err
}
if bytes.Contains(b, []byte("app.Start")) {
r.Warnings = append(r.Warnings, "app.Start has been removed in v0.11.0. Use app.Serve Instead. [main.go]")
Expand All @@ -32,7 +30,7 @@ func DeprecrationsCheck(r *Runner) error {

b, err := ioutil.ReadFile(path)
if err != nil {
return errors.WithStack(err)
return err
}
if bytes.Contains(b, []byte("Websocket()")) {
r.Warnings = append(r.Warnings, fmt.Sprintf("buffalo.Context#Websocket has been deprecated in v0.11.0, and removed in v0.12.0. Use github.com/gorilla/websocket directly. [%s]", path))
Expand Down
3 changes: 1 addition & 2 deletions buffalo/cmd/fix/docker.go
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,6 @@ import (

"github.com/gobuffalo/buffalo/runtime"
"github.com/gobuffalo/genny"
"github.com/pkg/errors"
)

func fixDocker(r *Runner) error {
Expand All @@ -22,7 +21,7 @@ func fixDocker(r *Runner) error {
run.WithRun(func(r *genny.Runner) error {
dk, err := r.FindFile(filepath.Join(app.Root, "Dockerfile"))
if err != nil {
return errors.WithStack(err)
return err
}

ex := regexp.MustCompile(`(v[0-9.][\S]+)`)
Expand Down
8 changes: 3 additions & 5 deletions buffalo/cmd/fix/imports.go
Original file line number Diff line number Diff line change
Expand Up @@ -13,8 +13,6 @@ import (
"strings"

"golang.org/x/tools/go/ast/astutil"

"github.com/pkg/errors"
)

// ImportConverter will changes imports from a -> b
Expand All @@ -30,7 +28,7 @@ func (c ImportConverter) Process(r *Runner) error {

err := filepath.Walk(".", c.processFile)
if err != nil {
return errors.WithStack(err)
return err
}

if !r.App.WithDep {
Expand All @@ -39,7 +37,7 @@ func (c ImportConverter) Process(r *Runner) error {

b, err := ioutil.ReadFile("Gopkg.toml")
if err != nil {
return errors.WithStack(err)
return err
}

for k := range c.Data {
Expand All @@ -55,7 +53,7 @@ func (c ImportConverter) processFile(p string, info os.FileInfo, err error) erro
er := onlyRelevantFiles(p, info, err, func(p string) error {
err := c.rewriteFile(p)
if err != nil {
err = errors.WithStack(err)
err = err
}

return err
Expand Down
Loading

0 comments on commit 33305e0

Please sign in to comment.