Using Go 1.21.0 with Railway

Hey team, I'm probably missing something obvious, but I'm struggling to upgrade my Go app to Go 1.21.0 on Railway. Here's the output I get:
==============
Using Nixpacks
==============

context: 7458ed1512f201f973081fea9b02a9ca

╔══════ Nixpacks v1.12.0 ══════╗
║ setup │ go ║
║──────────────────────────────║
║ install │ go mod download ║
║──────────────────────────────║
║ build │ go build -o out ║
║──────────────────────────────║
║ start │ ./out ║
╚══════════════════════════════╝


...

#14 [stage-0 8/8] RUN --mount=type=cache,id=s/17c92c1f-5d79-4f57-924d-6eb1a3dcf759-/root/cache/go-build,target=/root/.cache/go-build go build -o out

#14 0.513 pkg/services/analyzedocumentservice/analyze_document_service.go:4:2: package cmp is not in GOROOT (/nix/store/a7875alzpnr46z6mv4ssymfdwmvr6xbq-go-1.19.4/share/go/src/cmp)
#14 0.513 pkg/api/middleware/user_allowlist.go:8:2: package slices is not in GOROOT (/nix/store/a7875alzpnr46z6mv4ssymfdwmvr6xbq-go-1.19.4/share/go/src/slices)

==============
Using Nixpacks
==============

context: 7458ed1512f201f973081fea9b02a9ca

╔══════ Nixpacks v1.12.0 ══════╗
║ setup │ go ║
║──────────────────────────────║
║ install │ go mod download ║
║──────────────────────────────║
║ build │ go build -o out ║
║──────────────────────────────║
║ start │ ./out ║
╚══════════════════════════════╝


...

#14 [stage-0 8/8] RUN --mount=type=cache,id=s/17c92c1f-5d79-4f57-924d-6eb1a3dcf759-/root/cache/go-build,target=/root/.cache/go-build go build -o out

#14 0.513 pkg/services/analyzedocumentservice/analyze_document_service.go:4:2: package cmp is not in GOROOT (/nix/store/a7875alzpnr46z6mv4ssymfdwmvr6xbq-go-1.19.4/share/go/src/cmp)
#14 0.513 pkg/api/middleware/user_allowlist.go:8:2: package slices is not in GOROOT (/nix/store/a7875alzpnr46z6mv4ssymfdwmvr6xbq-go-1.19.4/share/go/src/slices)

Clearly the problem is with the Go version nixpacks has installed, and that's understandable because I think the latest version of Go available from NixOS is 1.20.6. My question is: when will I be able to use Go 1.21.0 on Railway? Are there any workarounds until then?
12 Replies
Percy
Percy15mo ago
Project ID: 17c92c1f-5d79-4f57-924d-6eb1a3dcf759
Brody
Brody15mo ago
correct, the most up to date version of go that nixos has is 1.20.6 https://github.com/NixOS/nixpkgs/tree/master/pkgs/development/compilers/go this would be the highest version you could use on railway
when will I be able to use Go 1.21.0 on Railway
when nixos has go 1.21.0 available
Are there any workarounds until then?
yes! do what i do, build with a Dockerfile, the go team automatically releases up to date docker images
GetPsyched
GetPsyched14mo ago
Can't you maintain a copy of the existing Go package and just bump the version for yourself? I've done that for a bunch of apps that don't yet have the latest and greatest version of the app on nixpkgs
Brody
Brody14mo ago
sounds like more work than it's worth
GetPsyched
GetPsyched14mo ago
Nope
Brody
Brody14mo ago
I can use whatever go version I want without having to maintain anything
GetPsyched
GetPsyched14mo ago
You just copy paste the nix expression for go and bump the version
Brody
Brody14mo ago
I just change a number at the top of the dockerfile
GetPsyched
GetPsyched14mo ago
Maintenance here would mean just to be updated with the nix expression upstream If you have that setup, that's easier. But that offloads the issue to the developer It's fine but just mentioned an alternative you guys could consider
Brody
Brody14mo ago
no alternative needed, nix packages has 1.21.1 now
GetPsyched
GetPsyched14mo ago
Yeah
Brody
Brody14mo ago
I wonder if op still cares
[phases.setup]
nixpkgsArchive = 'e67b7b6ab5e1c8055597d5c02ad6d3c489f0f134'
[phases.setup]
nixpkgsArchive = 'e67b7b6ab5e1c8055597d5c02ad6d3c489f0f134'
uses go 1.21.1
Want results from more Discord servers?
Add your server