Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/hexarchy/stackgo
Simple "stack" for go, p.s. it is array
https://github.com/hexarchy/stackgo
go stack
Last synced: 7 days ago
JSON representation
Simple "stack" for go, p.s. it is array
- Host: GitHub
- URL: https://github.com/hexarchy/stackgo
- Owner: HexArchy
- Created: 2024-03-14T10:08:19.000Z (10 months ago)
- Default Branch: main
- Last Pushed: 2024-03-14T11:52:15.000Z (10 months ago)
- Last Synced: 2024-11-07T08:35:25.308Z (about 2 months ago)
- Topics: go, stack
- Language: Go
- Homepage:
- Size: 5.86 KB
- Stars: 0
- Watchers: 1
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
# Stack Package
A simple thread-safe stack implementation in Go.
## Features
- Supports thread-safe operations.
- Allows pushing and popping elements of any type onto the stack.## Installation
To use this package in your Go module, run:
```sh
go get github.com/17HIERARCH70/stackGo
```## Usage
```go
package mainimport (
"fmt"
"github.com/yourusername/stack"
)func main() {
// Create a new stack
s := stack.NewStack()// Push elements onto the stack
s.Push(1)
s.Push("hello")
s.Push(3.14)// Pop elements from the stack
val, err := s.Pop()
if err != nil {
fmt.Println("Error:", err)
} else {
fmt.Println("Popped value:", val)
}
}
```## Contributing
Contributions are welcome! If you find any bugs or want to add new features, feel free to open an issue or submit a pull request.