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 28, 2023
1 parent 046f038 commit 57a877c
Show file tree
Hide file tree
Showing 4 changed files with 13 additions and 16 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/go-releaser.yml
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ jobs:
cache: true
- uses: sigstore/[email protected]
- uses: anchore/sbom-action/[email protected]
- uses: goreleaser/goreleaser-action@v4
- uses: goreleaser/goreleaser-action@v5
with:
distribution: goreleaser
version: latest
Expand Down
15 changes: 3 additions & 12 deletions .goreleaser.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -44,23 +44,14 @@ changelog:
- Merge branch
- go mod tidy
groups:
- title: Dependency updates
regexp: '^.*?(feat|fix)\(deps\)!?:.+$'
order: 300
- title: "New Features"
regexp: '^.*?feat(\([[:word:]]+\))??!?:.+$'
regexp: '^feat:'
order: 100
- title: "Security updates"
regexp: '^.*?sec(\([[:word:]]+\))??!?:.+$'
order: 150
- title: "Bug fixes"
regexp: '^.*?fix(\([[:word:]]+\))??!?:.+$'
regexp: '^fix:'
order: 200
- title: "Documentation updates"
regexp: ^.*?doc(\([[:word:]]+\))??!?:.+$
order: 400
- title: "Build process updates"
regexp: ^.*?build(\([[:word:]]+\))??!?:.+$
regexp: '^doc:'
order: 400
- title: Other work
order: 9999
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 57a877c

Please sign in to comment.