Code Monkey home page Code Monkey logo

goconf's People

Watchers

 avatar

goconf's Issues

Doesn't compile on the latest release

What steps will reproduce the problem?
1. goinstall goconf.googlecode.com/hg
2.
3.

What is the expected output? What do you see instead?

An installed package

What version of the product are you using? On what operating system?

Linux, amd64, 6g version 7188 release.2011-01-20 release

Please provide any additional information below.

6g -o _go_.6 get.go conf.go write.go read.go 
get.go:162: undefined: float
get.go:165: undefined: strconv.Atof
make: *** [_go_.6] Error 1
--- exit status 2
goinstall: installing goconf.googlecode.com/hg: running gomake: exit status 2

Original issue reported on code.google.com by kim.lundgren on 20 Jan 2011 at 6:38

Can't import after goinstall

I installed goconf using goinstall with the command

    goinstall goconf.googlecode.com/hg/

The install command finished without errors. Then I tried to import goconf as

    import "goconf.googlecode.com/hg"

When compiling, I get the error

    config.go:7: can't find import: goconf.googlecode.com/hg

There seems to be a problem with the name of the produced object file.

    $ ls -a /home/me/src/go/pkg/linux_386/goconf.googlecode.com/hg/
    .  ..  .a
    $

The object file has no name, just the ".a" suffix. It seems to be impossible to 
include.

This problem can of course be bypassed by going into to cloned repo's directory 
and running

    gomake install

I'm running build weekly.2011-06-23 8864 on Ubuntu 10.04 Lucid with a i386 
architecture.

Original issue reported on code.google.com by bryan.matsuo on 3 Jul 2011 at 6:38

GetError when nothing defined on a section

Not exactly an issue, more of a feature request.

In the usage example on the main page you've got:

## config file
[default]
host = something.com
port = 443
active = true
compression = off

[service-1]
compression = on

[service-2]
port = 444

## go program
c, err := conf.ReadConfigFile("something.config")
c.GetBool("default", "compression") // returns false
c.GetBool("service-1", "compression") // returns true
c.GetBool("service-2", "compression") // returns GetError

###

I don't think there's really a point in knowing if a setting comes from the 
default section or not so IMHO it would be nicer if c.GetBool("service-2", 
"compression") returned the relevant setting from the "default" section - it 
feels like it would make the code based on this package more elegant.

Original issue reported on code.google.com by [email protected] on 27 Jun 2010 at 12:15

Name cleanup

Attached is a patch with basic name cleanup as per IRC talk.

- Remove "Get" from getters.
- Remove "Config" from names.
- ConfigFile becomes just Config.

Full list:

ConfigFile -> Config
NewConfigFile -> New
ReadConfigBytes -> ReadBytes
ReadConfigFile -> ReadFile
GetBool -> Bool
GetFloat64 -> Float64
GetInt -> Int
GetOptions -> Options
GetRawString -> RawString
GetSections -> Sections
GetString -> String
WriteConfigBytes -> WriteBytes
WriteConfigFile -> WriteFile

Original issue reported on code.google.com by rodrigo.moraes on 30 Aug 2012 at 10:27

Attachments:

os.Error removed in Go 1

What steps will reproduce the problem?
1. $ go get code.google.com/p/goconf

What is the expected output? What do you see instead?
../../../code.google.com/p/goconf/get.go:38: undefined: os.Error
../../../code.google.com/p/goconf/get.go:86: undefined: os.Error
../../../code.google.com/p/goconf/get.go:108: undefined: os.Error
../../../code.google.com/p/goconf/get.go:148: undefined: os.Error
../../../code.google.com/p/goconf/get.go:162: undefined: os.Error
../../../code.google.com/p/goconf/get.go:177: undefined: os.Error
../../../code.google.com/p/goconf/read.go:13: undefined: os.Error
../../../code.google.com/p/goconf/read.go:32: undefined: os.Error
../../../code.google.com/p/goconf/read.go:45: undefined: os.Error
../../../code.google.com/p/goconf/write.go:12: undefined: os.Error
../../../code.google.com/p/goconf/write.go:12: too many errors

Patch attached produced by "go fix" and hand-changing String methods to Error, 
as per http://golang.org/doc/go1.html#errors. Also included is lots of hacking 
to make "go test" actually run. The test still fails, but I will report another 
issue, as I'm not familiar enough with the codebase to track the issue down.

Original issue reported on code.google.com by [email protected] on 29 Mar 2012 at 5:09

Attachments:

Update to Go 1

Appreciate your work. But it would be a better idea to update the code to Go 1 
compatible version.

You may use my fork here:
http://code.google.com/r/monnand-goconf/

Original issue reported on code.google.com by [email protected] on 30 Mar 2012 at 1:34

Go 1 compatable

What steps will reproduce the problem?
go get goconf.googlecode.com/hg 

What is the expected output? What do you see instead?
Import it

What version of the product are you using? On what operating system?
goconf.googlecode.com/hg: invalid Google Code import path: use 
code.google.com/p/goconf instead



Original issue reported on code.google.com by [email protected] on 24 Feb 2012 at 2:26

Subdirectory name of source code

The subdirectory where is the source code must be renamed from 'hg' to 'conf' 
to be used like

import "goconf.googlecode.com/conf"

instead of

import conf "goconf.googlecode.com/hg"

Original issue reported on code.google.com by [email protected] on 23 Jun 2010 at 12:04

Breaks on last release

Here you've sed commands to fix it:

sed 's/ExecuteString/FindString/' hg/get.go -i
sed 's/perm int/perm uint32/' hg/write.go -i

Original issue reported on code.google.com by [email protected] on 12 Aug 2010 at 8:57

GetOptions seems to be returning default section options twice

What steps will reproduce the problem?

See attached code which is simple program to walk the sections in a config file 
and list the options and their values for each section.

What is the expected output? What do you see instead?

Would expect to see the section name (default) followed by one line for the one 
option and value. Instead see two duplicate lines of the same option and value. 
Looking at the GetOptions source code, it looks like this may be intended, but 
it would not be what I would expect.

What version of the product are you using? On what operating system?

Current (May 8, 2012) of goconf, Go v1.0.2 on Windows 7 64-bit.

Please provide any additional information below.

See attached file for source code to reproduce. Note that if a config file 
doesn't exist it creates one first (also attached). Also note that even if you 
remove the section name [default] from the config file GetOptions still returns 
the host option name twice.

Original issue reported on code.google.com by jim.lehmer on 23 Sep 2012 at 6:52

Attachments:

Addition of GetInt64

I needed to be able to get an Int64 from the config file. So I simply copied 
the GetInt and made it return a int64:

// GetInt64 has the same behaviour as GetString but converts the response to 
int64.
func (c *ConfigFile) GetInt64 (section string, option string) (value int64, err 
os.Error) {
        sv, err := c.GetString(section, option)
        if err == nil {
                value, err = strconv.Atoi64(sv)
                if err != nil {
                        err = GetError{CouldNotParse, "int64", sv, section, option}
                }
        }

        return value, err
}

Just wanted to submit this so it can make it into future releases.  -- Thanks!

Original issue reported on code.google.com by [email protected] on 13 Jul 2011 at 6:02

Fixed issues with compile

With the latest weekly build of Go I first ran gofix on all *.go files.  Next I 
had to edit the get.go and replace the GetFloat function with GetFloat32 and 
GetFloat64

// GetFloat32 has the same behaviour as GetString but converts the response to 
float.
func (c *ConfigFile) GetFloat64(section string, option string) (value float64, 
err os.Error) {
    sv, err := c.GetString(section, option)
    if err == nil {
        value, err = strconv.Atof64(sv)
        if err != nil {
            err = GetError{CouldNotParse, "float 64", sv, section, option}
        }
    }

    return value, err
}

// GetFloat64 has the same behaviour as GetString but converts the response to 
float.
func (c *ConfigFile) GetFloat32(section string, option string) (value float32, 
err os.Error) {
    sv, err := c.GetString(section, option)
    if err == nil {
        value, err = strconv.Atof32(sv)
        if err != nil {
            err = GetError{CouldNotParse, "float 32", sv, section, option}
        }
    }

    return value, err
}

goconf now compiles. -- Thanks for a very promising package for go!

Original issue reported on code.google.com by [email protected] on 30 May 2011 at 2:08

Test failure in Go 1: slice bounds out of range

After applying patch from issue #18, the test suite does not pass:

$ go test

panic: runtime error: slice bounds out of range [recovered]
    panic: runtime error: slice bounds out of range

goroutine 3 [running]:
testing._func_003(0x7f8022577fa8, 0x7f8022577100, 0x7f8022577fb8, 
0x7f8022577ae0)
    /home/josh/go/src/pkg/testing/testing.go:268 +0xf3
----- stack segment boundary -----
code.google.com/p/goconf.(*ConfigFile).GetString(0xf84004e140, 0x4ec4fc, 0x9, 
0x4e5734, 0x3, ...)
    /home/josh/mygo/src/code.google.com/p/goconf/get.go:119 +0x348
code.google.com/p/goconf.TestBuild(0xf840000e00, 0x12153238)
    /home/josh/mygo/src/code.google.com/p/goconf/conf_test.go:57 +0x2ea
testing.tRunner(0xf840000e00, 0x5714d0, 0x0, 0x0)
    /home/josh/go/src/pkg/testing/testing.go:273 +0x6f
created by testing.RunTests
    /home/josh/go/src/pkg/testing/testing.go:349 +0x77c

goroutine 1 [chan receive]:
testing.RunTests(0x400c00, 0x5714d0, 0x100000001, 0x4ea401, 0xb, ...)
    /home/josh/go/src/pkg/testing/testing.go:350 +0x79f
testing.Main(0x400c00, 0x5714d0, 0x100000001, 0x5767f8, 0x0, ...)
    /home/josh/go/src/pkg/testing/testing.go:285 +0x7a
main.main()
    /tmp/go-build986806935/code.google.com/p/goconf/_test/_testmain.go:43 +0x91

goroutine 2 [syscall]:
created by runtime.main
    /home/josh/go/src/pkg/runtime/proc.c:221
exit status 2
FAIL    code.google.com/p/goconf    0.007s


It appears to be due to line 119 in get.go.

Original issue reported on code.google.com by [email protected] on 29 Mar 2012 at 5:11

  • Merged into: #12

require build on new go

What steps will reproduce the problem?
1. build on r57

What is the expected output? What do you see instead?
compilable

What version of the product are you using? On what operating system?
13:b3f4e5735324

Please provide any additional information below.
my workable patch is here
--- a/Makefile  Sun Aug 22 06:17:36 2010 -0400
+++ b/Makefile  Thu Jun 09 11:58:15 2011 +0800
@@ -1,4 +1,4 @@
-include $(GOROOT)/src/Make.$(GOARCH)
+include $(GOROOT)/src/Make.inc

 TARG=conf
 GOFILES=\
diff -r b3f4e5735324 get.go
--- a/get.go    Sun Aug 22 06:17:36 2010 -0400
+++ b/get.go    Thu Jun 09 11:58:15 2011 +0800
@@ -159,12 +159,12 @@


 // GetFloat has the same behaviour as GetString but converts the response to float.
-func (c *ConfigFile) GetFloat(section string, option string) (value float, err 
os.Error) {
+func (c *ConfigFile) GetFloat(section string, option string) (value float32, 
err os.Error) {
    sv, err := c.GetString(section, option)
    if err == nil {
-       value, err = strconv.Atof(sv)
+       value, err = strconv.Atof32(sv)
        if err != nil {
-           err = GetError{CouldNotParse, "float", sv, section, option}
+           err = GetError{CouldNotParse, "float32", sv, section, option}
        }
    }

diff -r b3f4e5735324 read.go
--- a/read.go   Sun Aug 22 06:17:36 2010 -0400
+++ b/read.go   Thu Jun 09 11:58:15 2011 +0800
@@ -13,7 +13,7 @@
 func ReadConfigFile(fname string) (c *ConfigFile, err os.Error) {
    var file *os.File

-   if file, err = os.Open(fname, os.O_RDONLY, 0); err != nil {
+   if file, err = os.Open(fname); err != nil {
        return nil, err
    }

diff -r b3f4e5735324 write.go
--- a/write.go  Sun Aug 22 06:17:36 2010 -0400
+++ b/write.go  Thu Jun 09 11:58:15 2011 +0800
@@ -12,7 +12,7 @@
 func (c *ConfigFile) WriteConfigFile(fname string, perm uint32, header string) (err os.Error) {
    var file *os.File

-   if file, err = os.Open(fname, os.O_WRONLY|os.O_CREAT|os.O_TRUNC, perm); err 
!= nil {
+   if file, err = os.Create(fname); err != nil {
        return err
    }
    if err = c.Write(file, header); err != nil {

Original issue reported on code.google.com by [email protected] on 9 Jun 2011 at 4:00

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.