ochinchina / go-ini Goto Github PK
View Code? Open in Web Editor NEWparser for a microsoft .ini format file & java .properties file in golang
License: MIT License
parser for a microsoft .ini format file & java .properties file in golang
License: MIT License
The .ini file and the java .properties file are similar.
In the .properties file, no section concept and we can regard that all the keys are defined in an implicit section like "global".
Hope this library can support java .properties file loading also.
原本是:
[mgo]
user = test
servers=127.0.0.1:27017/uri=admin?replicaSet=mgset-5574815
ini.Load()
后,在打印出来是:
[mgo]
user = test
servers=127.0.0.1\:27017/uri=admin?replicaSet\=mgset-5574815
另外,能不能提供一个获取k-v map的方法(类似这样):
cfg := ini.Load("some.ini")
mgo := cfg.Section("mgo").Map() // return map[string]string
Think below ini case:
section.Add( "command", "bash -c 'echo 1234; sleep 1'" )
;
will become \;
after write to ini file.
Since the ;
already quoted, it no need to be escaped.
https://github.com/ochinchina/go-ini/blob/master/loader.go#L111
There maybe environment variable in the value of a key, for example:
[section1]
key1=this is a environment variable ${VALUE:-test}
in the above example, the value of key "key1" contains a environment variable "VALUE" and it will be replaced with the environment "VALUE". If there is no environment variable "VALUE", its value will be replaced with the default value "test".
if the value of a key includes some non printable character, when writing them to a .ini file, the go-ini does not escape these non printable char.
A declarative, efficient, and flexible JavaScript library for building user interfaces.
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google ❤️ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.