Some feedback:
Instead of errors.New(emptyDataStructureMessage("stack")) use an
emptyDataError type, where it implements the error interface by adding an
Error() string method, for example:

type emptyDataError string

func (e emptyDataError) Error() string {
    return fmt.Sprintf("not empty %s expected", name)
}

Don't ignore errors like you have here as that can lead to
unexpected behavior, in your case a panic if you use those methods..
pushCommand, _ := ....


On Sun, 3 Mar 2024 at 21:25, Miss Adorable <emilygraceseville7...@gmail.com>
wrote:

> Hi! I wrote
> <https://gist.github.com/EmilyGraceSeville7cf/de6eb89986a40a5ccaa2e5d40da6cad4>
> my first data structure in Go. I wonder how idiomatic my code is to enhance
> it. Previously, I had C# and Java experience.
>
>
> --
> You received this message because you are subscribed to the Google Groups
> "golang-nuts" group.
> To unsubscribe from this group and stop receiving emails from it, send an
> email to golang-nuts+unsubscr...@googlegroups.com.
> To view this discussion on the web visit
> https://groups.google.com/d/msgid/golang-nuts/34b9d900-7571-45d1-ae75-21a021d4c75fn%40googlegroups.com
> <https://groups.google.com/d/msgid/golang-nuts/34b9d900-7571-45d1-ae75-21a021d4c75fn%40googlegroups.com?utm_medium=email&utm_source=footer>
> .
>

-- 
You received this message because you are subscribed to the Google Groups 
"golang-nuts" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to golang-nuts+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/golang-nuts/CAA38peYisEwEsTdm-8pB8UmuxaDA6rbxn2DPpSSMdvUXP1%2B7Gg%40mail.gmail.com.

Reply via email to