Hacktoberfest 2026: những issue maintainer đã đánh dấu cho tháng Mười, đang mở và phù hợp người mới. Xem issue Hacktoberfest

`in` operator on a struct doesn't respect `expr` tags

Đang mở
#990 0 bình luận 0 reaction 0 người được giao Xem trên GitHub

Chưa có ai nhận issue này.

Đánh giá

Độ khó
3/5
Thời gian dự kiến
1-2 ngày
Mức phù hợp với người mới
65/100
Loại issue
Lỗi
Độ rõ ràng
Đặc tả rõ ràng
Mức độ hoạt động
Sôi nổi
Công nghệ
go
Lĩnh vực
backend

Hướng nghiên cứu

The issue is about the 'in' operator not respecting struct field tags. Start by examining the parser and evaluator for the 'in' operator, likely in the 'parser' and 'eval' packages. Look at how struct field access is resolved, comparing the handling of field names vs. 'expr' tags. The provided playground link shows the exact test case; run the tests in the repository to see existing behavior and add a test for this bug. Check for similar issues around struct field tag handling to understand the codebase patterns.

Do mô hình lập chỉ mục viết ra từ nội dung của issue.

Mô tả

While the documentation doesn't say that the in operator can be used on structs, it does actually work.
However it doesn't respect the expr tag and instead checks membership using the struct's go field names.

Example

With an environment built from:

type Outer struct {
	Inner map[string]struct{} `expr:"bar"`
}
type Env struct {
	Outer Outer `expr:"foo"`
}

in operator:
"bar" in foo => false
"Inner" in foo => true

Field access behaves the opposite:
foo.bar => map[]
foo.Inner => compilation error

Playground: https://go.dev/play/p/GqjjiidBOx0

Ngôn ngữ chính
Go
Star
8k
Fork
529
Chỉ số merge pull request
Không có pull request nào được merge trong 30 ngày

Hướng dẫn đóng góp

Chưa lập chỉ mục được hướng dẫn đóng góp cho kho mã nguồn này

Bắt đầu từ đâu

  1. Đọc hết issue, rồi đọc hướng dẫn đóng góp của dự án.
  2. Bình luận trên issue rằng bạn sẽ nhận — tránh hai người làm cùng một việc.
  3. Fork repository và làm thay đổi trên một nhánh.
  4. Mở pull request có tham chiếu số hiệu của issue.

Issue khác của expr-lang/expr

Tất cả issue của expr-lang/expr

Issue tương tự

Thêm issue về Go

Nhận issue mới trong hộp thư của bạn

Bản tóm tắt ngắn những issue GitHub phù hợp với người mới.