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

Commit

Permalink
Remove github.com/markbates/oncer
Browse files Browse the repository at this point in the history
  • Loading branch information
Matthias Fasching authored and Matthias Fasching committed May 14, 2022
1 parent b1dc7c1 commit 5febe00
Show file tree
Hide file tree
Showing 5 changed files with 11 additions and 22 deletions.
2 changes: 0 additions & 2 deletions go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -22,13 +22,11 @@ require (
github.com/gorilla/mux v1.8.0
github.com/gorilla/sessions v1.2.1
github.com/markbates/grift v1.5.0
github.com/markbates/oncer v1.0.0
github.com/markbates/refresh v1.12.0
github.com/markbates/safe v1.0.1
github.com/monoculum/formam v3.5.5+incompatible
github.com/psanford/memfs v0.0.0-20210214183328-a001468d78ef
github.com/sirupsen/logrus v1.8.1
github.com/spf13/cobra v1.4.0
github.com/stretchr/testify v1.7.1
gopkg.in/alexcesaro/quotedprintable.v3 v3.0.0-20150716171945-2caba252f4dc
)
3 changes: 0 additions & 3 deletions go.sum
Original file line number Diff line number Diff line change
Expand Up @@ -338,7 +338,6 @@ github.com/luna-duclos/instrumentedsql v1.1.3/go.mod h1:9J1njvFds+zN7y85EDhN9XNQ
github.com/magiconair/properties v1.8.5/go.mod h1:y3VJvCyxH9uVvJTWEGAELF3aiYNyPKd5NZ3oSwXrF60=
github.com/markbates/grift v1.5.0 h1:CZyK0k+8BdhQMgbwzuKMysC12y4tf9H004jAs/FutX4=
github.com/markbates/grift v1.5.0/go.mod h1:1ssFm5gSGmzTkhi3Wfh/nqlU74J73TlAjoDMttQbpfY=
github.com/markbates/oncer v1.0.0 h1:E83IaVAHygyndzPimgUYJjbshhDTALZyXxvk9FOlQRY=
github.com/markbates/oncer v1.0.0/go.mod h1:Z59JA581E9GP6w96jai+TGqafHPW+cPfRxz2aSZ0mcI=
github.com/markbates/refresh v1.12.0 h1:vTgVPX4p77v26auBJhlgaTQ/adWAYSIcVYJvM63Nbpo=
github.com/markbates/refresh v1.12.0/go.mod h1:Vpwi1+q+2U1VxE7C0Ilj6r2/+TigRzQcLez6XM3bPLc=
Expand Down Expand Up @@ -819,8 +818,6 @@ google.golang.org/protobuf v1.24.0/go.mod h1:r/3tXBNzIEhYS9I1OUVjXDlt8tc493IdKGj
google.golang.org/protobuf v1.25.0/go.mod h1:9JNX74DMeImyA3h4bdi1ymwjUzf21/xIlbajtzgsN7c=
google.golang.org/protobuf v1.26.0-rc.1/go.mod h1:jlhhOSvTdKEhbULTjvd4ARK9grFBp09yW+WbY/TyQbw=
google.golang.org/protobuf v1.26.0/go.mod h1:9q0QmTI4eRPtz6boOQmLYwt+qCgq0jsYwAQnmE0givc=
gopkg.in/alexcesaro/quotedprintable.v3 v3.0.0-20150716171945-2caba252f4dc h1:2gGKlE2+asNV9m7xrywl36YYNnBG5ZQ0r/BOOxqPpmk=
gopkg.in/alexcesaro/quotedprintable.v3 v3.0.0-20150716171945-2caba252f4dc/go.mod h1:m7x9LTH6d71AHyAX77c9yqWCCa3UKHcVEj9y7hAtKDk=
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/check.v1 v1.0.0-20190902080502-41f04d3bba15 h1:YR8cESwS4TdDjEe65xsg0ogRM/Nc3DYOhEAlW+xobZo=
Expand Down
13 changes: 1 addition & 12 deletions options.go
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,6 @@ import (
"github.com/gobuffalo/pop/v6"
"github.com/gobuffalo/pop/v6/logging"
"github.com/gorilla/sessions"
"github.com/markbates/oncer"
)

// Options are used to configure and define how your application should run.
Expand All @@ -29,9 +28,7 @@ type Options struct {
// Env is the "environment" in which the App is running. Default is "development".
Env string `json:"env"`

// LogLevel defaults to "debug". Deprecated use LogLvl instead
LogLevel string `json:"log_level"`
// LogLevl defaults to logger.DebugLvl.
// LogLvl defaults to logger.DebugLvl.
LogLvl logger.Level `json:"log_lvl"`
// Logger to be used with the application. A default one is provided.
Logger Logger `json:"-"`
Expand Down Expand Up @@ -125,14 +122,6 @@ func optionsWithDefaults(opts Options) Options {
}
}

if len(opts.LogLevel) > 0 {
var err error
oncer.Deprecate(0, "github.com/gobuffalo/buffalo#Options.LogLevel", "Use github.com/gobuffalo/buffalo#Options.LogLvl instead.")
opts.LogLvl, err = logger.ParseLevel(opts.LogLevel)
if err != nil {
opts.LogLvl = logger.DebugLevel
}
}
if opts.LogLvl == 0 {
opts.LogLvl = logger.DebugLevel
}
Expand Down
6 changes: 4 additions & 2 deletions plugins.go
Original file line number Diff line number Diff line change
Expand Up @@ -6,18 +6,20 @@ import (
"os"
"os/exec"
"strings"
"sync"

"github.com/gobuffalo/buffalo/plugins"
"github.com/gobuffalo/envy"
"github.com/gobuffalo/events"
"github.com/markbates/oncer"
"github.com/markbates/safe"
)

var loadPlugins sync.Once

// LoadPlugins will add listeners for any plugins that support "events"
func LoadPlugins() error {
var errResult error
oncer.Do("events.LoadPlugins", func() {
loadPlugins.Do(func() {
// don't send plugins events during testing
if envy.Get("GO_ENV", "development") == "test" {
return
Expand Down
9 changes: 6 additions & 3 deletions plugins/plugins.go
Original file line number Diff line number Diff line change
Expand Up @@ -10,21 +10,24 @@ import (
"os/exec"
"path/filepath"
"strings"
"sync"
"time"

"github.com/gobuffalo/buffalo/plugins/plugdeps"
"github.com/gobuffalo/envy"
"github.com/gobuffalo/meta"
"github.com/markbates/oncer"
"github.com/sirupsen/logrus"
)

const timeoutEnv = "BUFFALO_PLUGIN_TIMEOUT"

var timeoutOnce sync.Once
var availableOnce sync.Once

var t = time.Second * 2

func timeout() time.Duration {
oncer.Do("plugins.timeout", func() {
timeoutOnce.Do(func() {
rawTimeout, err := envy.MustGet(timeoutEnv)
if err == nil {
if parsed, err := time.ParseDuration(rawTimeout); err == nil {
Expand Down Expand Up @@ -64,7 +67,7 @@ var _list List
// process.
func Available() (List, error) {
var err error
oncer.Do("plugins.Available", func() {
availableOnce.Do(func() {
defer func() {
if err := saveCache(); err != nil {
logrus.Error(err)
Expand Down

0 comments on commit 5febe00

Please sign in to comment.