package
0.0.0-20240228044302-56ad08b2fa1c
Repository: https://github.com/parsiya/parsia-code.git
Documentation: pkg.go.dev

# README

Gophercises - 9 - Deck of Cards

Problem

Solution

Lessons Learned

Stringer package

Stringer package can generate String() for types. In this case, we can use it to make one for Suit and Value types.

  1. Add the following on top of the file with the types (in this case deck/card.go).
    //go:generate stringer -type=Suit,Value
    
  2. Run go generate inside the deck directory.
  3. It will create a file named suit_string.go.
  4. Now we can call Suit.String() and it will return a string.