Hacker Newsnew | past | comments | ask | show | jobs | submitlogin

"That's why go's toolchain isn't as messed up as npm, yarn, grunt, ..."

And let's be honest, Rust toolchain is pretty messed up too.

Want to cross-compile with go? Set the GOOS variable and you are done. On Rust you need to curl-sh rustup, switch to nightly, add new targets, add target to your cargo and cross fingers it works this week.



To be fair, with Go it's still painful to work with private repositories. And I'm invoking Cunningham's Law here when I say there's no convenient way to do so.

If you want to use a private repository (let's say it's a private GitHub repository), then you either have to do it the bad way (setting up your own GOPROXY and setting it up securely, which implies also ensuring it's not leaking your source code elsewhere for "analytics purposes"), or the worse way (doing brittle text replacement using weird git config stuff).

Or the annoying way of using a vanity import, and host that package in your domain with HTTPS using a wildcard certificate. But that would require either (1) only allowing access through WireGuard and hoping whatever reverse proxy you use has a plugin for your DNS registry; or (2) letting your VPS provider terminate DNS (e.g. Hetzner load balancer), but filter by IP address in your VPS firewall settings ensuring your public address (IPV4 /32 or IPV6 /64) is always up-to-date in the firewall.

Or using `replace` in `go.mod`, but these don't work transitively so these only work on "root" projects (i.e. they are ignored in dependencies), so I don't think this really counts as a solution.

I would have liked some way to force SSH access for a specific package, instead of HTTPS. Like for example `go.mod` supporting a `require-private` to use instead of `require` (or whatever similarly convenient directive for `go.mod` that implies authenticated SSH access is required).

Or in other words, say I have a package `github.com/_company/project`, and it depends on `github.com/_company/dependency`. I want to be able to do:

    git clone 'git@github.com:_company/project.git' 'project'
    cd 'project'
    go mod tidy  # Should just work.
`go mod tidy` should just work without complaining about `github.com/_company/dependency` not existing (because it's a private repository only accessible through SSH).

(EDIT: Still, I'm agreeing with the point that Go's tooling is better than most other things I've tried. My only complains are this one about being inconvenient to use private repositories, and also that by default it leaks package names to Google whenever you do `go mod tidy`.)


1) git config --global url.ssh://git@github.com/.insteadOf https://github.com/

2) export GOPRIVATE='github.com/_company/*'


>> or the worse way (doing brittle text replacement using weird git config stuff).


Rust cross-compilation isn't great, but this seems a bit hyperbolic:

> On Rust you need to curl-sh rustup

Yes, but you do that once per computer, probably when you installed the compiler

> switch to nightly,

No

> add new targets,

Fair. But this is also one-time setup.

>add target to your cargo

Not sure what you're talking about here tbh

> and cross fingers it works this week.

Don't use the nightly compiler and you're good


If you are doing embedded work, which is where you often do cross-compiling, you still need nightly.

But that's a whole different can of worms.


Still 100x better than cross-compiling C




Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: