Feature Request: Types implementing "fmt.Stringer" should be assignable/comparable to strings
Nessuno ha ancora preso questa issue.
Valutazione
- Difficoltà
- 4/5
- Tempo stimato
- 3-5 giorni
- Idoneità per principianti
- 38/100
Direzione di ricerca
Riproduci l’espressione segnalata merge_request.state in ["merged", "closed"] e traccia il percorso di assignability di reflect.Value.MapIndex. Determina se il supporto per fmt.Stringer o la expr interface proposta costituisce il contratto di conversione previsto, quindi verifica che i tipi string denominati vengano confrontati correttamente senza violare le regole di tipizzazione esistenti.
Scritto dal modello di indicizzazione a partire dal testo della issue.
Descrizione
👋 Hello,
I got the following error with this expression: merge_request.state in ["merged", "closed"]
reflect.Value.MapIndex: value of type gitlab.MergeRequestState is not assignable to type string
It would be very nice if types implementing fmt.Stringer interface to be assignable to strings, or generally treated as strings.
Alternatively, a expr interface types could implement, making them capable of self-casting to various scalar types.
For reference this is the gitlab.MergeRequestState type (used in merge_request.state) implementation
type MergeRequestState string
const (
// All available
MergeRequestStateAll MergeRequestState = "all"
// In closed state
MergeRequestStateClosed MergeRequestState = "closed"
// Discussion has been locked
MergeRequestStateLocked MergeRequestState = "locked"
// Merge request has been merged
MergeRequestStateMerged MergeRequestState = "merged"
// Opened merge request
MergeRequestStateOpened MergeRequestState = "opened"
)
var AllMergeRequestState = []MergeRequestState{
MergeRequestStateAll,
MergeRequestStateClosed,
MergeRequestStateLocked,
MergeRequestStateMerged,
MergeRequestStateOpened,
}
func (e MergeRequestState) IsValid() bool {
switch e {
case MergeRequestStateAll, MergeRequestStateClosed, MergeRequestStateLocked, MergeRequestStateMerged, MergeRequestStateOpened:
return true
}
return false
}
func (e MergeRequestState) String() string {
return string(e)
}
- 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
- Leggi tutta la issue e poi la guida ai contributi del progetto.
- Commenta sulla issue per dire che te ne occupi tu — evita che due persone facciano lo stesso lavoro.
- Fai un fork del repository e lavora su un branch.
- Apri una pull request che faccia riferimento al numero della issue.
Altre issue di expr-lang/expr
-
docs needed
Difficoltà 1/5 1-3 ore Idoneità per principianti 62/100
-
`find`, `findIndex`, `first` and `get` are type-checked as the element type where they return nil Aperta
Difficoltà 3/5 1-2 giorni Idoneità per principianti 65/100
-
Release latest master branch Aperta
Difficoltà 4/5 3-5 giorni Idoneità per principianti 35/100
-
Difficoltà 5/5 Più di una settimana Idoneità per principianti 35/100
-
Difficoltà 3/5 1-2 giorni Idoneità per principianti 55/100
Tutte le issue di expr-lang/expr
Issue simili
-
Difficoltà 2/5 1-3 ore Idoneità per principianti 75/100
-
Difficoltà 2/5 1-3 ore Idoneità per principianti 70/100
-
acceptance-tests phase-coding schema-coverage testing triaged
Difficoltà 2/5 1-3 ore Idoneità per principianti 75/100
-
Difficoltà 2/5 1-3 ore Idoneità per principianti 75/100
-
Difficoltà 2/5 1-3 ore Idoneità per principianti 75/100