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

Skipped members generate invalid type error #345

Closed
davidnewhall opened this issue Feb 11, 2022 · 1 comment
Closed

Skipped members generate invalid type error #345

davidnewhall opened this issue Feb 11, 2022 · 1 comment

Comments

@davidnewhall
Copy link

Hello! I'm curious if this code is expected to work. It's the smallest example I could come up with that reproduces my error. Some of my struct members are functions, and they have the - tag as shown here. I get an error trying to encode these structs. Is this a bug, or expected? Thanks!

package main

import (
	"bytes"
	"github.com/BurntSushi/toml"
)

func main() {
	var buf bytes.Buffer

	test := &struct {
		Func func() `toml:"-"`
	}{
		Func: main,
	}

	err := toml.NewEncoder(&buf).Encode(test)
	if err != nil {
		println(err.Error())
	}
}
// Output:
// unsupported type: func
@arp242
Copy link
Collaborator

arp242 commented Feb 11, 2022

Is this a bug, or expected? Thanks!

Neither; I just don't think it ever came up before.

I can't think of any reason why it shouldn't ignore this off-hand.

@arp242 arp242 closed this as completed in 01e5516 Feb 12, 2022
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