imjasonh / ideas

A place for me to file issues against myself for things I want to build when I'm bored
5 stars 0 forks source link

Pop Quiz: transitive dependency edition #105

Open imjasonh opened 2 years ago

imjasonh commented 2 years ago

Run a script inside a Go repo and show questions like:

1. This module transitively depends on github.com/google/gnostic through its direct dependency on:
  a.) cloud.google.com/api/container/v1
  b.) github.com/docker/docker
  c.) github.com/spf13/cobra
  d.) There is no transitive dependency

or

2. This module transitively depends on golang.org/x/crypto through its direct dependency on:
  a.) github.com/spf13/cobra
  b.) github.com/google/go-cmp
  c.) golang.org/x/oauth2
  d.) All of the above

After each one, say whether the answer is correct, and show the path(s) the module takes to depend on those packages.

mattmoor commented 2 years ago

FYI, depcheck shows a sample import path when it fails.

imjasonh commented 2 years ago

FYI, depcheck shows a sample import path when it fails.

Nice. If I ever do this I'll almost certainly steal gain useful inspiration from depcheck 😄

mattmoor commented 2 years ago

I go back and forth on forking it out into github.com/chainguard-dev/depcheck just so it's in its own module.

imjasonh commented 2 years ago

I go back and forth on forking it out into github.com/chainguard-dev/depcheck just so it's in its own module.

Please do! Otherwise:

1. github.com/imjasonh/popquiz depends on k8s.io/client-go because of its transitive dependency on:
  a.) knative.dev/pkg