Is there any way to make Go's channels behave like a stack

后端 未结 1 756
别那么骄傲
别那么骄傲 2021-01-14 04:09

Go channels by default behave like a queue as far as I can tell, first in first out. Is there any way to change them to work last in first out?

Basically I am doing

相关标签:
1条回答
  • 2021-01-14 04:53

    No, this is not possible - channels are always FIFO. You could use package container/heap.

    0 讨论(0)
提交回复
热议问题