Skip to content

Commit 628543b

Browse files
authored
Fixes for google import. (#1102)
- Go lint findings - Use generic proto interface to simplify proto deps in conformance test.
1 parent fa6eb32 commit 628543b

File tree

4 files changed

+5
-3
lines changed

4 files changed

+5
-3
lines changed

common/types/err.go

+1-1
Original file line numberDiff line numberDiff line change
@@ -62,7 +62,7 @@ func NewErr(format string, args ...any) ref.Val {
6262
return &Err{error: fmt.Errorf(format, args...)}
6363
}
6464

65-
// NewErr creates a new Err with the provided message.
65+
// NewErrFromString creates a new Err with the provided message.
6666
// TODO: Audit the use of this function and standardize the error messages and codes.
6767
func NewErrFromString(message string) ref.Val {
6868
return &Err{error: errors.New(message)}

conformance/BUILD.bazel

+1
Original file line numberDiff line numberDiff line change
@@ -82,6 +82,7 @@ go_test(
8282
"@io_bazel_rules_go//go/runfiles",
8383
"@org_golang_google_genproto_googleapis_api//expr/v1alpha1:go_default_library",
8484
"@org_golang_google_protobuf//encoding/prototext:go_default_library",
85+
"@org_golang_google_protobuf//proto:go_default_library",
8586
"@org_golang_google_protobuf//testing/protocmp:go_default_library",
8687
],
8788
)

conformance/conformance_test.go

+2-1
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,7 @@ import (
2020
"github.com/google/go-cmp/cmp"
2121

2222
"google.golang.org/protobuf/encoding/prototext"
23+
"google.golang.org/protobuf/proto"
2324
"google.golang.org/protobuf/testing/protocmp"
2425

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

171-
func diffType(want *valuepb.Type, t *cel.Type) (string, error) {
172+
func diffType(want proto.Message, t *cel.Type) (string, error) {
172173
got, err := types.TypeToProto(t)
173174
if err != nil {
174175
return "", err

parser/parser.go

+1-1
Original file line numberDiff line numberDiff line change
@@ -167,7 +167,7 @@ func (p *parser) normalizeIdent(ctx gen.IEscapeIdentContext) (string, error) {
167167
}
168168
return unescapeIdent(ident.GetId().GetText())
169169
}
170-
return "", errors.New("Unsupported ident kind.")
170+
return "", errors.New("unsupported ident kind")
171171
}
172172

173173
// Parse converts a source input a parsed expression.

0 commit comments

Comments
 (0)