Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/njkleiner/go-expandstrict
go-expandstrict is a replacement for os.Expand that returns an error if any of the variables to be expanded are undefined.
https://github.com/njkleiner/go-expandstrict
golang
Last synced: 20 days ago
JSON representation
go-expandstrict is a replacement for os.Expand that returns an error if any of the variables to be expanded are undefined.
- Host: GitHub
- URL: https://github.com/njkleiner/go-expandstrict
- Owner: njkleiner
- License: mit
- Created: 2020-12-24T13:27:28.000Z (about 4 years ago)
- Default Branch: develop
- Last Pushed: 2020-12-29T21:11:47.000Z (about 4 years ago)
- Last Synced: 2024-05-20T23:26:55.259Z (8 months ago)
- Topics: golang
- Language: Go
- Homepage:
- Size: 3.91 KB
- Stars: 0
- Watchers: 1
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE.md
Awesome Lists containing this project
README
# go-expandstrict
[![godoc](https://godocs.io/github.com/njkleiner/go-expandstrict?status.svg)](https://godocs.io/github.com/njkleiner/go-expandstrict)
A replacement for [`os.Expand`](https://golang.org/pkg/os/#Expand) that returns an error if any of the variables to be expanded are undefined.
## Install
`$ go get github.com/njkleiner/go-expandstrict`
## Usage
```go
package exampleimport (
"fmt"
"os""github.com/njkleiner/go-expandstrict"
)func Example() {
exp, err := expandstrict.Expand("Hello, is anybody $HOME?", os.Getenv)if err != nil {
// $HOME is undefined
panic(err)
}fmt.Printf("expanded: %s", exp)
}
```## Contributing
You can contribute to this project by [sending patches](https://git-send-email.io) to `[email protected]`. Pull Requests are also welcome.
## Authors
* [Noah Kleiner](https://github.com/njkleiner)
See also the list of [contributors](https://github.com/njkleiner/go-expandstrict/contributors) who participated in this project.
## License
This project is licensed under the MIT License. See the [LICENSE.md](LICENSE.md) file for details.