Closed probonopd closed 2 years ago
Why do we have 2 very similar functions?
func CheckForNeededTools(tools []string) error
func CheckIfAllToolsArePresent(tools []string)
This code has become non-linear and as a result, it is not easy to know what is running in which sequence.
For example, I am wondering why
does not seem to be running before we get
$ ./squashfs-root/usr/bin/appimagetool -s deploy $APPNAME.AppDir/usr/share/applications/*.desktop 2>&1 | more
AppDir path: leafpad.AppDir
Exec= key contains: leafpad
Icon= key contains: leafpad
2022/05/08 15:34:09 Gathering all required libraries for the AppDir...
patchelf --print-rpath leafpad.AppDir/usr/bin/leafpad
ERROR patchelf --print-rpath leafpad.AppDir/usr/bin/leafpad: : exec: "patchelf":
executable file not found in $PATH
Would the program still be linear, one could read the code from top to bottom, ideally in one file. No functions.
This way, it is cumbersome!
I really don't like code that doesn't have a clear linear structure and is broken down into functions.
This code has become non-linear and as a result, it is not easy to know what is running in which sequence.
For example, I am wondering why
does not seem to be running before we get
$ ./squashfs-root/usr/bin/appimagetool -s deploy $APPNAME.AppDir/usr/share/applications/*.desktop 2>&1 | more
AppDir path: leafpad.AppDir
Exec= key contains: leafpad
Icon= key contains: leafpad
2022/05/08 15:34:09 Gathering all required libraries for the AppDir...
patchelf --print-rpath leafpad.AppDir/usr/bin/leafpad
ERROR patchelf --print-rpath leafpad.AppDir/usr/bin/leafpad: : exec: "patchelf":
executable file not found in $PATH
Would the program still be linear, one could read the code from top to bottom, ideally in one file. No functions.
This way, it is cumbersome!
I really don't like code that doesn't have a clear linear structure and is broken down into functions.
which is in func bootstrapAppImageBuild(c *cli.Context) error
needs to run before func AppDirDeploy(path string)
. Is it? How to find out? This code is not easy to read anymore.
Each tool should have exactly 1 source code file which executes instructions in a linear way from top to bottom. So that you exactly know what runs in which order by looking at just this file.
The only thing that seems to "call"(?) bootstrapAppImageBuild
is
What is a &cli.App{}
and what does Action: bootstrapAppImageBuild
mean?
This coding style makes things cumbersome, and as a result, it's not fun to work on.
this cli business seems to come from github.com/urfave/cli/v2 v2.2.0`.
It seems to have come in with https://github.com/probonopd/go-appimage/pull/91/files.
This restructuring took the simplicity out of things, and made it cumbersome to understand the execution flow because things that once were linear and simple are now broken into functions and complicated, and no one knows what runs in what order.
What is a &cli.App{} and what does Action: bootstrapAppImageBuild mean?
Moved the code that sets the $PATH
out of bootstrapAppImageBuild
and now it seems to be working.
patchelf
on the$PATH
in the AppImage?patchelf
is missing?./appimagetool-703-x86_64.AppImage
? What gives?