Hacktoberfest 2026: le issue che i maintainer hanno segnato per ottobre, aperte e adatte ai principianti. Sfoglia le issue Hacktoberfest

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

Aperta
#990 0 commenti 0 reazioni 0 assegnatari Vedi su GitHub

Nessuno ha ancora preso questa issue.

Valutazione

Difficoltà
3/5
Tempo stimato
1-2 giorni
Idoneità per principianti
65/100
Tipo di issue
Bug
Chiarezza
Specificata chiaramente
Stato di attività
Attiva
Stack tecnologico
go
Ambito
backend

Direzione di ricerca

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.

Scritto dal modello di indicizzazione a partire dal testo della issue.

Descrizione

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

Lingua principale
Go
Stelle
8k
Fork
529
Metriche di merge delle PR
Nessuna PR unita negli ultimi 30g

Guida per i contributori

Nessuna guida per i contributori indicizzata per questo repository

Come iniziare

  1. Leggi tutta la issue e poi la guida ai contributi del progetto.
  2. Commenta sulla issue per dire che te ne occupi tu — evita che due persone facciano lo stesso lavoro.
  3. Fai un fork del repository e lavora su un branch.
  4. Apri una pull request che faccia riferimento al numero della issue.

Altre issue di expr-lang/expr

Tutte le issue di expr-lang/expr

Issue simili

Altre issue su Go

Ricevi le nuove issue nella tua casella

Un breve riepilogo di issue GitHub adatte ai principianti.