Skip to content

Commit

Permalink
refactor: enhance dependency installation logic and bump version
Browse files Browse the repository at this point in the history
- Updated the `packages` struct to include an `args` field for
additional Go install arguments.
- Adjusted `PackagesForInstall` to specify tags for `golang-migrate`
and allow extensibility for other dependencies.
- Modified `GoInstall` calls to accommodate the new `args` field,
enabling flexible command composition.
- Incremented the application version from `v0.7.0` to `v0.7.1`.
  • Loading branch information
renanbastos93 committed Dec 10, 2024
1 parent dee5627 commit d449755
Show file tree
Hide file tree
Showing 3 changed files with 63 additions and 7 deletions.
54 changes: 54 additions & 0 deletions a.diff
Original file line number Diff line number Diff line change
@@ -0,0 +1,54 @@
diff --git a/internal/intall_deps.go b/internal/intall_deps.go
index 8bc06b4..6ea0f3e 100644
--- a/internal/intall_deps.go
+++ b/internal/intall_deps.go
@@ -5,13 +5,15 @@ import (
)

type packages struct {
- name, pkg string
+ name string
+ pkg string
+ args []string
}

var PackagesForInstall = []packages{
- {"golang-migrate", "github.com/golang-migrate/migrate/v4/cmd/migrate@latest"},
- {"sqlc", "github.com/sqlc-dev/sqlc/cmd/sqlc@latest"},
- {"weaver", "github.com/ServiceWeaver/weaver/cmd/weaver@latest"},
+ {"golang-migrate", "github.com/golang-migrate/migrate/v4/cmd/migrate@latest", []string{"-tags", "mysql sqlite3"}},
+ {"sqlc", "github.com/sqlc-dev/sqlc/cmd/sqlc@latest", nil},
+ {"weaver", "github.com/ServiceWeaver/weaver/cmd/weaver@latest", nil},
}

func InstallDeps(name string) {
@@ -32,7 +34,7 @@ func installDeps(packages ...packages) {
println(p.name, "already installed!")
continue
}
- GoInstall(p.name, p.pkg)
+ GoInstall(p.name, append(p.args, p.pkg)...)
}
}

@@ -64,6 +66,6 @@ func UpdateDeps(name string) {

func updateDeps(packages ...packages) {
for _, p := range packages {
- GoInstall(p.name, p.pkg)
+ GoInstall(p.name, append(p.args, p.pkg)...)
}
}
diff --git a/internal/version.go b/internal/version.go
index b2e13e2..99c3d81 100644
--- a/internal/version.go
+++ b/internal/version.go
@@ -9,7 +9,7 @@ import (
"golang.org/x/mod/semver"
)

-const Version = "v0.7.0"
+const Version = "v0.7.1"

func ValidateLatestVersion() {
cmd := exec.Command(goCLI, "list", "-m", "github.com/renanbastos93/boneless@latest")
14 changes: 8 additions & 6 deletions internal/intall_deps.go
Original file line number Diff line number Diff line change
Expand Up @@ -5,13 +5,15 @@ import (
)

type packages struct {
name, pkg string
name string
pkg string
args []string
}

var PackagesForInstall = []packages{
{"golang-migrate", "github.com/golang-migrate/migrate/v4/cmd/migrate@latest"},
{"sqlc", "github.com/sqlc-dev/sqlc/cmd/sqlc@latest"},
{"weaver", "github.com/ServiceWeaver/weaver/cmd/weaver@latest"},
{"golang-migrate", "github.com/golang-migrate/migrate/v4/cmd/migrate@latest", []string{"-tags", "mysql sqlite3"}},
{"sqlc", "github.com/sqlc-dev/sqlc/cmd/sqlc@latest", nil},
{"weaver", "github.com/ServiceWeaver/weaver/cmd/weaver@latest", nil},
}

func InstallDeps(name string) {
Expand All @@ -32,7 +34,7 @@ func installDeps(packages ...packages) {
println(p.name, "already installed!")
continue
}
GoInstall(p.name, p.pkg)
GoInstall(p.name, append(p.args, p.pkg)...)
}
}

Expand Down Expand Up @@ -64,6 +66,6 @@ func UpdateDeps(name string) {

func updateDeps(packages ...packages) {
for _, p := range packages {
GoInstall(p.name, p.pkg)
GoInstall(p.name, append(p.args, p.pkg)...)
}
}
2 changes: 1 addition & 1 deletion internal/version.go
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ import (
"golang.org/x/mod/semver"
)

const Version = "v0.7.0"
const Version = "v0.7.1"

func ValidateLatestVersion() {
cmd := exec.Command(goCLI, "list", "-m", "github.com/renanbastos93/boneless@latest")
Expand Down

0 comments on commit d449755

Please sign in to comment.