Skip to content

Move to go modules聽#625

Closed
Closed

Description

@markmandel

Apparently Go Modules are a thing now 馃槃 and where Go is headingin the near future (1.13 I think they will be default).

We should convert over from dep to the modules at some point in the future.

Activity

  1. added
    kind/cleanupRefactoring code, fixing up documentation, etc
    area/build-toolsDevelopment tooling. I.e. pretty much everything in the `build` directory.
    help wantedWe would love help on these issues. Please come help us!
    on Feb 26, 2019
  2. heartrobotninja commented on Feb 26, 2019

    @heartrobotninja
    Contributor

    I will be working on this shortly.

  3. aLekSer commented on Feb 27, 2019

    @aLekSer
    Collaborator

    @heartrobotninja Please don't forget about #414 which currently was manually fixed in /vendor
    kubernetes/kubernetes#70277 is merged, but not sure about target Kubernetes version.

  4. aLekSer commented on Mar 4, 2019

    @aLekSer
    Collaborator

    @heartrobotninja also note that we can use vendors with modules at the same time to mitigate mentioned above issue:
    https://github.com/golang/go/wiki/Modules#how-do-i-use-vendoring-with-modules-is-vendoring-going-away

  5. heartrobotninja commented on Mar 8, 2019

    @heartrobotninja
    Contributor

    Here is what we have so far:

    Moving straight to go modules is ideal, but not doable right now. We have code in vendor that contains a fix that will not be released until March 25th, and there is no guarantee when the platforms will update to 1.14 since they are still on 1.12.

    Given this, it might be best that we move to go modules while also keeping the vendor directory. This would require re-implementing the fix from #414. If we are ok with doing that, I can do both parts fairly quickly.

  6. markmandel commented on Mar 8, 2019

    @markmandel
    MemberAuthor

    It sounds like a way forward, but what does "re-implementing the fix" entail? Just making sure it's pasted into the new vendor directory?

    Question - with go modules,without a vendor directory, does that mean on each CI build, we would have to download all our dependencies every time?

  7. heartrobotninja commented on Mar 8, 2019

    @heartrobotninja
    Contributor

    re-implementing would just be re-applying the fix. I know there is a cache for go modules, but I am currently trying to hunt down how that works with CI builds.

  8. markmandel commented on Mar 8, 2019

    @markmandel
    MemberAuthor

    Gotcha. We'd likely want to store that in GCS and move it back and forth.

  9. heartrobotninja commented on Mar 8, 2019

    @heartrobotninja
    Contributor

    As for CI:
    We could either cache all dependencies prior to building. This still makes us download still, but we do it in advance of building. There might be some magic we can do there where we keep the cache warmed.

    The other option is doing module-aware vendoring. This is mostly what we do now, so will likely consist of the least changes. Both are supported and I would propose we just do module-aware vendoring for now.

  10. markmandel commented on Mar 8, 2019

    @markmandel
    MemberAuthor

    I would propose we just do module-aware vendoring for now.

    SGTM 馃憤

  11. heartrobotninja commented on Mar 11, 2019

    @heartrobotninja
    Contributor

    Currently have modules working for LOCAL_GO=true. Currently working out some issues with the non-local version failing. Been looking into why this would be a problem for docker run.

  12. heartrobotninja commented on Mar 12, 2019

    @heartrobotninja
    Contributor

    What I am currently running into: The intermediate containers which get instantiated by RUN aren't inheriting environment variables.

  13. heartrobotninja commented on Mar 12, 2019

    @heartrobotninja
    Contributor

    So, the go.mod file isn't visible in the intermediate container. That is the actual problem.

  14. heartrobotninja commented on Mar 15, 2019

    @heartrobotninja
    Contributor

    I finally have gotten things to get past the missing mod file, but now I am trying to sort through the differences in local vs docker because while local building works fine, docker has some issues finding certain packages. The current one is:
    build agones.dev/agones/cmd/controller: cannot load k8s.io/api/admissionregistration/v1alpha1: cannot find module providing package k8s.io/api/admissionregistration/v1alpha1

  15. heartrobotninja commented on Mar 15, 2019

    @heartrobotninja
    Contributor

    Its apparently by design per https://github.com/kubernetes/client-go/issues/551 they removed v1alpha1 from master, but we still have an indirect dependency on it via an import of an import.

  16. heartrobotninja commented on Mar 15, 2019

    @heartrobotninja
    Contributor

    Fun fact, when running go build as we do for build-controller-binary, I can't get the build to recognize that a go.mod file exists unless I put a command before go build. For instance if I put pwd && go build -mod=vendor it works.

  17. heartrobotninja commented on Mar 15, 2019

    @heartrobotninja
    Contributor

    Progress! I have make build and make test working. I need to do some e2e testing and documentation and I will have a pull ready.

  18. heartrobotninja commented on Mar 16, 2019

    @heartrobotninja
    Contributor

    e2e testing worked. Fixing some issues with the gen-grpc files that have cropped up due to vendoring.

  19. heartrobotninja commented on Mar 16, 2019

    @heartrobotninja
    Contributor
  20. markmandel commented on Apr 1, 2019

    @markmandel
    MemberAuthor

    Can this be closed now?

  21. heartrobotninja commented on Apr 1, 2019

    @heartrobotninja
    Contributor

    Yep!

  22. added this to the 0.9.0 milestone on Apr 1, 2019
  23. roberthbailey commented on Apr 17, 2019

    @roberthbailey

    Should the GOPATH section of the build/README be removed (or updated) in light of this change or is is still necessary to install inside of GOPATH for IDE integration?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    area/build-toolsDevelopment tooling. I.e. pretty much everything in the `build` directory.help wantedWe would love help on these issues. Please come help us!kind/cleanupRefactoring code, fixing up documentation, etc

    Type

    No type

    Projects

    No projects

      Milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions