Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

net.IP values in file causes error #39

Closed
SvenDowideit opened this issue May 15, 2014 · 8 comments
Closed

net.IP values in file causes error #39

SvenDowideit opened this issue May 15, 2014 · 8 comments

Comments

@SvenDowideit
Copy link
Contributor

config error: Near line 14, key '': Near line 14: Expected a top-level item to end with a new line, comment or EOF, but got '.' instead.

related to the setInt issue

sorry, I didn't look hard at the time :/

@SvenDowideit
Copy link
Contributor Author

mmm, I think it used to work, but i'm not 100% sure.

@BurntSushi
Copy link
Owner

Could you please

@BurntSushi
Copy link
Owner

Could you please provide an example TOML document tgat reproduces the issue?

My suspicion is that your IP address is not in double quotes as a string.

@SvenDowideit
Copy link
Contributor Author

Correct, it is not in double quotes - they are printed without by

func printConfig() string {
        var buf bytes.Buffer
        e := toml.NewEncoder(&buf)
        err := e.Encode(B2D)
        if err != nil {
                return ""
        }
        return buf.String()
}

To get me and other users started, I get boot2docker to print the current config out - and I found this because I piped that output into the profile file that we then read using toml

I was going to send you a patch, but then I found some other things i needed to look into :/

@BurntSushi
Copy link
Owner

This encoder is killing me. I'm taking a look at it now.

@SvenDowideit
Copy link
Contributor Author

I'm not sure that is the root issue :/ I've given you a PR to show the problem, but what I'm thinking is that toml should either not output something if it doesn't know how to deal with it (so that it can always Decode its Encoding) or something so hyper magical its scary.

@BurntSushi
Copy link
Owner

The encoding should really work the same way that the standard library encoders do. Its case analysis over all the core types in Go. But there's some special magic involved when a type satisfies one of the encoding interfaces. net.IP falls in that category.

If the encoder is outputting bare IP addresses, then that means it's probably handling the encoding interfaces incorrectly. It should actually be a simple fix, but I'm overreacting a bit because the encoder has been a source of many bugs recently.

@SvenDowideit
Copy link
Contributor Author

awesome, merci :)

mitszo pushed a commit to accense/toml that referenced this issue Jul 19, 2016
Added @SvenDowideit's round trip test which reproduces the bug in BurntSushi#39.

Close BurntSushi#40.
ebrady pushed a commit to dvln/toml that referenced this issue Oct 24, 2016
…derscores

Accept underscores in integers
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants