代码拉取完成,页面将自动刷新
同步操作将从 ShirDon-廖显东/go配置文件解析器 强制同步,此操作会覆盖自 Fork 仓库以来所做的任何修改,且无法恢复!!!
确定后同步将在后台操作,完成时将刷新页面,请耐心等待。
//++++++++++++++++++++++++++++++++++++++++
//Fighting for great,share generate value!
//Build the best soft by golang,let's go!
//++++++++++++++++++++++++++++++++++++++++
//Author:ShirDon <http://www.shirdon.com>
//Email:hcbsts@163.com; 823923263@qq.com
//++++++++++++++++++++++++++++++++++++++++
package config
// AddSection adds a new section to the configuration.
//
// If the section is nil then uses the section by default which it's already
// created.
//
// It returns true if the new section was inserted, and false if the section
// already existed.
func (c *Config) AddSection(section string) bool {
// DEFAULT_SECTION
if section == "" {
return false
}
if _, ok := c.data[section]; ok {
return false
}
c.data[section] = make(map[string]*tValue)
// Section order
c.idSection[section] = c.lastIdSection
c.lastIdSection++
return true
}
// RemoveSection removes a section from the configuration.
// It returns true if the section was removed, and false if section did not exist.
func (c *Config) RemoveSection(section string) bool {
_, ok := c.data[section]
// Default section cannot be removed.
if !ok || section == DEFAULT_SECTION {
return false
}
for o, _ := range c.data[section] {
delete(c.data[section], o) // *value
}
delete(c.data, section)
delete(c.lastIdOption, section)
delete(c.idSection, section)
return true
}
// HasSection checks if the configuration has the given section.
// (The default section always exists.)
func (c *Config) HasSection(section string) bool {
_, ok := c.data[section]
return ok
}
// Sections returns the list of sections in the configuration.
// (The default section always exists).
func (c *Config) Sections() (sections []string) {
sections = make([]string, len(c.idSection))
pos := 0 // Position in sections
for i := 0; i < c.lastIdSection; i++ {
for section, id := range c.idSection {
if id == i {
sections[pos] = section
pos++
}
}
}
return sections
}
此处可能存在不合适展示的内容,页面不予展示。您可通过相关编辑功能自查并修改。
如您确认内容无涉及 不当用语 / 纯广告导流 / 暴力 / 低俗色情 / 侵权 / 盗版 / 虚假 / 无价值内容或违法国家有关法律法规的内容,可点击提交进行申诉,我们将尽快为您处理。