C
Coder.com•3mo ago
RainyDev

Golang Template

Hi there, does anyone have a golang template with go version 1.22 or 1.23? The base golang image from coder has a too old version for me and I haven't figured out yet how to install a newer version in the coder workspace Thanks in advance!
25 Replies
Codercord
Codercord•3mo ago
<#1287055973424300083>
Category
Help needed
Product
Coder OSS (v2)
Platform
Linux
Logs
Please post any relevant logs/error messages.
RainyDev
RainyDevOP•3mo ago
# Install latest golang version
if [[ "${data.coder_parameter.lang.value}" == "Golang" ]]; then
sudo wget -q -O - https://git.io/vQhTU | bash -s -- --version 1.23.1
sudo source /home/coder/.bashrc
fi
# Install latest golang version
if [[ "${data.coder_parameter.lang.value}" == "Golang" ]]; then
sudo wget -q -O - https://git.io/vQhTU | bash -s -- --version 1.23.1
sudo source /home/coder/.bashrc
fi
I have added this to my template which works BUT i always need to
source /home/coder/.bashrc
source /home/coder/.bashrc
when conncting which is a bit annoying
Phorcys
Phorcys•3mo ago
hi @RainyDev, which template are you using?
RainyDev
RainyDevOP•3mo ago
https://github.com/sharkymark/v2-templates/tree/main/src/docker-intellij-gateway I think it was that one that I modified a bit (added go install script etc but didnt quite work)
GitHub
v2-templates/src/docker-intellij-gateway at main · sharkymark/v2-te...
Coder CDE Terraform templates and tips. Contribute to sharkymark/v2-templates development by creating an account on GitHub.
Phorcys
Phorcys•3mo ago
i see I would recommend starting over with our Docker template and adding our JetBrains Gateway module to it that way you actually control the Dockerfile that is used within the workspace :-)
RainyDev
RainyDevOP•3mo ago
Will that work on Kubernetes? Sorry havent digged too deep into Coder yet
Phorcys
Phorcys•3mo ago
oh sory, did not know you were using Kubernetes
RainyDev
RainyDevOP•3mo ago
Yeah, sorry 😄
Phorcys
Phorcys•3mo ago
you probably did not use this one then since it's for IntelliJ on Docker
RainyDev
RainyDevOP•3mo ago
Oh no i wasn't sorry picked the wrong one one moment please
RainyDev
RainyDevOP•3mo ago
GitHub
v2-templates/src/pod-gateway-lang/main.tf at main · sharkymark/v2-t...
Coder CDE Terraform templates and tips. Contribute to sharkymark/v2-templates development by creating an account on GitHub.
RainyDev
RainyDevOP•3mo ago
It was that one I think
Phorcys
Phorcys•3mo ago
oh alright
RainyDev
RainyDevOP•3mo ago
And the go version there is too low for my required go modules I need 1.22 at least and 1.23.1 would be optimal
Phorcys
Phorcys•3mo ago
yeah so in that case honestly just reuse the template but make it use your own image do you have any CI/CD setup?
RainyDev
RainyDevOP•3mo ago
I do have gitea hosted with CI, yes. But honestly I haven't digged too deep into creating images for coder 😄 Is there any docs on that?
Phorcys
Phorcys•3mo ago
I don't really think there is so what you'll want to do is either create a Dockerfile that calls FROM <image> (where <image> is the image used in your template) and updates it. or look into how to make your own image from scratch and install Go there https://github.com/coder/coder/blob/main/examples/templates/docker/build/Dockerfile then push the resulting image to a registry (I think Gitea has one) and edit the template to pull that image instead
RainyDev
RainyDevOP•3mo ago
Hmm okay, I'll have to look into this. Thanks tho!
Phorcys
Phorcys•3mo ago
otherwise using devcontainers might be easier i've got to go but feel free to ask any questions and i'll answer them when I come back
RainyDev
RainyDevOP•3mo ago
Alright, thank you so much 🙂
Phorcys
Phorcys•3mo ago
hey @RainyDev, any luck?
RainyDev
RainyDevOP•3mo ago
nop unfortunately not really
Phorcys
Phorcys•3mo ago
do you need any help?
RainyDev
RainyDevOP•3mo ago
I guess not really But thanks! I‘ll let you know in case I do
Codercord
Codercord•3mo ago
@Phorcys closed the thread.
Want results from more Discord servers?
Add your server