Skip to content

Cobra pull a lot of dependencies through viper #1138

@MichaelMure

Description

@MichaelMure

When using Cobra in a project, a lot of dependencies are added that are not actually useful for that project. Those comes through viper, which is used in cobra/cmd, that is a CLI tool only useful occasionally for the developer.

github.com/spf13/viper@v1.4.0 github.com/armon/consul-api@v0.0.0-20180202201655-eb2c6b5be1b6
github.com/spf13/viper@v1.4.0 github.com/coreos/bbolt@v1.3.2
github.com/spf13/viper@v1.4.0 github.com/coreos/etcd@v3.3.10+incompatible
github.com/spf13/viper@v1.4.0 github.com/coreos/go-semver@v0.2.0
github.com/spf13/viper@v1.4.0 github.com/coreos/go-systemd@v0.0.0-20190321100706-95778dfbb74e
github.com/spf13/viper@v1.4.0 github.com/coreos/pkg@v0.0.0-20180928190104-399ea9e2e55f
github.com/spf13/viper@v1.4.0 github.com/dgrijalva/jwt-go@v3.2.0+incompatible
github.com/spf13/viper@v1.4.0 github.com/fsnotify/fsnotify@v1.4.7
github.com/spf13/viper@v1.4.0 github.com/gogo/protobuf@v1.2.1
github.com/spf13/viper@v1.4.0 github.com/golang/groupcache@v0.0.0-20190129154638-5b532d6fd5ef
github.com/spf13/viper@v1.4.0 github.com/google/btree@v1.0.0
github.com/spf13/viper@v1.4.0 github.com/gorilla/websocket@v1.4.0
github.com/spf13/viper@v1.4.0 github.com/grpc-ecosystem/go-grpc-middleware@v1.0.0
github.com/spf13/viper@v1.4.0 github.com/grpc-ecosystem/go-grpc-prometheus@v1.2.0
github.com/spf13/viper@v1.4.0 github.com/grpc-ecosystem/grpc-gateway@v1.9.0
github.com/spf13/viper@v1.4.0 github.com/hashicorp/hcl@v1.0.0
github.com/spf13/viper@v1.4.0 github.com/jonboulle/clockwork@v0.1.0
github.com/spf13/viper@v1.4.0 github.com/magiconair/properties@v1.8.0
github.com/spf13/viper@v1.4.0 github.com/mitchellh/mapstructure@v1.1.2
github.com/spf13/viper@v1.4.0 github.com/pelletier/go-toml@v1.2.0
github.com/spf13/viper@v1.4.0 github.com/prometheus/client_golang@v0.9.3
github.com/spf13/viper@v1.4.0 github.com/soheilhy/cmux@v0.1.4
github.com/spf13/viper@v1.4.0 github.com/spf13/afero@v1.1.2
github.com/spf13/viper@v1.4.0 github.com/spf13/cast@v1.3.0
github.com/spf13/viper@v1.4.0 github.com/spf13/jwalterweatherman@v1.0.0
github.com/spf13/viper@v1.4.0 github.com/spf13/pflag@v1.0.3
github.com/spf13/viper@v1.4.0 github.com/stretchr/testify@v1.2.2
github.com/spf13/viper@v1.4.0 github.com/tmc/grpc-websocket-proxy@v0.0.0-20190109142713-0ad062ec5ee5
github.com/spf13/viper@v1.4.0 github.com/ugorji/go@v1.1.4
github.com/spf13/viper@v1.4.0 github.com/xiang90/probing@v0.0.0-20190116061207-43a291ad63a2
github.com/spf13/viper@v1.4.0 github.com/xordataexchange/crypt@v0.0.3-0.20170626215501-b2862e3d0a77
github.com/spf13/viper@v1.4.0 go.etcd.io/bbolt@v1.3.2
github.com/spf13/viper@v1.4.0 go.uber.org/atomic@v1.4.0
github.com/spf13/viper@v1.4.0 go.uber.org/multierr@v1.1.0
github.com/spf13/viper@v1.4.0 go.uber.org/zap@v1.10.0
github.com/spf13/viper@v1.4.0 golang.org/x/net@v0.0.0-20190522155817-f3200d17e092
github.com/spf13/viper@v1.4.0 golang.org/x/time@v0.0.0-20190308202827-9d24e82272b4
github.com/spf13/viper@v1.4.0 google.golang.org/grpc@v1.21.0
github.com/spf13/viper@v1.4.0 gopkg.in/yaml.v2@v2.2.2

Those are quite heavy dependencies: Etcd, systemd, protobuf, prometheus, websocket, GRPC ...

Could you add a secondary go.mod file in the /cobra folder ? This would segregate those deps into the CLI tool and avoid having all that in a project using Cobra without Viper.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions