this post was submitted on 01 Oct 2023
14 points (100.0% liked)

Golang

2201 readers
12 users here now

This is a community dedicated to the go programming language.

Useful Links:

Rules:

founded 1 year ago
MODERATORS
 

Wonder if anyone here has been using bingo for reproducible builds. I've found it to be really good and wish I could find similar tooling for things like python for tools like yamllint.

top 6 comments
sorted by: hot top controversial new old
[–] [email protected] 1 points 1 year ago (1 children)

Is this like nix but specifically for go?

[–] [email protected] 1 points 1 year ago (2 children)

Well, nix would be an entire operating system. This is just for a build system to specify the versions of the tools to use.

[–] [email protected] 3 points 1 year ago

The nixos.org website does a bad job at explaining things, but nix != NixOS. nix is a declarative package manager and build system. NixOS is a distribution built on top of it. With nix-shell, you can take a package declaration and enter a shell with build dependencies available therein.

[–] [email protected] 1 points 1 year ago* (last edited 1 year ago) (1 children)

"An entire OS" - that is NixOS. Nix (package manager / build system) can and is often used standalone, on other Linux distributions, and by some on MacOS.

I cannot vouch for ease of use of Nixpkgs' Go building facilities, but at the very least it should be possible to create a necessary environment for development and compilation of a package. Nix guarantees that it is going to be reproducible.

The main downside of using Nix would be that the declarative approach is different from the imperative one - AFAIK, there is no command to just add something to the environment (nix-shell -p does not count as it is a temporary env without a pinned Nixpkgs, so isn't reproducible). The second would be that Nixpkgs seems to only have one version of Go and Co. at a time, so if one needs an older version of something they need to find an older version of Nixpkgs.

edit: as I have looked up, there are actually four versions of Go - "go" is 1.20, and "go_1_*" gives 1.21, 1.19 and 1.18 (on unstable Nixpkgs). I don't know about other pieces of the environment though.

[–] [email protected] 1 points 1 year ago (1 children)

The second would be that Nixpkgs seems to only have one version of Go and Co. at a time, so if one needs an older version of something they need to find an older version of Nixpkgs.

Not strictly correct. Nixpkgs follows the upstream Go release policy, which means it ships the last two versions of Go. Currently, that's 1.20 (nixpkgs#go_1_20) and 1.21 (nixpkgs#go_1_21)

[–] [email protected] 1 points 1 year ago* (last edited 1 year ago)

Oh, I missed that! Thanks for clarification!

edit: looks like four versions, from 1.18 to 1.21