Skip to content

Commit

Permalink
Follow Standard Go Project Layout
Browse files Browse the repository at this point in the history
  • Loading branch information
psydvl committed Dec 1, 2022
1 parent 62ca992 commit 4a9b445
Show file tree
Hide file tree
Showing 34 changed files with 26 additions and 18 deletions.
File renamed without changes.
11 changes: 6 additions & 5 deletions src/appimaged/appimage.go → cmd/appimaged/appimage.go
Original file line number Diff line number Diff line change
Expand Up @@ -4,19 +4,20 @@ import (
"bytes"
"crypto/md5"
"encoding/hex"
"net/url"

"gopkg.in/ini.v1"

"log"
"net/url"
"os"
"path/filepath"
"strings"
"time"

"gopkg.in/ini.v1"

"github.com/adrg/xdg"

"github.com/probonopd/go-appimage/internal/helpers"
"github.com/probonopd/go-appimage/src/goappimage"
"github.com/probonopd/go-appimage/pkg/goappimage"

"go.lsp.dev/uri"
)

Expand Down
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
23 changes: 14 additions & 9 deletions src/appimagetool/cli.go → cmd/appimagetool/cli.go
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ import (

"github.com/probonopd/go-appimage/internal/helpers"
"github.com/probonopd/go-appimage/internal/signing"
"github.com/probonopd/go-appimage/src/goappimage"
"github.com/probonopd/go-appimage/pkg/goappimage"
)

// array of string, Sections contains
Expand All @@ -23,7 +23,8 @@ var Sections = []string{".upd_info", ".sha256_sig", ".sig_key", ".digest_md5"}

// bootstrapAppImageDeploy wrapper function to deploy an AppImage
// from Desktop file
// Args: c: cli.Context
//
// Args: c: cli.Context
func bootstrapAppImageDeploy(c *cli.Context) error {
// make sure the user provided one and one only desktop
if c.NArg() != 1 {
Expand All @@ -41,7 +42,8 @@ func bootstrapAppImageDeploy(c *cli.Context) error {
}

// bootstrapValidateAppImage wrapper function to validate a AppImage
// Args: c: cli.Context
//
// Args: c: cli.Context
func bootstrapValidateAppImage(c *cli.Context) error {

// make sure that we received only 1 file path
Expand Down Expand Up @@ -82,14 +84,16 @@ func bootstrapValidateAppImage(c *cli.Context) error {

// bootstrapSetupSigning wrapper function to setup signing in
// the current Git repository
// Args: c: cli.Context
//
// Args: c: cli.Context
func bootstrapSetupSigning(c *cli.Context) error {
return signing.Setup(c.Bool("overwrite"))
}

// bootstrapAppImageSections is a function which converts cli.Context to
// string based arguments. Wrapper function to show the sections of the AppImage
// Args: c: cli.Context
//
// Args: c: cli.Context
func bootstrapAppImageSections(c *cli.Context) error {
// check if the number of arguments are stictly 1, if not
// return
Expand Down Expand Up @@ -138,7 +142,8 @@ func bootstrapAppImageSections(c *cli.Context) error {
// check if all the necessary dependencies exist,
// finally check if the provided argument, AppDir is a directly.
// Call GenerateAppImage with the converted arguments
// Args: c: cli.Context
//
// Args: c: cli.Context
func bootstrapAppImageBuild(c *cli.Context) error {

// check if the number of arguments are stictly 1, if not
Expand Down Expand Up @@ -225,7 +230,7 @@ func main() {

// Add the location of the executable to the $PATH
helpers.AddHereToPath()

// fmt.Println("PATH:", os.Getenv("PATH"))

// Check for needed files on $PATH
Expand All @@ -236,12 +241,12 @@ func main() {
if err != nil {
os.Exit(1)
}

// Check whether we have a sufficient version of mksquashfs for -offset
if helpers.CheckIfSquashfsVersionSufficient("mksquashfs") == false {
os.Exit(1)
}

// define subcommands, like 'deploy', 'validate', ...
app.Commands = []*cli.Command{
{
Expand Down
File renamed without changes.
File renamed without changes.
5 changes: 3 additions & 2 deletions src/mkappimage/mkappimage.go → cmd/mkappimage/mkappimage.go
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ import (
"github.com/urfave/cli/v2"

"github.com/probonopd/go-appimage/internal/helpers"
"github.com/probonopd/go-appimage/src/goappimage"
"github.com/probonopd/go-appimage/pkg/goappimage"
)

// https://blog.kowalczyk.info/article/vEja/embedding-build-number-in-go-executable.html
Expand Down Expand Up @@ -45,7 +45,8 @@ func listLongFilesInAppImage(path string) {
// check if all the necessary dependencies exist,
// finally check if the provided argument, AppDir is a directly.
// Call GenerateAppImage with the converted arguments
// Args: c: cli.Context
//
// Args: c: cli.Context
func bootstrapMkAppImage(c *cli.Context) error {

// check if the number of arguments are stictly 1, if not
Expand Down
File renamed without changes.
3 changes: 2 additions & 1 deletion src/goappimage/appimage.go → pkg/goappimage/appimage.go
Original file line number Diff line number Diff line change
Expand Up @@ -13,8 +13,9 @@ import (
"time"

"github.com/CalebQ42/squashfs"
"github.com/probonopd/go-appimage/internal/helpers"
"gopkg.in/ini.v1"

"github.com/probonopd/go-appimage/internal/helpers"
)

/*
Expand Down
File renamed without changes.
File renamed without changes.
File renamed without changes.
2 changes: 1 addition & 1 deletion scripts/build.sh
Original file line number Diff line number Diff line change
Expand Up @@ -97,7 +97,7 @@ build () {
echo CC: $CC
which zig
zig env
CGO_ENABLED=1 go build -o $BUILDDIR -v -trimpath -ldflags="-linkmode=external -extldflags \"-static\" -s -w -X main.commit=$COMMIT" $PROJECT/src/$PROG
CGO_ENABLED=1 go build -o $BUILDDIR -v -trimpath -ldflags="-linkmode=external -extldflags \"-static\" -s -w -X main.commit=$COMMIT" $PROJECT/cmd/$PROG
ls -lh $PROG
file $PROG
# common appimage steps
Expand Down

0 comments on commit 4a9b445

Please sign in to comment.