Skip to content

Commit

Permalink
Merge pull request #23 from Phillezi/update-module-and-structure
Browse files Browse the repository at this point in the history
update module name, imports and structure
  • Loading branch information
Phillezi authored Sep 12, 2024
2 parents d39fdb5 + a2344e0 commit 47f8c8a
Show file tree
Hide file tree
Showing 18 changed files with 36 additions and 32 deletions.
5 changes: 2 additions & 3 deletions Makefile
Original file line number Diff line number Diff line change
@@ -1,8 +1,7 @@
# Variables
BINARY_NAME=kthcloud
BUILD_DIR=bin
CMD_DIR=cmd/kthcloud-cli
MAIN_FILE=$(CMD_DIR)/main.go
MAIN_FILE=main.go
BUILDTIMESTAMP=$(shell date -u +%Y%m%d%H%M%S)

# Targets
Expand All @@ -13,7 +12,7 @@ all: build
build:
@echo "Building the application..."
@mkdir -p $(BUILD_DIR)
@CGO_ENABLED=0 go build -ldflags "-X main.buildTimestamp=$(BUILDTIMESTAMP)" -o $(BUILD_DIR)/$(BINARY_NAME) $(CMD_DIR)/*
@CGO_ENABLED=0 go build -ldflags "-X main.buildTimestamp=$(BUILDTIMESTAMP)" -o $(BUILD_DIR)/$(BINARY_NAME) .
@echo "Build complete."

run: build
Expand Down
4 changes: 2 additions & 2 deletions cmd/kthcloud-cli/cli_compose.go → cmd/cli_compose.go
Original file line number Diff line number Diff line change
@@ -1,12 +1,12 @@
package main
package cmd

import (
"fmt"
"path/filepath"

log "github.com/sirupsen/logrus"

"kthcloud-cli/internal/compose"
"github.com/Phillezi/kthcloud-cli/internal/compose"

"github.com/spf13/cobra"
"github.com/spf13/viper"
Expand Down
6 changes: 3 additions & 3 deletions cmd/kthcloud-cli/cli_login.go → cmd/cli_login.go
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
package main
package cmd

import (
"kthcloud-cli/internal/model"
"kthcloud-cli/pkg/auth"
"github.com/Phillezi/kthcloud-cli/internal/model"
"github.com/Phillezi/kthcloud-cli/pkg/auth"

log "github.com/sirupsen/logrus"
"github.com/spf13/cobra"
Expand Down
5 changes: 3 additions & 2 deletions cmd/kthcloud-cli/cli_root.go → cmd/cli_root.go
Original file line number Diff line number Diff line change
@@ -1,10 +1,11 @@
package main
package cmd

import (
"fmt"
"kthcloud-cli/pkg/config"
"path"

"github.com/Phillezi/kthcloud-cli/pkg/config"

"github.com/spf13/cobra"
"github.com/spf13/viper"
)
Expand Down
2 changes: 1 addition & 1 deletion cmd/kthcloud-cli/cli_start.go → cmd/cli_start.go
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
package main
package cmd

import (
"os"
Expand Down
4 changes: 2 additions & 2 deletions cmd/kthcloud-cli/cli_update.go → cmd/cli_update.go
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
package main
package cmd

import (
"kthcloud-cli/internal/update"
"github.com/Phillezi/kthcloud-cli/internal/update"

log "github.com/sirupsen/logrus"
"github.com/spf13/cobra"
Expand Down
7 changes: 4 additions & 3 deletions cmd/kthcloud-cli/cli_util.go → cmd/cli_util.go
Original file line number Diff line number Diff line change
@@ -1,11 +1,12 @@
package main
package cmd

import (
"go-deploy/dto/v2/body"
"kthcloud-cli/internal/model"
"kthcloud-cli/pkg/util"
"time"

"github.com/Phillezi/kthcloud-cli/internal/model"
"github.com/Phillezi/kthcloud-cli/pkg/util"

log "github.com/sirupsen/logrus"

"github.com/spf13/cobra"
Expand Down
2 changes: 1 addition & 1 deletion go.mod
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
module kthcloud-cli
module github.com/Phillezi/kthcloud-cli

go 1.23.1

Expand Down
4 changes: 2 additions & 2 deletions internal/compose/conv.go
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,8 @@ package compose

import (
"go-deploy/dto/v2/body"
"kthcloud-cli/internal/model"
"kthcloud-cli/pkg/util"
"github.com/Phillezi/kthcloud-cli/internal/model"
"github.com/Phillezi/kthcloud-cli/pkg/util"
"strings"

log "github.com/sirupsen/logrus"
Expand Down
2 changes: 1 addition & 1 deletion internal/compose/parser.go
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ package compose

import (
"fmt"
"kthcloud-cli/internal/model"
"github.com/Phillezi/kthcloud-cli/internal/model"

log "github.com/sirupsen/logrus"

Expand Down
2 changes: 1 addition & 1 deletion internal/compose/printers.go
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ package compose

import (
"fmt"
"kthcloud-cli/internal/model"
"github.com/Phillezi/kthcloud-cli/internal/model"
)

func PrintServices(services map[string]model.Service) {
Expand Down
4 changes: 2 additions & 2 deletions internal/compose/up.go
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,8 @@ package compose
import (
"fmt"
"go-deploy/dto/v2/body"
"kthcloud-cli/internal/model"
"kthcloud-cli/pkg/util"
"github.com/Phillezi/kthcloud-cli/internal/model"
"github.com/Phillezi/kthcloud-cli/pkg/util"
"strings"
"sync"
"time"
Expand Down
4 changes: 2 additions & 2 deletions internal/compose/volumes.go
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,8 @@ package compose
import (
"errors"
"go-deploy/dto/v2/body"
"kthcloud-cli/internal/api"
"kthcloud-cli/internal/model"
"github.com/Phillezi/kthcloud-cli/internal/api"
"github.com/Phillezi/kthcloud-cli/internal/model"
"strings"

log "github.com/sirupsen/logrus"
Expand Down
4 changes: 2 additions & 2 deletions internal/model/session.go
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,8 @@ import (
"errors"
"fmt"
"go-deploy/dto/v2/body"
"kthcloud-cli/internal/api"
"kthcloud-cli/pkg/util"
"github.com/Phillezi/kthcloud-cli/internal/api"
"github.com/Phillezi/kthcloud-cli/pkg/util"
"os"
"path/filepath"
"time"
Expand Down
2 changes: 1 addition & 1 deletion internal/update/release.go
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,7 @@ func (r *GitHubRelease) IsNewer() (bool, error) {
}

func GetLatestRelease() (*GitHubRelease, error) {
url := "https://api.github.com/repos/Phillezi/kthcloud-cli/releases/latest"
url := "https://api.github.com/repos/Phillezi/github.com/Phillezi/kthcloud-cli/releases/latest"
resp, err := http.Get(url)
if err != nil {
return nil, fmt.Errorf("error fetching release info: %v", err)
Expand Down
7 changes: 5 additions & 2 deletions cmd/kthcloud-cli/main.go → main.go
Original file line number Diff line number Diff line change
@@ -1,10 +1,13 @@
package main

import "github.com/spf13/viper"
import (
"github.com/Phillezi/kthcloud-cli/cmd"
"github.com/spf13/viper"
)

var buildTimestamp = "19700101000000"

func main() {
viper.Set("release", "release-"+buildTimestamp)
Execute()
cmd.Execute()
}
2 changes: 1 addition & 1 deletion pkg/auth/browser.go
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ package auth
import (
_ "embed"
"fmt"
"kthcloud-cli/internal/model"
"github.com/Phillezi/kthcloud-cli/internal/model"
"os/exec"
"runtime"
"time"
Expand Down
2 changes: 1 addition & 1 deletion pkg/auth/check.go
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ package auth

import (
"errors"
"kthcloud-cli/internal/api"
"github.com/Phillezi/kthcloud-cli/internal/api"

log "github.com/sirupsen/logrus"

Expand Down

0 comments on commit 47f8c8a

Please sign in to comment.