package client import ( "context" "log" "os" ) // TODO: // Check the Server header from the host and if the second part does not match // - Use HEAD, ignore 404 // Download the latest client for this os/arch (remap GOARCH=amd64 to x86_64) // Re-execute the client in the same process so the latest client is used // Log some output to let the user know this happened // Verify SHA256 based on server ETag func upgradeAndRestartClient(ctx context.Context, version, host string) error { // Download, chmod, verify, unlink original, rename old to new, exec new exec, err := os.Executable() if err != nil { return err } // Refuse if any path segment starts with go-build.* log.Printf("Executable is %s", exec) return nil }