- Introduction
- Usage
- Contributing
- Reporting bugs
This project parses config files that have the same syntax as gitconfig files. It understands
multiple values configuration, and can parse included configs by include.path directions
(includeIf.*.path configuration is not supported yet).
It has no knowledge of git-specific keys and as such, does not provide any convenience methods
like config.GetUserName(). For these, look into go-gitconfig
Most of the code was copied and translated to Go from git/config.c
To load specific git config file and inherit global and system git config, using:
package main
import (
"fmt"
"log"
"github.com/jiangxin/goconfig"
)
func main() {
cfg, err := goconfig.LoadAll("")
if err != nil {
log.Fatal(err)
}
if cfg == nil {
log.Fatal("cfg is nil")
}
fmt.Printf(cfg.Get("user.name"))
}As an example, there is a full functional git config to read/write git
config file implemented by goconfig, see:
cmd/goconfig/main.go
Contributions are welcome! Fork -> Push -> Pull request.
Just create an issue! I will try to reply as soon as possible.