#5 Saving a ircclient.IRCConfig struct to JSON file returns error

Chiuso
aperto 2 anni fa da david · 1 commenti
David Thielemann ha commentato 2 anni fa
lunar-bot: Start up...
panic: json: unsupported type: func()

goroutine 1 [running]:
log.Panic({0xc0000bdf38?, 0x572e7b?, 0xa?})
    /usr/local/go/src/log/log.go:385 +0x65
main.main()
    /home/apollo/dev/go/lunar-bot/lunar.go:105 +0x185

It was attempting to json.Marshal the OnExit function.

To mark something as ignore on marshaling and unmarshaling use `json:"-"`.

See https://stackoverflow.com/a/17306470

``` lunar-bot: Start up... panic: json: unsupported type: func() goroutine 1 [running]: log.Panic({0xc0000bdf38?, 0x572e7b?, 0xa?}) /usr/local/go/src/log/log.go:385 +0x65 main.main() /home/apollo/dev/go/lunar-bot/lunar.go:105 +0x185 ``` It was attempting to json.Marshal the OnExit function. To mark something as ignore on marshaling and unmarshaling use \``json:"-"`\`. > See [https://stackoverflow.com/a/17306470](https://stackoverflow.com/a/17306470)
Steve Thielemann referenced this issue from a commit 2 anni fa
David Thielemann ha commentato 2 anni fa
Proprietario

Tests for the win!

Tests for the win!
Sign in to join this conversation.
Nessuna milestone
Nessun assegnatario
1 Partecipanti
Caricamento...
Annulla
Salva
Non ci sono ancora contenuti.