Skip to content

Commit

Permalink
Fixes for google import. (#1102)
Browse files Browse the repository at this point in the history
- Go lint findings
- Use generic proto interface to simplify proto deps in conformance
  test.
  • Loading branch information
jnthntatum authored Jan 10, 2025
1 parent fa6eb32 commit 628543b
Show file tree
Hide file tree
Showing 4 changed files with 5 additions and 3 deletions.
2 changes: 1 addition & 1 deletion common/types/err.go
Original file line number Diff line number Diff line change
Expand Up @@ -62,7 +62,7 @@ func NewErr(format string, args ...any) ref.Val {
return &Err{error: fmt.Errorf(format, args...)}
}

// NewErr creates a new Err with the provided message.
// NewErrFromString creates a new Err with the provided message.
// TODO: Audit the use of this function and standardize the error messages and codes.
func NewErrFromString(message string) ref.Val {
return &Err{error: errors.New(message)}
Expand Down
1 change: 1 addition & 0 deletions conformance/BUILD.bazel
Original file line number Diff line number Diff line change
Expand Up @@ -82,6 +82,7 @@ go_test(
"@io_bazel_rules_go//go/runfiles",
"@org_golang_google_genproto_googleapis_api//expr/v1alpha1:go_default_library",
"@org_golang_google_protobuf//encoding/prototext:go_default_library",
"@org_golang_google_protobuf//proto:go_default_library",
"@org_golang_google_protobuf//testing/protocmp:go_default_library",
],
)
Expand Down
3 changes: 2 additions & 1 deletion conformance/conformance_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@ import (
"github.com/google/go-cmp/cmp"

"google.golang.org/protobuf/encoding/prototext"
"google.golang.org/protobuf/proto"
"google.golang.org/protobuf/testing/protocmp"

valuepb "cel.dev/expr"
Expand Down Expand Up @@ -168,7 +169,7 @@ func exprValueToRefValue(adapter types.Adapter, ev *valuepb.ExprValue) (ref.Val,
return nil, errors.New("unknown ExprValue kind")
}

func diffType(want *valuepb.Type, t *cel.Type) (string, error) {
func diffType(want proto.Message, t *cel.Type) (string, error) {
got, err := types.TypeToProto(t)
if err != nil {
return "", err
Expand Down
2 changes: 1 addition & 1 deletion parser/parser.go
Original file line number Diff line number Diff line change
Expand Up @@ -167,7 +167,7 @@ func (p *parser) normalizeIdent(ctx gen.IEscapeIdentContext) (string, error) {
}
return unescapeIdent(ident.GetId().GetText())
}
return "", errors.New("Unsupported ident kind.")
return "", errors.New("unsupported ident kind")
}

// Parse converts a source input a parsed expression.
Expand Down

0 comments on commit 628543b

Please sign in to comment.