@@ -79,9 +79,9 @@ func (p *ConfigParser) Options(section string) ([]string, error) {
79
79
80
80
// Get returns string value for the named option.
81
81
//
82
- // Returns an error if a section does not exist
82
+ // Returns an error if a section does not exist.
83
83
// Returns an error if the option does not exist either in the section or in
84
- // the defaults
84
+ // the defaults.
85
85
func (p * ConfigParser ) Get (section , option string ) (string , error ) {
86
86
fn , ok := p .opt .converters ["string" ]
87
87
returnFunc := func (v string ) (string , error ) {
@@ -174,6 +174,11 @@ func (p *ConfigParser) Set(section, option, value string) error {
174
174
return setSection .Add (option , value )
175
175
}
176
176
177
+ // GetInt64 returns int64 representation of the named option.
178
+ //
179
+ // Returns an error if a section does not exist.
180
+ // Returns an error if the option does not exist either in the section or in
181
+ // the defaults.
177
182
func (p * ConfigParser ) GetInt64 (section , option string ) (int64 , error ) {
178
183
result , err := p .get (section , option )
179
184
if err != nil {
@@ -198,6 +203,11 @@ func (p *ConfigParser) GetInt64(section, option string) (int64, error) {
198
203
return int64 (value .(int )), nil
199
204
}
200
205
206
+ // GetFloat64 returns float64 representation of the named option.
207
+ //
208
+ // Returns an error if a section does not exist.
209
+ // Returns an error if the option does not exist either in the section or in
210
+ // the defaults.
201
211
func (p * ConfigParser ) GetFloat64 (section , option string ) (float64 , error ) {
202
212
result , err := p .get (section , option )
203
213
if err != nil {
@@ -221,6 +231,11 @@ func (p *ConfigParser) GetFloat64(section, option string) (float64, error) {
221
231
return value .(float64 ), nil
222
232
}
223
233
234
+ // GetBool returns bool representation of the named option.
235
+ //
236
+ // Returns an error if a section does not exist.
237
+ // Returns an error if the option does not exist either in the section or in
238
+ // the defaults.
224
239
func (p * ConfigParser ) GetBool (section , option string ) (bool , error ) {
225
240
result , err := p .get (section , option )
226
241
if err != nil {
@@ -245,6 +260,7 @@ func (p *ConfigParser) GetBool(section, option string) (bool, error) {
245
260
return value .(bool ), nil
246
261
}
247
262
263
+ // RemoveSection removes given section from the ConfigParser.
248
264
func (p * ConfigParser ) RemoveSection (section string ) error {
249
265
if ! p .HasSection (section ) {
250
266
return getNoSectionError (section )
@@ -254,6 +270,7 @@ func (p *ConfigParser) RemoveSection(section string) error {
254
270
return nil
255
271
}
256
272
273
+ // HasOption checks if section contains option.
257
274
func (p * ConfigParser ) HasOption (section , option string ) (bool , error ) {
258
275
var s * Section
259
276
if p .isDefaultSection (section ) {
@@ -268,6 +285,7 @@ func (p *ConfigParser) HasOption(section, option string) (bool, error) {
268
285
return err == nil , nil
269
286
}
270
287
288
+ // RemoveOption removes option from the section.
271
289
func (p * ConfigParser ) RemoveOption (section , option string ) error {
272
290
var s * Section
273
291
if p .isDefaultSection (section ) {
0 commit comments