‹ BackHN Continuity

Thread

Don't couple your Go code to GitHub

325 points · 177 comments · birdculture

  1. thih9 · · focus · HN ↗
    > In my opinion, every commerical software development team using Go should be using custom domains for namespacing their internal libraries and packages.

    I’d remove “go” from the above, i.e. I think same applies to other stacks.

    Even using GitHub domain links in code comments gets problematic long term. Ie when a migration happens and those links start pointing nowhere.

    1. handoflixue · · focus · HN ↗
      I'm confused by the article, and this comment, treating these URLs as difficult to replace.

      Why can't you just search-and-replace? Presumably all of them refer to "GitHub.com" and not much else code will, so I'd think this was an exceptionally easy case.

      Even easier for comments, since them being obsolete for a few hours during a migration doesn't exactly break anything.

      1. mort96 · · focus · HN ↗
        I've gone through such a migration. Huge Go code base distributed across a lot of git repositories had to be moved to a different git host.

        It was horrible. A team of people spent weeks. Different projects depended on different versions of the same internal libraries, we had to create a branch for each depended-on commit and make a version of that commit with the new URLs. The expressed goal was to end up with a system that's "exactly the same" as the old, just on a new host. Changing which version of libraries projects depends on would introduce unnecessary risk.

        And the result is a code base where bisects are broken and where it's impossible to build an old version of any of the code without a ton of work.

        1. sjbzbeiks · · focus · HN ↗
          I think is usually a symptom of how hard it is for the organization to do things, the technical side of this is not actually that hard.

          I say this because I’ve gone through a few of these, some with monorepos (the easiest, search and replace and you’re done), some not (yes the hardest but you can just vendor).

          At least in the situations I’ve faced this was genuinely not horrible beyond just the organization itself being complicated about the solution.

          1. mort96 · · focus · HN ↗
            How do you propose it's solved in an easier way, given the constraints that 1) you don't want references to old infrastructure in your code and 2) you want to do the move without changing how the code works? Is there some secret trick we missed which would've made this much easier?
            1. handoflixue · · focus · HN ↗
              Everything is on A. All code refers to A.

              Clone Server A -> Server B. All code still refers to A.

              Update code to refer to B

              You can now EOL Server A, and B becomes the new canonical reference.

              I think the key is simply that you can keep both A + B running during the migration, so you just need to be able to do a code freeze for the duration of the migration. And a single person can easily do this migration with a few python scripts and an hour.

              Bonus points: code freeze guarantees your #2 - no changes to how the code works.

              Of course, I'd assume that most complaints come from situations where this "secret trick" isn't viable

              1. mort96 · · focus · HN ↗
                The "update code to refer to B" step is a massive undertaking. My whole original comment was about that one step.
                1. handoflixue · · focus · HN ↗
                  I don't understand. If B already exists and is working, isn't this just Ctrl+F, compile, push? I'm utterly unfamiliar with the "Go" language
                  1. [deleted] · · focus · HN ↗

                    [deleted]

                  2. mort96 · · focus · HN ↗
                    No, it&#x27;s not. Here&#x27;s a comment where I described a concrete hypothetical scenario: <a href="https:&#x2F;&#x2F;news.ycombinator.com&#x2F;item?id=49871032">https:&#x2F;&#x2F;news.ycombinator.com&#x2F;item?id=49871032
                    1. sjbzbeiks · · focus · HN ↗
                      You vendor the deps
Open on Hacker News to reply ↗

Unofficial Hacker News client; not affiliated with Y Combinator.