Skip to content

Smaller integers cannot be marshalled into  #70

Open
@stevefan1999-personal

Description

Here's an example

type Config struct {
	Port    uint16
}

config.yml:

port: 8080
FILEWATCHER | 2022/06/11 19:46:20 adding file to watch: ./config.yml
panic: reflect.Set: value of type int is not assignable to type uint16

goroutine 1 [running]:
reflect.Value.assignTo({0x111ce80?, 0x13a84e0?, 0xc0001a4300?}, {0x1177edc, 0xb}, 0x111d7c0, 0x0)
        C:/Program Files/Go/src/reflect/value.go:3062 +0x2ac
reflect.Value.Set({0x111d7c0?, 0xc0001a4300?, 0x111ce80?}, {0x111ce80?, 0x13a84e0?, 0x111d7c0?})
        C:/Program Files/Go/src/reflect/value.go:2088 +0xeb
github.com/lalamove/konfig.(*value).setStruct(0xc00019a3f0, {0xc0001a2600, 0x4}, {0x111ce80, 0x13a84e0}, {0x1113e20?, 0xc0001a4300?, 0x30000?})
        C:/Users/steve/go/pkg/mod/github.com/lalamove/[email protected]/value.go:221 +0x34f
github.com/lalamove/konfig.(*value).setValues(0xc00019a3f0, 0xc00019a8a0?)
        C:/Users/steve/go/pkg/mod/github.com/lalamove/[email protected]/value.go:196 +0x22f
github.com/lalamove/konfig.Values.load(0xc00019a510, 0x111b440?, 0xc00019c0b0)
        C:/Users/steve/go/pkg/mod/github.com/lalamove/[email protected]/values.go:61 +0x738
github.com/lalamove/konfig.(*S).loaderLoadRetry(0xc00019c0b0, 0xc000180060, 0x0)
        C:/Users/steve/go/pkg/mod/github.com/lalamove/[email protected]/loader.go:149 +0x276
github.com/lalamove/konfig.(*S).Load(0xc00019c0b0)
        C:/Users/steve/go/pkg/mod/github.com/lalamove/[email protected]/loader.go:69 +0x74
github.com/lalamove/konfig.(*S).LoadWatch(0x1?)
        C:/Users/steve/go/pkg/mod/github.com/lalamove/[email protected]/loader.go:49 +0x1e
github.com/lalamove/konfig.LoadWatch()
        C:/Users/steve/go/pkg/mod/github.com/lalamove/[email protected]/loader.go:44 +0x1e

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions