Skip to content

Commit

Permalink
refactor: enhance dependency installation logic and bump version (#27)
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 authored Dec 10, 2024
2 parents dee5627 + 106d8c5 commit 5a983bb
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 7 deletions.
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 5a983bb

Please sign in to comment.