pi-apps icon indicating copy to clipboard operation
pi-apps copied to clipboard

Add Golang

Open slashtechno opened this issue 2 years ago • 22 comments

I'm personally not a fan of random scripts uploaded to github for multiple reasons for one, this script you linked still uses go 1.18.1, a version from March of this year. stable 1.19.2 is out now.

also, I don't think this meets our app elegibility rubric as this is a programming language/compiler and doesn't really have any GUI functionality https://github.com/Botspot/pi-apps/issues/185

I'll keep this open for feedback but if it were to be included, we would need to make an exception to the elegibility rubric or change it.

theofficialgman avatar Oct 23 '22 16:10 theofficialgman

I'm personally not a fan of random scripts uploaded to github for multiple reasons

In regards to security. I linked the script to the current commit to prevent changes to the script having an effect until the install script is manually updated

also, I don't think this meets our app elegibility rubric as this is a programming language/compiler and doesn't really have any GUI functionality #185

I considered this. However, the rubric specifies the following:

Apps that are not designed for everyday GUI users won't be accepted. (command-line file servers, webservers, etc)

Since Pi-Apps has a category for programming, and many individuals utilize Raspberry Pis for programming, I think it could make life easier for individuals who wish to program in Go, or use go build to compile Go programs

slashtechno avatar Oct 23 '22 17:10 slashtechno

We do also have other command-line utilities like GitHub CLI, which many mainly GUI-oriented users aren’t likely to use.

ryanfortner avatar Oct 23 '22 17:10 ryanfortner

In addition, there are other development focused apps available on Pi-Apps, so I think Go has a place in Pi-Apps.

slashtechno avatar Oct 23 '22 17:10 slashtechno

The precedent has not been set for compilers to be included in pi-apps. Everything in the programming category is an IDE and similar tooling.

We would need a precident set that we would like CLI only code compilers to be included in the programming category. go is the same in this sense as rustc, clang, gcc, etc and these are not part of pi-apps as "apps"

I personally think that any developers looking to write and compile go code already know the resources for how to follow a two step process to install their tooling from google https://go.dev/doc/install

same goes for rust https://www.rust-lang.org/learn/get-started

theofficialgman avatar Oct 23 '22 20:10 theofficialgman

Okay, makes sense

slashtechno avatar Oct 23 '22 20:10 slashtechno

Of course the version in the debian repos is outdated, why not just skip the middle man here? The installation according to the docs is just unzipping the binary and deleting the old.

https://go.dev/dl/ https://go.dev/doc/install

This way it can be updated easier and doesn't depend on any script + checksums can be used since they are supplied.

CleanMachine1 avatar Oct 26 '22 00:10 CleanMachine1

That's a fair point. However, to install Go, you also need to set up your PATH manually.

slashtechno avatar Oct 26 '22 01:10 slashtechno

@slashtechno I do not like the idea of a script running within another script, which is what is going on here. If I were you, I would adapt canha's script into a simpler and shorter one.

ryanfortner avatar Oct 26 '22 22:10 ryanfortner

@ryanfortner How do you suggest shortening it?

slashtechno avatar Oct 26 '22 23:10 slashtechno

Maybe just simply splitting install into separate install-32 and install-64 files, then creating a script based on the official Go installation instructions. https://go.dev/doc/install.

ryanfortner avatar Oct 27 '22 00:10 ryanfortner

@ryanfortner Okay, will do I'll try to get the script done this weekend. It'll be hard for me to test it however, since I don't currently have access to my Pi 4.

slashtechno avatar Oct 27 '22 00:10 slashtechno

I am willing to help out if you need assistance. Just ping me if so.

ryanfortner avatar Oct 27 '22 00:10 ryanfortner

@ryanfortner Is this better? I attempted to get rid of functions which won't be used in the script

slashtechno avatar Oct 29 '22 18:10 slashtechno

@theofficialgman Attempted to resolve the issues in commit cf6e56e4d2b4af207691346560b9fcdc6a854035

slashtechno avatar Nov 04 '22 01:11 slashtechno

this script really won't function in pi-apps

pi-apps scripts are always exclusivly run in bash, no matter what the users default shell program is (this is for compatibility reasons). the script checks the currently running shell, which will always return bash in pi-apps

also the uninstall script still has MacOS crap in it.

theofficialgman avatar Nov 04 '22 21:11 theofficialgman

pi-apps scripts are always exclusivly run in bash, no matter what the users default shell program is (this is for compatibility reasons). the script checks the currently running shell, which will always return bash in pi-apps

How can this be alleviated?

slashtechno avatar Nov 04 '22 21:11 slashtechno

actually nevermind, it looks like SHELL is a special varaible containing the default login shell. so if the user changes their default shell, it will be correctly interpreted even if the script is currently running in bash.

uninstall script still needs those macos removal edits though

theofficialgman avatar Nov 04 '22 22:11 theofficialgman

I think you need to actually go through and read and understand the scripts. There are quite a few things broken in the uninstall due to missing variables being set from you removing too much.

theofficialgman avatar Nov 05 '22 04:11 theofficialgman

I think you need to actually go through and read and understand the scripts. There are quite a few things broken in the uninstall due to missing variables being set from you removing too much.

Apologies, should be fixed now. I should have noticed the missing variable declaration earlier. I tested the uninstall script, and it seems to be working. I don't have my Raspberry Pi currently, so I am unable to test the install script fully.

slashtechno avatar Nov 05 '22 05:11 slashtechno

I suggest reading the create an app wiki page: https://github.com/Botspot/pi-apps/wiki/Creating-an-app

theofficialgman avatar Nov 06 '22 02:11 theofficialgman

I would rather have go installed systemwide instead of only for the current user

follow official go instructions https://go.dev/doc/install

create a custom profile.d script to set the path variable to include the system go installation. I suggest naming it /etc/profile.d/go.sh

ubuntu/debian package it slightly differently, avoiding setting the GOPATH and simply creating symlinks from go and gofmt to the correct bin folder... thats probably the best method and avoids touching the profile at all

to be honest there is so much wrong with this installation method that I will probably just rewrite it myself and add you as a co-contributor to the commit message.

@Botspot can you confirm if you would even like this (go/golang) in pi-apps (see here and the following messages https://github.com/Botspot/pi-apps/pull/2162#issuecomment-1288150289 )

theofficialgman avatar Nov 06 '22 17:11 theofficialgman