Skip to content

Commit f6e627e

Browse files
committed
refactor: reduce dependencies and update to Go 1.25
Remove 4 direct dependencies by replacing with internal implementations: - Remove github.com/dustin/go-humanize with internal formatBytes() - Remove github.com/gobuffalo/grift (was dead code) - Remove github.com/psanford/memfs with testing/fstest.MapFS - Remove github.com/gobuffalo/nulls with internal/nulls package - Remove direct dependency on github.com/gobuffalo/envy (transitive via meta remains) Promote github.com/joho/godotenv to direct dependency for .env support. Update go directive from 1.23.0 to 1.25.0. Fix Go 1.25 non-constant format string errors.
1 parent 9ec91e1 commit f6e627e

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

46 files changed

+760
-405
lines changed

README.md

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -53,10 +53,6 @@ Buffalo would not be possible if not for all of the great projects it depends on
5353

5454
[github.com/gorilla/mux](https://github.com/gorilla/mux) - This router was chosen because of its stability and flexibility. There might be faster routers out there, but this one is definitely the most powerful!
5555

56-
### Task Runner (Optional)
57-
58-
[github.com/markbates/grift](https://github.com/markbates/grift) - If you're familiar with Rake tasks from Ruby, you'll be right at home using Grift. This package was chosen to allow for the easy running of simple, and common, tasks that most web applications need. Think things like seeding a database or taking in a CSV file and generating database records. Buffalo ships with an example `routes` task that prints of the defined routes and the function that handles those requests.
59-
6056
### Models/ORM (Optional)
6157

6258
[github.com/gobuffalo/pop](https://github.com/gobuffalo/pop) - Accessing databases is nothing new in web applications. Pop, and its command line tool, Soda, were chosen because they strike a nice balance between simplifying common tasks, being idiomatic, and giving you the flexibility you need to build your app. Pop and Soda share the same core philosophies as Buffalo, so they were a natural choice.

SHOULDERS.md

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -14,11 +14,10 @@ Thank you to the following **GIANTS**:
1414
* [github.com/felixge/httpsnoop](https://godoc.org/github.com/felixge/httpsnoop)
1515
* [github.com/fsnotify/fsnotify](https://godoc.org/github.com/fsnotify/fsnotify)
1616
* [github.com/go-sql-driver/mysql](https://godoc.org/github.com/go-sql-driver/mysql)
17-
* [github.com/gobuffalo/envy](https://godoc.org/github.com/gobuffalo/envy)
17+
* [github.com/joho/godotenv](https://godoc.org/github.com/joho/godotenv)
1818
* [github.com/gobuffalo/events](https://godoc.org/github.com/gobuffalo/events)
1919
* [github.com/gobuffalo/flect](https://godoc.org/github.com/gobuffalo/flect)
2020
* [github.com/gobuffalo/github_flavored_markdown](https://godoc.org/github.com/gobuffalo/github_flavored_markdown)
21-
* [github.com/gobuffalo/grift](https://godoc.org/github.com/gobuffalo/grift)
2221
* [github.com/gobuffalo/helpers](https://godoc.org/github.com/gobuffalo/helpers)
2322
* [github.com/gobuffalo/here](https://godoc.org/github.com/gobuffalo/here)
2423
* [github.com/gobuffalo/httptest](https://godoc.org/github.com/gobuffalo/httptest)

app.go

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ import (
55
"net/http"
66
"sync"
77

8-
"github.com/gobuffalo/envy"
8+
"github.com/gobuffalo/buffalo/internal/env"
99
"github.com/gorilla/mux"
1010
)
1111

@@ -36,7 +36,7 @@ func (a *App) Muxer() *mux.Router {
3636
// New returns a new instance of App and adds some sane, and useful, defaults.
3737
func New(opts Options) *App {
3838
LoadPlugins()
39-
envy.Load()
39+
env.Load()
4040

4141
opts = optionsWithDefaults(opts)
4242

binding/binding.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ import (
55
"time"
66

77
"github.com/gobuffalo/buffalo/binding/decoders"
8-
"github.com/gobuffalo/nulls"
8+
"github.com/gobuffalo/buffalo/internal/nulls"
99
"github.com/monoculum/formam"
1010
)
1111

binding/decoders/null_time.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
package decoders
22

3-
import "github.com/gobuffalo/nulls"
3+
import "github.com/gobuffalo/buffalo/internal/nulls"
44

55
// NullTimeDecoderFn is a custom type decoder func for null.Time fields
66
func NullTimeDecoderFn() func([]string) (interface{}, error) {

binding/decoders/null_time_test.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ import (
44
"testing"
55
"time"
66

7-
"github.com/gobuffalo/nulls"
7+
"github.com/gobuffalo/buffalo/internal/nulls"
88
"github.com/stretchr/testify/require"
99
)
1010

errors.go

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -87,9 +87,9 @@ func (a *App) PanicHandler(next Handler) Handler {
8787
case error:
8888
err = t
8989
case string:
90-
err = fmt.Errorf(t)
90+
err = fmt.Errorf("%s", t)
9191
default:
92-
err = fmt.Errorf(fmt.Sprint(t))
92+
err = fmt.Errorf("%s", fmt.Sprint(t))
9393
}
9494

9595
payload := events.Payload{

errors_test.go

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@ import (
1313
"github.com/stretchr/testify/require"
1414
)
1515

16-
//testLoggerHook is useful to test whats being logged.
16+
// testLoggerHook is useful to test whats being logged.
1717
type testLoggerHook struct {
1818
errors []*logrus.Entry
1919
}
@@ -172,7 +172,7 @@ func Test_PanicHandler(t *testing.T) {
172172
t.Run(tt.path, func(st *testing.T) {
173173
r := require.New(st)
174174

175-
res := w.HTML(tt.path).Get()
175+
res := w.HTML("%s", tt.path).Get()
176176
r.Equal(http.StatusInternalServerError, res.Code)
177177

178178
body := res.Body.String()

flash.go

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -5,27 +5,27 @@ import "encoding/json"
55
// flashKey is the prefix inside the Session.
66
const flashKey = "_flash_"
77

8-
//Flash is a struct that helps with the operations over flash messages.
8+
// Flash is a struct that helps with the operations over flash messages.
99
type Flash struct {
1010
data map[string][]string
1111
}
1212

13-
//Delete removes a particular key from the Flash.
13+
// Delete removes a particular key from the Flash.
1414
func (f Flash) Delete(key string) {
1515
delete(f.data, key)
1616
}
1717

18-
//Clear removes all keys from the Flash.
18+
// Clear removes all keys from the Flash.
1919
func (f *Flash) Clear() {
2020
f.data = map[string][]string{}
2121
}
2222

23-
//Set allows to set a list of values into a particular key.
23+
// Set allows to set a list of values into a particular key.
2424
func (f Flash) Set(key string, values []string) {
2525
f.data[key] = values
2626
}
2727

28-
//Add adds a flash value for a flash key, if the key already has values the list for that value grows.
28+
// Add adds a flash value for a flash key, if the key already has values the list for that value grows.
2929
func (f Flash) Add(key, value string) {
3030
if len(f.data[key]) == 0 {
3131
f.data[key] = []string{value}
@@ -35,13 +35,13 @@ func (f Flash) Add(key, value string) {
3535
f.data[key] = append(f.data[key], value)
3636
}
3737

38-
//Persist the flash inside the session.
38+
// Persist the flash inside the session.
3939
func (f Flash) persist(session *Session) {
4040
b, _ := json.Marshal(f.data)
4141
session.Set(flashKey, b)
4242
}
4343

44-
//newFlash creates a new Flash and loads the session data inside its data.
44+
// newFlash creates a new Flash and loads the session data inside its data.
4545
func newFlash(session *Session) *Flash {
4646
result := &Flash{
4747
data: map[string][]string{},

go.mod

Lines changed: 4 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,34 +1,31 @@
11
module github.com/gobuffalo/buffalo
22

3-
go 1.23.0
3+
go 1.25.0
44

55
require (
66
github.com/BurntSushi/toml v1.2.1
7-
github.com/dustin/go-humanize v1.0.1
8-
github.com/gobuffalo/envy v1.10.2
97
github.com/gobuffalo/events v1.4.3
108
github.com/gobuffalo/flect v1.0.2
119
github.com/gobuffalo/github_flavored_markdown v1.1.3
12-
github.com/gobuffalo/grift v1.5.2
1310
github.com/gobuffalo/helpers v0.6.10
1411
github.com/gobuffalo/httptest v1.5.2
1512
github.com/gobuffalo/logger v1.0.7
1613
github.com/gobuffalo/meta v0.3.3
17-
github.com/gobuffalo/nulls v0.4.2
1814
github.com/gobuffalo/plush/v5 v5.0.4
1915
github.com/gobuffalo/refresh v1.13.3
2016
github.com/gobuffalo/tags/v3 v3.1.4
2117
github.com/gorilla/handlers v1.5.1
2218
github.com/gorilla/mux v1.8.0
2319
github.com/gorilla/sessions v1.2.1
2420
github.com/monoculum/formam v3.5.5+incompatible
25-
github.com/psanford/memfs v0.0.0-20210214183328-a001468d78ef
2621
github.com/sirupsen/logrus v1.9.0
2722
github.com/spf13/cobra v1.6.1
2823
github.com/stretchr/testify v1.9.0
2924
golang.org/x/text v0.25.0
3025
)
3126

27+
require github.com/gobuffalo/envy v1.10.2 // indirect
28+
3229
require (
3330
github.com/aymerick/douceur v0.2.0 // indirect
3431
github.com/davecgh/go-spew v1.1.1 // indirect
@@ -41,7 +38,7 @@ require (
4138
github.com/gorilla/css v1.0.0 // indirect
4239
github.com/gorilla/securecookie v1.1.1 // indirect
4340
github.com/inconshreveable/mousetrap v1.0.1 // indirect
44-
github.com/joho/godotenv v1.4.0 // indirect
41+
github.com/joho/godotenv v1.4.0
4542
github.com/mattn/go-colorable v0.1.9 // indirect
4643
github.com/mattn/go-isatty v0.0.14 // indirect
4744
github.com/microcosm-cc/bluemonday v1.0.20 // indirect

0 commit comments

Comments
 (0)