diff --git a/README.md b/README.md index d6dd785..9c9cc56 100644 --- a/README.md +++ b/README.md @@ -80,9 +80,12 @@ then in order to statically build the gophy binary use one of the following comm * Windows: * ```CGO_ENABLED=0 GOOS=windows GOARCH=amd64 go build .``` -* MacOS: +* MacOS (x64): * ```CGO_ENABLED=0 GOOS=darwin GOARCH=amd64 go build .``` +* MacOS (Apple Silicon - ARM): + + * ```CGO_ENABLED=0 GOOS=darwin GOARCH=arm64 go build .``` * Linux-based OS: * ```CGO_ENABLED=0 GOOS=linux GOARCH=amd64 go build .``` diff --git a/githubversioncheck/githubversioncheck.go b/githubversioncheck/githubversioncheck.go index cdb7989..1881635 100644 --- a/githubversioncheck/githubversioncheck.go +++ b/githubversioncheck/githubversioncheck.go @@ -61,6 +61,9 @@ func extractVersionFromHtml(content string) (string, error) { version = strings.TrimRight(version, ".") // e.g. now version = "v0.9.12" + if version == "" { + return "", fmt.Errorf("Something went wrong. If you see the error 'tls: failed to verify certificate: x509: certificate signed by unknown authority' and you are NOT using a Dokcer scratch container, then you should try the following, assuming you are using linux: 'sudo apt update && sudo apt install --reinstall ca-certificates'") + } return version, nil } diff --git a/main.go b/main.go index e7b8bb1..4e6e6ed 100644 --- a/main.go +++ b/main.go @@ -51,17 +51,6 @@ const version = "v0.9.31" func main() { // /* - // First check whether the currently run version of gophy is the newest available release on github (you are allowed to use older versions, just used to inform the user) - isUsingNewestGophyVersion, latestVersion, err := githubversioncheck.IsUsingNewestGophyVersion(version) - if err != nil { - logger.L.Printf("Failed to determine latest release of gophy: %v", err) - } - if isUsingNewestGophyVersion { - logger.L.Printf("You are running the latest version of gophy: %v\n", version) - } else { - logger.L.Printf("New version of gophy is available: %v\nYou are still using version: %v\nPlease update it manually!\n", latestVersion, version) - } - // ---- Create database folder if it does not exist already ---- simsol.CreateFolder(filepath.Join(".", "database")) @@ -90,6 +79,20 @@ func main() { // ---- Handle flags ---- + // Check whether the currently run version of gophy is the newest available release on github (you are allowed to use older versions, just used to inform the user) + // Only perform this check when you are NOT running this in a docker scratch container (that container does not have CA certficates so it would fail with 'tls: failed to verify certificate: x509: certificate signed by unknown authority') + if (*dockerAliasFlag != "1f") && (*dockerAliasFlag != "2f") && (*dockerAliasFlag != "3f") && (*dockerAliasFlag != "4l") && (*dockerAliasFlag != "5l") && (*dockerAliasFlag != "6l") && (*dockerAliasFlag != "ra") { + isUsingNewestGophyVersion, latestVersion, err := githubversioncheck.IsUsingNewestGophyVersion(version) + if err != nil { + logger.L.Printf("Failed to determine latest release of gophy: %v", err) + } + if isUsingNewestGophyVersion { + logger.L.Printf("You are running the latest version of gophy: %v\n", version) + } else { + logger.L.Printf("New version of gophy is available: %v\nYou are still using version: %v\nPlease update it manually!\n", latestVersion, version) + } + } + // only allow user ports to avoid port conflicts database.HttpPort = *httpPortFlag if (database.HttpPort < 1024) || (database.HttpPort > 49151) || (database.HttpPort == 12345) {