Skip to content

Commit

Permalink
fix: replace Split with SplitN when handle sdk path to avoid parse pa…
Browse files Browse the repository at this point in the history
…th failed as the version of target sdk include '-'.
  • Loading branch information
aooohan committed Dec 27, 2023
1 parent 046f038 commit bc585d0
Show file tree
Hide file tree
Showing 3 changed files with 10 additions and 4 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/go-releaser.yml
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ jobs:
with:
distribution: goreleaser
version: latest
args: release --clean ${{ env.flags }}
args: release --clean --release-notes ${{ env.flags }}
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
COSIGN_PWD: ${{ secrets.COSIGN_PWD }}
Expand Down
5 changes: 3 additions & 2 deletions cmd/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -17,17 +17,18 @@
package main

import (
"github.com/pterm/pterm"
"os"
"os/signal"
"strings"
"syscall"

"github.com/pterm/pterm"

"github.com/urfave/cli/v2"
"github.com/version-fox/vfox/sdk"
)

const Version = "0.1.0"
const Version = "0.1.1"

func main() {
cli.VersionFlag = &cli.BoolFlag{
Expand Down
7 changes: 6 additions & 1 deletion sdk/sdk.go
Original file line number Diff line number Diff line change
Expand Up @@ -265,7 +265,7 @@ func (b *Sdk) getLocalSdkPackage(version Version) (*Package, error) {
}
for _, d := range dir {
if d.IsDir() {
split := strings.Split(d.Name(), "-")
split := strings.SplitN(d.Name(), "-", 2)
if len(split) != 2 {
continue
}
Expand All @@ -285,6 +285,11 @@ func (b *Sdk) getLocalSdkPackage(version Version) (*Package, error) {
if err != nil {
return nil, err
}

if mainSdk.Path == "" {
return nil, errors.New("main sdk not found")

}
return &Package{
Main: mainSdk,
Additional: additional,
Expand Down

0 comments on commit bc585d0

Please sign in to comment.