Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Make Set() able to re-write nil type with map or array #24

Open
wants to merge 4 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
17 changes: 3 additions & 14 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,19 +1,8 @@
# Config [![wercker status](https://app.wercker.com/status/b4e8561d9a711afcb016bf0018e83897/s/ "wercker status")](https://app.wercker.com/project/bykey/b4e8561d9a711afcb016bf0018e83897) [![GoDoc](https://godoc.org/github.com/olebedev/config?status.png)](https://godoc.org/github.com/olebedev/config)
# Config [![GoDoc](https://godoc.org/github.com/rusriver/config?status.png)](https://godoc.org/github.com/rusriver/config)

Package config provides convenient access methods to configuration
stored as JSON or YAML.

This is a fork of the [original version](https://github.com/moraes/config).
This version extends the functionality of the original without losing compatibility.
Major features added:
This is a fork of the A fork of [olebedev/config](https://github.com/olebedev/config),
which in turn is a fork of [original version](https://github.com/moraes/config).

- [`Set(path string, value interface{}) error`](http://godoc.org/github.com/olebedev/config#Config.Set) method
- [`Env() *config.Config`](http://godoc.org/github.com/olebedev/config#Config.Env) method, for OS environment variables parsing
- [`Flag() *config.Config`](http://godoc.org/github.com/olebedev/config#Config.Flag) method, for command line arguments parsing usign pkg/flag singleton
- [`Args(args ...string) *config.Config`](http://godoc.org/github.com/olebedev/config#Config.Args) method, for command line arguments parsing
- [`U*`](https://godoc.org/github.com/olebedev/config#Config.UBool) methods
- [`Copy(...path) (*config.config, error)`](https://godoc.org/github.com/olebedev/config#Config.Copy) method
- [`Extend(*config.Config) (*config.Config, error)`](https://godoc.org/github.com/olebedev/config#Config.Extend) method
- [`Error() error`](https://godoc.org/github.com/olebedev/config#Config.Error) method to show last parsing error, works only with `.Args()` method

Example and more information you can find [here](http://godoc.org/github.com/olebedev/config).
2 changes: 1 addition & 1 deletion config.go
Original file line number Diff line number Diff line change
Expand Up @@ -509,7 +509,7 @@ func Set(cfg interface{}, path string, value interface{}) error {
c[part] = value
} else {
// if exists just pick the pointer
if va, ok := c[part]; ok {
if va, ok := c[part]; ok && va != nil {
point = &va
} else {
// is next part slice or map?
Expand Down