fatih / structs

Utilities for Go structs

Home Page:http://godoc.org/github.com/fatih/structs

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Proposal: Create a map and omit nil values

ppwfx opened this issue · comments

commented

Hey,

would you accept a pull request for a method that creates a map while omitting keys with nil values?

If yes, how would you like the method to be called?

Cheers

Why do you want to omit the keys? And what's the goal? Can you show me an example map?

Hi, as I need the nil value keys to be omitted too, I thought to give an example
In TicTacToe game I have the struct Game with fields => {X1,X2,X3,X4,X5,X6,X7,X8,X9}
Each time a user moves, a new struct is saved with the moved X, to shape the game I need to iterate over the moves and find the ones that have a value set.
What I'm doing might not be a good method to build a TicTacToe but I thought that might help to get the idea

Hi,

Unfortunately, I'm archiving this project and will no longer maintaining it. For more information, please read my blog post: Taking an indefinite sabbatical from my projects.

Thanks for the feedback and contribution.