1
0
mirror of https://github.com/goreleaser/goreleaser.git synced 2025-03-17 20:47:50 +02:00

fix: clarify scoop no windows error (#3894)

improve error message and related docs

Signed-off-by: Carlos A Becker <caarlos0@users.noreply.github.com>
This commit is contained in:
Carlos Alexandro Becker 2023-03-29 10:18:40 -03:00 committed by GitHub
parent 1b86abcfc6
commit 37e92ce2f1
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
3 changed files with 12 additions and 5 deletions

View File

@ -4,7 +4,6 @@ package scoop
import (
"bytes"
"encoding/json"
"errors"
"fmt"
"os"
"path"
@ -23,8 +22,13 @@ import (
// ErrNoWindows when there is no build for windows (goos doesn't contain
// windows) or archive.format is binary.
type ErrNoWindows struct {
goamd64 string
}
var ErrNoWindows = errors.New("scoop requires a windows archive\nLearn more at https://goreleaser.com/errors/scoop-archive\n") // nolint: revive
func (e ErrNoWindows) Error() string {
return fmt.Sprintf("scoop requires a windows archive, but no archives matched goos=windows goarch=[386 amd64] goamd64=%s\nLearn more at https://goreleaser.com/errors/scoop-archive\n", e.goamd64) // nolint: revive
}
const scoopConfigExtra = "ScoopConfig"
@ -84,7 +88,7 @@ func doRun(ctx *context.Context, cl client.Client) error {
),
).List()
if len(archives) == 0 {
return ErrNoWindows
return ErrNoWindows{scoop.Goamd64}
}
filename := scoop.Name + ".json"

View File

@ -295,7 +295,7 @@ func Test_doRun(t *testing.T) {
client.NewMock(),
},
[]artifact.Artifact{},
shouldErr(ErrNoWindows.Error()),
shouldErr(ErrNoWindows{"v1"}.Error()),
shouldNotErr,
noAssertions,
},
@ -422,7 +422,7 @@ func Test_doRun(t *testing.T) {
client.NewMock(),
},
[]artifact.Artifact{},
shouldErr(ErrNoWindows.Error()),
shouldErr(ErrNoWindows{"v1"}.Error()),
shouldNotErr,
noAssertions,
},

View File

@ -18,3 +18,6 @@ But this would:
archives:
- format: zip
```
Also notice the `goamd64` options, it must match the one from your build.
By default, only `GOAMD64` `v1` is built.