forked from TrueCloudLab/certificates
Refactor debug utility
This commit is contained in:
parent
1c38113e44
commit
edee01c80c
4 changed files with 20 additions and 5 deletions
|
@ -10,13 +10,13 @@ import (
|
||||||
"time"
|
"time"
|
||||||
|
|
||||||
"github.com/go-chi/chi"
|
"github.com/go-chi/chi"
|
||||||
"github.com/ryboe/q"
|
|
||||||
|
|
||||||
"github.com/smallstep/certificates/acme"
|
"github.com/smallstep/certificates/acme"
|
||||||
"github.com/smallstep/certificates/api"
|
"github.com/smallstep/certificates/api"
|
||||||
"github.com/smallstep/certificates/api/render"
|
"github.com/smallstep/certificates/api/render"
|
||||||
"github.com/smallstep/certificates/authority"
|
"github.com/smallstep/certificates/authority"
|
||||||
"github.com/smallstep/certificates/authority/provisioner"
|
"github.com/smallstep/certificates/authority/provisioner"
|
||||||
|
"github.com/smallstep/certificates/utils/debug/q"
|
||||||
)
|
)
|
||||||
|
|
||||||
func link(url, typ string) string {
|
func link(url, typ string) string {
|
||||||
|
|
|
@ -26,11 +26,11 @@ import (
|
||||||
"time"
|
"time"
|
||||||
|
|
||||||
"github.com/fxamacker/cbor/v2"
|
"github.com/fxamacker/cbor/v2"
|
||||||
"github.com/smallstep/certificates/authority/provisioner"
|
|
||||||
"go.step.sm/crypto/jose"
|
"go.step.sm/crypto/jose"
|
||||||
"go.step.sm/crypto/pemutil"
|
"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
|
type ChallengeType string
|
||||||
|
|
|
@ -6,9 +6,11 @@ import (
|
||||||
"time"
|
"time"
|
||||||
|
|
||||||
"github.com/pkg/errors"
|
"github.com/pkg/errors"
|
||||||
"github.com/ryboe/q"
|
|
||||||
"github.com/smallstep/certificates/acme"
|
|
||||||
"github.com/smallstep/nosql"
|
"github.com/smallstep/nosql"
|
||||||
|
|
||||||
|
"github.com/smallstep/certificates/acme"
|
||||||
|
"github.com/smallstep/certificates/utils/debug/q"
|
||||||
)
|
)
|
||||||
|
|
||||||
type dbChallenge struct {
|
type dbChallenge struct {
|
||||||
|
|
13
utils/debug/q/debug.go
Normal file
13
utils/debug/q/debug.go
Normal 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...)
|
||||||
|
}
|
Loading…
Reference in a new issue