Skip to content

Getting rid of reflect2 dependency/package #501

@advancedwebdeveloper

Description

@advancedwebdeveloper

Hi.
People are experiencing compilation issues, with gollvm, when compiling Kubernetes.

The reason is in reflect2 - it a dependency of this project, in turn being a dependency of Kubernetes.

It was pretty shocking to admit that three different implementations of reflection related package exist:

https://golang.org/pkg/reflect/
Previously mentioned reflect2
https://github.com/goccy/go-reflect
.
Reflection is indeed a core feature for many programming languages.
As for the fact that json-iterator is depending on no-more-maintained sub-package - that smells like the current system design/architecture of Kubernetes, which doesn't change frequently (and farther re-design is pretty predictable) , depends on json-iterator itself only at the current stage.
I have nothing against this project - but it makes sense to split API implementations into (at least) two different Golang packages, each of which wouldn't have no common sub-dependencies/packages.

I have pinged key committers of k8s - and they pointed me into those links:

Reduce sizes of binaries #76506
Use json-iterator instead of ugorji for JSON. #48287

As for the practical side of the story - here is a list on already opened bugs:

undefined reference to 'reflect.typelinks' for gccgo and gollvm
Build kubernetes with gollvm
bugs with gollvm

Thanks to @mrVanboy - he pointed me into https://github.com/json-iterator/go/blob/master/reflect.go#L40-L41 .

Metadata

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