fix(ci): fix ci err

This commit is contained in:
sky5454 2026-03-31 05:21:26 +08:00
parent 0b4c26c1db
commit 456791ab32
2 changed files with 9 additions and 6 deletions

View file

@ -24,7 +24,7 @@ import (
"github.com/sipeed/picoclaw/cmd/picoclaw/internal/status" "github.com/sipeed/picoclaw/cmd/picoclaw/internal/status"
"github.com/sipeed/picoclaw/cmd/picoclaw/internal/version" "github.com/sipeed/picoclaw/cmd/picoclaw/internal/version"
"github.com/sipeed/picoclaw/pkg/config" "github.com/sipeed/picoclaw/pkg/config"
"github.com/sipeed/picoclaw/pkg/updater" "github.com/sipeed/picoclaw/pkg/updater"
) )
func NewPicoclawCommand() *cobra.Command { func NewPicoclawCommand() *cobra.Command {
@ -46,8 +46,8 @@ func NewPicoclawCommand() *cobra.Command {
migrate.NewMigrateCommand(), migrate.NewMigrateCommand(),
skills.NewSkillsCommand(), skills.NewSkillsCommand(),
model.NewModelCommand(), model.NewModelCommand(),
updater.NewUpdateCommand("picoclaw"), updater.NewUpdateCommand("picoclaw"),
version.NewVersionCommand(), version.NewVersionCommand(),
) )
return cmd return cmd

View file

@ -70,7 +70,7 @@ func DownloadAndExtractRelease(releaseURL, platform, arch string) (string, error
return "", fmt.Errorf("failed to download asset: status %d", resp.StatusCode) return "", fmt.Errorf("failed to download asset: status %d", resp.StatusCode)
} }
if _, err := io.Copy(tmpFile, resp.Body); err != nil { if _, err = io.Copy(tmpFile, resp.Body); err != nil {
os.Remove(tmpPath) os.Remove(tmpPath)
return "", err return "", err
} }
@ -119,7 +119,7 @@ func UpdateSelfFromRelease(releaseURL, platform, arch, programName string) error
// ensure executable bit on non-windows // ensure executable bit on non-windows
if runtime.GOOS != "windows" { if runtime.GOOS != "windows" {
_ = os.Chmod(binPath, 0755) _ = os.Chmod(binPath, 0o755)
} }
f, err := os.Open(binPath) f, err := os.Open(binPath)
@ -312,7 +312,10 @@ func looksLikeDirectAssetURL(u string) bool {
return false return false
} }
lower := strings.ToLower(u) lower := strings.ToLower(u)
if strings.HasSuffix(lower, ".zip") || strings.HasSuffix(lower, ".tar.gz") || strings.HasSuffix(lower, ".tgz") || strings.HasSuffix(lower, ".tar") { if strings.HasSuffix(lower, ".zip") ||
strings.HasSuffix(lower, ".tar.gz") ||
strings.HasSuffix(lower, ".tgz") ||
strings.HasSuffix(lower, ".tar") {
return true return true
} }
if strings.Contains(lower, "/releases/download/") { if strings.Contains(lower, "/releases/download/") {