How to get go 1.21 in nix-shell?

i am new to nix. in my shell.nix file when i refer to pkgs.go it downloads Go 1.20.8.

How do i tell it to download Go 1.21?

2 Likes

Use pkgs.go_1_21.

BTW, there is a tracking issue for moving to Go 1.21 by default: https://github.com/NixOS/nixpkgs/issues/255907.

2 Likes

@pdeva if your problem was solved, could you please share your shell.nix? I’m having the following issue:

            5|   nativeBuildInputs = with pkgs; [
            6|     pkgs.go_1_21
             |     ^
            7|   ];
       Did you mean one of go_1_20, go_1_18 or go_1_19?

Probably it’s by how I am defining it:

   1   β”‚ let
   2   β”‚   pkgs = import <nixpkgs> {};
   3   β”‚ in
   4   β”‚ pkgs.mkShell {
   5   β”‚   nativeBuildInputs = with pkgs; [
   6 ~ β”‚     pkgs.go_1_21
   7   β”‚   ];
   8   β”‚ }

i believe now the standard go nix pkg has been updated to 1.21