Skip to content

Commit

Permalink
Move package celext out of internal (#56)
Browse files Browse the repository at this point in the history
Move `celext` out of internal so that `buf lint` can import this package
and load `DefaultEnv` before checking if a CEL expression compiles.
  • Loading branch information
oliversun9 committed Oct 2, 2023
1 parent e5ffd4a commit 9023bd7
Show file tree
Hide file tree
Showing 7 changed files with 6 additions and 7 deletions.
2 changes: 1 addition & 1 deletion .golangci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -67,7 +67,7 @@ issues:
- varnamelen
- unparam
- gosec
- path: internal/celext/lib.go
- path: celext/lib.go
linters:
# setting up custom functions/overloads appears duplicative (false positive)
- dupl
Expand Down
3 changes: 1 addition & 2 deletions internal/celext/lib.go → celext/lib.go
Original file line number Diff line number Diff line change
Expand Up @@ -33,8 +33,7 @@ import (
// DefaultEnv produces a cel.Env with the necessary cel.EnvOption and
// cel.ProgramOption values preconfigured for usage throughout the
// module. If useUTC is true, timestamp operations use the UTC timezone instead
// of the local timezone. If locale is non-empty, the provided locale string is
// used for string formatting, defaulting to 'en_US' if unset.
// of the local timezone.
func DefaultEnv(useUTC bool) (*cel.Env, error) {
return cel.NewEnv(
cel.Lib(lib{
Expand Down
File renamed without changes.
2 changes: 1 addition & 1 deletion internal/constraints/cache_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ import (
"testing"

"buf.build/gen/go/bufbuild/protovalidate/protocolbuffers/go/buf/validate"
"github.com/bufbuild/protovalidate-go/internal/celext"
"github.com/bufbuild/protovalidate-go/celext"
"github.com/bufbuild/protovalidate-go/internal/gen/buf/validate/conformance/cases"
"github.com/google/cel-go/cel"
"github.com/stretchr/testify/assert"
Expand Down
2 changes: 1 addition & 1 deletion internal/evaluator/builder_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ import (
"sync"
"testing"

"github.com/bufbuild/protovalidate-go/internal/celext"
"github.com/bufbuild/protovalidate-go/celext"
pb "github.com/bufbuild/protovalidate-go/internal/gen/tests/example/v1"
"github.com/stretchr/testify/assert"
"github.com/stretchr/testify/require"
Expand Down
2 changes: 1 addition & 1 deletion internal/expression/ast_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ import (
"testing"

"buf.build/gen/go/bufbuild/protovalidate/protocolbuffers/go/buf/validate"
"github.com/bufbuild/protovalidate-go/internal/celext"
"github.com/bufbuild/protovalidate-go/celext"
"github.com/google/cel-go/cel"
"github.com/stretchr/testify/assert"
"github.com/stretchr/testify/require"
Expand Down
2 changes: 1 addition & 1 deletion validator.go
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ import (
"fmt"

"buf.build/gen/go/bufbuild/protovalidate/protocolbuffers/go/buf/validate"
"github.com/bufbuild/protovalidate-go/internal/celext"
"github.com/bufbuild/protovalidate-go/celext"
"github.com/bufbuild/protovalidate-go/internal/errors"
"github.com/bufbuild/protovalidate-go/internal/evaluator"
"google.golang.org/protobuf/proto"
Expand Down

0 comments on commit 9023bd7

Please sign in to comment.