Refactor debug utility

This commit is contained in:
Herman Slatman 2023-01-26 13:41:01 +01:00
parent 1c38113e44
commit edee01c80c
No known key found for this signature in database
GPG key ID: F4D8A44EA0A75A4F
4 changed files with 20 additions and 5 deletions

View file

@ -10,13 +10,13 @@ import (
"time"
"github.com/go-chi/chi"
"github.com/ryboe/q"
"github.com/smallstep/certificates/acme"
"github.com/smallstep/certificates/api"
"github.com/smallstep/certificates/api/render"
"github.com/smallstep/certificates/authority"
"github.com/smallstep/certificates/authority/provisioner"
"github.com/smallstep/certificates/utils/debug/q"
)
func link(url, typ string) string {

View file

@ -26,11 +26,11 @@ import (
"time"
"github.com/fxamacker/cbor/v2"
"github.com/smallstep/certificates/authority/provisioner"
"go.step.sm/crypto/jose"
"go.step.sm/crypto/pemutil"
"github.com/ryboe/q"
"github.com/smallstep/certificates/authority/provisioner"
"github.com/smallstep/certificates/utils/debug/q"
)
type ChallengeType string

View file

@ -6,9 +6,11 @@ import (
"time"
"github.com/pkg/errors"
"github.com/ryboe/q"
"github.com/smallstep/certificates/acme"
"github.com/smallstep/nosql"
"github.com/smallstep/certificates/acme"
"github.com/smallstep/certificates/utils/debug/q"
)
type dbChallenge struct {

13
utils/debug/q/debug.go Normal file
View file

@ -0,0 +1,13 @@
package q
import (
ryboeq "github.com/ryboe/q"
)
func Q(v ...interface{}) {
// TODO(hs): do or do not call ryboeq.Q based on e.g. debug flag,
// runtime (go run vs. build), based on compiled or not. Goal would be
// to not debug in prod builds at all times. Ideally, never leave a leftover
// call to q.Q in the code, so panic if there is?
ryboeq.Q(v...)
}