pkg / rock

Create semantic version tags for your Go packages, search and discover new packages
Apache License 2.0
50 stars 8 forks source link

Reducing dependencies #6

Closed inkel closed 3 years ago

inkel commented 6 years ago

First of all: nice work! I like that you've made a tool for helping people tagging and releasing stuff.

When I downloaded the code, I couldn't help but notice that the are lots of dependencies for this:

$ go get -v github.com/pkg/rock
github.com/pkg/rock (download)
github.com/blang/semver (download)
github.com/gogits/git (download)
github.com/Unknwon/cae (download)
github.com/mitchellh/go-homedir (download)
github.com/spf13/cobra (download)
github.com/spf13/pflag (download)
github.com/spf13/viper (download)
github.com/fsnotify/fsnotify (download)
github.com/magiconair/properties (download)
github.com/mitchellh/mapstructure (download)
github.com/pelletier/go-toml (download)
github.com/spf13/afero (download)
github.com/spf13/cast (download)
github.com/spf13/jwalterweatherman (download)
Fetching https://gopkg.in/yaml.v2?go-get=1
Parsing meta tags from https://gopkg.in/yaml.v2?go-get=1 (status code 200)
get "gopkg.in/yaml.v2": found meta tag get.metaImport{Prefix:"gopkg.in/yaml.v2", VCS:"git", RepoRoot:"https://gopkg.in/yaml.v2"} at https://gopkg.in/yaml.v2?go-get=1
gopkg.in/yaml.v2 (download)
golang.org/x/sys/unix
github.com/pelletier/go-toml
github.com/magiconair/properties
github.com/mitchellh/go-homedir
github.com/Unknwon/cae
github.com/spf13/pflag
github.com/blang/semver
github.com/mitchellh/mapstructure
github.com/Unknwon/cae/tz
github.com/Unknwon/cae/zip
github.com/spf13/afero/mem
golang.org/x/text/transform
github.com/spf13/cast
golang.org/x/text/unicode/norm
github.com/spf13/jwalterweatherman
gopkg.in/yaml.v2
github.com/fsnotify/fsnotify
github.com/spf13/cobra
github.com/gogits/git
github.com/spf13/afero
github.com/spf13/viper
github.com/pkg/rock/cmd
github.com/pkg/rock

I'm not saying that's wrong, but it seemed like a lot of dependencies for such a small utility. According to go list there are 136 dependencies in the cmd directory (where the magic happens):

$ go list -f '{{len .Deps}}' ./cmd
136

So I've wondered if it wouldn't be possible to remove some dependencies, and I've identified that you are using github.com/gogits/git for all Git related operations but pushing the tag, and I went ahead and did a quick hack to remove that dependency and rely on executing git with os/exec: I've managed to remove the dependency and now go list shows 128 transitive dependencies, not much, but something.

If you are interested I can send a pull request to this repository.

Again, thanks for making this tool.