Skip to content

Commit

Permalink
simplify error message
Browse files Browse the repository at this point in the history
  • Loading branch information
savil committed Aug 11, 2023
1 parent e731e0f commit 5191dfb
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 12 deletions.
4 changes: 0 additions & 4 deletions internal/nix/nix.go
Original file line number Diff line number Diff line change
Expand Up @@ -190,10 +190,6 @@ var nixPlatforms = []string{
"armv7l-linux",
}

func SupportedPlatforms() []string {
return nixPlatforms
}

// EnsureValidPlatform returns an error if the platform is not supported by nix.
// https://nixos.org/manual/nix/stable/installation/supported-platforms.html
func EnsureValidPlatform(platform string) error {
Expand Down
10 changes: 2 additions & 8 deletions internal/nix/nixprofile/profile.go
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,6 @@ import (

"github.com/fatih/color"
"github.com/pkg/errors"
"github.com/samber/lo"
"go.jetpack.io/devbox/internal/boxcli/usererr"
"go.jetpack.io/devbox/internal/devpkg"
"go.jetpack.io/devbox/internal/lock"
Expand Down Expand Up @@ -272,16 +271,11 @@ func ProfileInstall(args *ProfileInstallArgs) error {
} else {
platform = " " + platform
}
otherPlatforms := lo.Filter(nix.SupportedPlatforms(), func(p string, _ int) bool {
return p != strings.TrimSpace(platform)
})
return usererr.New(
"package %s cannot be installed on your platform%s. "+
"Consider using `--platform` or `--exclude-platform` with `devbox add` to install on a supported"+
" platform. Other available platforms are: %s.",
input.String(),
"Run `devbox add %[1]s --exclude-platform%[2]s` and re-try.",
input.Raw,
platform,
strings.Join(otherPlatforms, ", "),
)
}
}
Expand Down

0 comments on commit 5191dfb

Please sign in to comment.