Place the full command to "cmd" package

This changed some variables access and the Makefile to build from
"./cmd" direcoty.
This commit is contained in:
2022-03-28 11:43:17 +02:00
parent e41d7b0c29
commit daf8907f14
6 changed files with 279 additions and 280 deletions

View File

@@ -5,7 +5,6 @@ import (
"errors"
"fmt"
"io"
"katenary/cmd"
"net/http"
"os"
"runtime"
@@ -13,6 +12,7 @@ import (
)
var exe, _ = os.Executable()
var Version = "master" // reset by cmd/main.go
// Asset is a github asset from release url.
type Asset struct {
@@ -63,7 +63,7 @@ func CheckLatestVersion() (string, []Asset, error) {
}
// if the current version is the same as the latest version, don't update
if cmd.Version == release.TagName {
if Version == release.TagName {
fmt.Println("You are using the latest version")
return "", nil, errors.New("You are using the latest version")
}

View File

@@ -2,15 +2,14 @@ package update
import (
"fmt"
"katenary/cmd"
"os"
"testing"
)
func TestDownloadLatestRelease(t *testing.T) {
// Change the cmd.Version to "v0.0.0" to test the fallback to the latest release
cmd.Version = "v0.0.0"
// Reset the version to test the latest release
Version = "0.0.0"
// change "exe" to /tmp/test-katenary
exe = "/tmp/test-katenary"