Resolve failed on unexported fields
ggicci opened this issue · 1 comments
ggicci commented
Error Message
2021/08/14 08:59:33 http: panic serving 172.23.0.3:51146: reflect: reflect.Value.Set using value obtained using unexported field
goroutine 38 [running]:
net/http.(*conn).serve.func1(0xc00031c460)
/go/src/net/http/server.go:1824 +0x153
panic(0xdab0a0, 0xc0004011b0)
/go/src/runtime/panic.go:971 +0x499
reflect.flag.mustBeAssignableSlow(0x1b5)
/go/src/reflect/value.go:257 +0x1b9
reflect.flag.mustBeAssignable(...)
/go/src/reflect/value.go:247
reflect.Value.Set(0xdf24a0, 0xc0003f43b8, 0x1b5, 0xdf24a0, 0xc000010e30, 0x195)
/go/src/reflect/value.go:1558 +0x3b
github.com/ggicci/httpin.(*fieldResolver).resolve(0xc000190480, 0xc0000b4b00, 0x0, 0x8, 0xc0003f8cf0, 0xd73140, 0x203000)
/home/coder/go/pkg/mod/github.com/ggicci/httpin@v0.4.0/resolver.go:72 +0x68d
github.com/ggicci/httpin.(*Engine).Decode(0xc000033600, 0xc0000b4b00, 0x7f49b12b4108, 0x7f4988643720, 0x203000, 0x203000)
/home/coder/go/pkg/mod/github.com/ggicci/httpin@v0.4.0/httpin.go:88 +0x65
github.com/ggicci/httpin.NewInput.func1.1(0x1042840, 0xc0003242a0, 0xc0000b4b00)
/home/coder/go/pkg/mod/github.com/ggicci/httpin@v0.4.0/chain.go:24 +0x65
net/http.HandlerFunc.ServeHTTP(0xc000033640, 0x1042840, 0xc0003242a0, 0xc0000b4b00)
/go/src/net/http/server.go:2069 +0x44
github.com/ggicci/pebble/api.LoadCollectionOfUser.func1(0x1042840, 0xc0003242a0, 0xc0000b4800)
/home/coder/pebble/api/mwcollections.go:56 +0x9b7
net/http.HandlerFunc.ServeHTTP(0xc00000f740, 0x1042840, 0xc0003242a0, 0xc0000b4800)
/go/src/net/http/server.go:2069 +0x44
github.com/ggicci/pebble/api.LoginRequired.func1(0x1042840, 0xc0003242a0, 0xc000332900)
/home/coder/pebble/api/mwaccess.go:51 +0x569
net/http.HandlerFunc.ServeHTTP(0xc00000f758, 0x1042840, 0xc0003242a0, 0xc000332900)
/go/src/net/http/server.go:2069 +0x44
github.com/go-chi/chi.(*ChainHandler).ServeHTTP(0xc0003f2800, 0x1042840, 0xc0003242a0, 0xc000332900)
/home/coder/go/pkg/mod/github.com/go-chi/chi@v1.5.4/chain.go:31 +0x52
github.com/go-chi/chi.(*Mux).routeHTTP(0xc00007dd40, 0x1042840, 0xc0003242a0, 0xc000332900)
/home/coder/go/pkg/mod/github.com/go-chi/chi@v1.5.4/mux.go:436 +0x28b
net/http.HandlerFunc.ServeHTTP(0xc0002fd860, 0x1042840, 0xc0003242a0, 0xc000332900)
/go/src/net/http/server.go:2069 +0x44
github.com/go-chi/chi.(*Mux).ServeHTTP(0xc00007dd40, 0x1042840, 0xc0003242a0, 0xc000332900)
/home/coder/go/pkg/mod/github.com/go-chi/chi@v1.5.4/mux.go:70 +0x5ab
github.com/go-chi/chi.(*Mux).Mount.func1(0x1042840, 0xc0003242a0, 0xc000332900)
/home/coder/go/pkg/mod/github.com/go-chi/chi@v1.5.4/mux.go:311 +0x17c
net/http.HandlerFunc.ServeHTTP(0xc0000334c0, 0x1042840, 0xc0003242a0, 0xc000332900)
/go/src/net/http/server.go:2069 +0x44
github.com/go-chi/chi.(*Mux).routeHTTP(0xc00007dce0, 0x1042840, 0xc0003242a0, 0xc000332900)
/home/coder/go/pkg/mod/github.com/go-chi/chi@v1.5.4/mux.go:436 +0x28b
net/http.HandlerFunc.ServeHTTP(0xc0002fd830, 0x1042840, 0xc0003242a0, 0xc000332900)
/go/src/net/http/server.go:2069 +0x44
github.com/go-chi/chi.(*Mux).ServeHTTP(0xc00007dce0, 0x1042840, 0xc0003242a0, 0xc000332700)
/home/coder/go/pkg/mod/github.com/go-chi/chi@v1.5.4/mux.go:87 +0x331
github.com/ggicci/pebble/api.Auth.func1(0x1042840, 0xc0003242a0, 0xc000332500)
/home/coder/pebble/api/mwauth.go:86 +0x66a
net/http.HandlerFunc.ServeHTTP(0xc00040e588, 0x1042840, 0xc0003242a0, 0xc000332500)
/go/src/net/http/server.go:2069 +0x44
net/http.serverHandler.ServeHTTP(0xc0004080e0, 0x1042840, 0xc0003242a0, 0xc000332500)
/go/src/net/http/server.go:2887 +0xa3
net/http.(*conn).serve(0xc00031c460, 0x1045358, 0xc000302440)
/go/src/net/http/server.go:1952 +0x8cd
created by net/http.(*Server).Serve
/go/src/net/http/server.go:3013 +0x39b
Reproduce
type State struct {
Name string
Upstream []string
upstreamLookup []string
}
Use State
as the input structure to reproduce.