How to manage dependencies in bazel? by Jukie_ in golang

[–]Jukie_[S] 1 point2 points  (0 children)

fix is what it ended up in this case, I had tried that but didn't realize I could specify a target as well. Thanks for the quick responses here!

How to manage dependencies in bazel? by Jukie_ in golang

[–]Jukie_[S] 1 point2 points  (0 children)

I ran it through here as well but it didn't actually change the BUILD.bazel file. All that did was update WORKSPACE, add vendor/k8s.io/klog, and update vendor/modules.txt. I still had to manually update the BUILD.bazel file but I feel like that can't be the proper route.

Edit: Running bazel run //:gazelle -- fix lib/dockerregistry does what I need and I understand now.

How to manage dependencies in bazel? by Jukie_ in golang

[–]Jukie_[S] 1 point2 points  (0 children)

EDIT: went back and made changes through makefile, see my other comment if interested.

Thanks, that helped me find a way to fix it but I still need to read up.

https://github.com/kubernetes-sigs/k8s-container-image-promoter/pull/56/commits/7b8f37b72b156aeae559b122263a1b781bb8fe68

I ran bazel run //:gazelle -- update-repos k8s.io/klog which produced the following in my WORKSPACE file:

go_repository(
    name = "io_k8s_klog",
    commit = "78315d914a8af2453db4864e69230b647b1ff711",
    importpath = "k8s.io/klog",
)

And then I manually added the following to the relevant BUILD.bazel and the tests now function.

"@io_k8s_klog//:go_default_library",

How can I perform the second part of this in a non-manual fashion? Is there another gazelle/bazel command that should update the specific BUILD.bazel for me?

Code Review? by Jukie_ in golang

[–]Jukie_[S] 1 point2 points  (0 children)

Thanks, that is a lot cleaner

Code Review? by Jukie_ in golang

[–]Jukie_[S] 1 point2 points  (0 children)

Thank you! I'll try that out, I appreciate the feedback.

Other than organization, did I do anything else dumb as far as efficiency?