-
-
Notifications
You must be signed in to change notification settings - Fork 373
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
staticcheck/fakejson: don't complain about maps with generic keys
- Loading branch information
Showing
2 changed files
with
24 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
15 changes: 15 additions & 0 deletions
15
staticcheck/testdata/src/CheckUnsupportedMarshal/generics.go
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,15 @@ | ||
//go:build go1.18 | ||
|
||
package pkg | ||
|
||
import "encoding/json" | ||
|
||
type LMap[K comparable, V any] struct { | ||
M1 map[K]V | ||
M2 map[K]chan int | ||
} | ||
|
||
func (lm *LMap[K, V]) MarshalJSON() { | ||
json.Marshal(lm.M1) | ||
json.Marshal(lm.M2) // want `unsupported type` | ||
} |