Skip to content

Commit

Permalink
update k6foundry v0.4.0
Browse files Browse the repository at this point in the history
Signed-off-by: Pablo Chacin <[email protected]>
  • Loading branch information
pablochacin committed Feb 4, 2025
1 parent 885fda1 commit 60f6cbc
Show file tree
Hide file tree
Showing 3 changed files with 17 additions and 12 deletions.
17 changes: 11 additions & 6 deletions build.go
Original file line number Diff line number Diff line change
Expand Up @@ -42,15 +42,15 @@ func detectChange(reg registry.Registry, latest string) (bool, *semver.Version,
return !bumped.Equal(version), bumped, nil
}

func newBuilder(ctx context.Context, modules registry.Modules) (k6foundry.Builder, error) {
func newBuilder(ctx context.Context, modules registry.Modules) (k6foundry.Foundry, error) {
cgo := "0"
if modules.Cgo() {
cgo = "1"
}

return k6foundry.NewNativeBuilder(
return k6foundry.NewNativeFoundry(
ctx,
k6foundry.NativeBuilderOpts{
k6foundry.NativeFoundryOpts{
Logger: slog.Default(),
Stdout: os.Stdout, //nolint:forbidigo
Stderr: os.Stderr, //nolint:forbidigo
Expand Down Expand Up @@ -140,7 +140,7 @@ func Build(ctx context.Context, opts *Options) (bool, *semver.Version, error) {

func buildExecutable(
ctx context.Context,
builder k6foundry.Builder,
foundry k6foundry.Foundry,
platform *Platform,
k6Version string,
mods []k6foundry.Module,
Expand All @@ -151,11 +151,16 @@ func buildExecutable(
return err
}

_, err = builder.Build(
foundryPlatform, err := k6foundry.ParsePlatform(platform.String())
if err != nil {
return err
}
_, err = foundry.Build(
ctx,
k6foundry.NewPlatform(platform.OS, platform.Arch),
foundryPlatform,
k6Version,
mods,
[]k6foundry.Module{},
[]string{`-ldflags`, `-s -w`},
file,
)
Expand Down
4 changes: 2 additions & 2 deletions go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ require (
github.com/go-task/slim-sprig/v3 v3.0.0
github.com/google/shlex v0.0.0-20191202100458-e7afc7fbc510
github.com/grafana/clireadme v0.1.0
github.com/grafana/k6foundry v0.3.0
github.com/grafana/k6foundry v0.4.0
github.com/samber/slog-logrus/v2 v2.5.2
github.com/sirupsen/logrus v1.9.3
github.com/spf13/cobra v1.8.1
Expand All @@ -18,7 +18,7 @@ require (
github.com/inconshreveable/mousetrap v1.1.0 // indirect
github.com/samber/lo v1.47.0 // indirect
github.com/samber/slog-common v0.18.1 // indirect
golang.org/x/mod v0.21.0 // indirect
golang.org/x/mod v0.22.0 // indirect
golang.org/x/sys v0.1.0 // indirect
golang.org/x/text v0.16.0 // indirect
)
8 changes: 4 additions & 4 deletions go.sum
Original file line number Diff line number Diff line change
Expand Up @@ -10,8 +10,8 @@ github.com/google/shlex v0.0.0-20191202100458-e7afc7fbc510 h1:El6M4kTTCOh6aBiKaU
github.com/google/shlex v0.0.0-20191202100458-e7afc7fbc510/go.mod h1:pupxD2MaaD3pAXIBCelhxNneeOaAeabZDe5s4K6zSpQ=
github.com/grafana/clireadme v0.1.0 h1:KYEYSnYdSzmHf3bufaK6fQZ5j4dzvM/T+G6Ba+qNnAM=
github.com/grafana/clireadme v0.1.0/go.mod h1:Wy4KIG2ZBGMYAYyF9l7qAy+yoJVasqk/txsRgoRI3gc=
github.com/grafana/k6foundry v0.3.0 h1:C+6dPbsOv7Uq4hEhBFNuYqmTdE9jQ0VqhXqBDtMkVTE=
github.com/grafana/k6foundry v0.3.0/go.mod h1:/NtBSQQgXup5SVbfInl0Q8zKVx08xgvXIZ0xncqexEs=
github.com/grafana/k6foundry v0.4.0 h1:Gh8oMaW02VHWxrGBHKLq3fvGa5LKMI0Z2feK2Ukkzw0=
github.com/grafana/k6foundry v0.4.0/go.mod h1:4Hw0ll6ZsKN8f3cgp7I4N6EkhXafZ6CBC6fDJWkW7/Q=
github.com/inconshreveable/mousetrap v1.1.0 h1:wN+x4NVGpMsO7ErUn/mUI3vEoE6Jt13X2s0bqwp9tc8=
github.com/inconshreveable/mousetrap v1.1.0/go.mod h1:vpF70FUmC8bwa3OWnCshd2FqLfsEA9PFc4w1p2J65bw=
github.com/pmezard/go-difflib v1.0.0 h1:4DBwDE0NGyQoBHbLQYPwSUPoCMWR5BEzIk/f1lZbAQM=
Expand All @@ -33,8 +33,8 @@ github.com/stretchr/objx v0.1.0/go.mod h1:HFkY916IF+rwdDfMAkV7OtwuqBVzrE8GR6GFx+
github.com/stretchr/testify v1.7.0/go.mod h1:6Fq8oRcR53rry900zMqJjRRixrwX3KX962/h/Wwjteg=
github.com/stretchr/testify v1.10.0 h1:Xv5erBjTwe/5IxqUQTdXv5kgmIvbHo3QQyRwhJsOfJA=
github.com/stretchr/testify v1.10.0/go.mod h1:r2ic/lqez/lEtzL7wO/rwa5dbSLXVDPFyf8C91i36aY=
golang.org/x/mod v0.21.0 h1:vvrHzRwRfVKSiLrG+d4FMl/Qi4ukBCE6kZlTUkDYRT0=
golang.org/x/mod v0.21.0/go.mod h1:6SkKJ3Xj0I0BrPOZoBy3bdMptDDU9oJrpohJ3eWZ1fY=
golang.org/x/mod v0.22.0 h1:D4nJWe9zXqHOmWqj4VMOJhvzj7bEZg4wEYa759z1pH4=
golang.org/x/mod v0.22.0/go.mod h1:6SkKJ3Xj0I0BrPOZoBy3bdMptDDU9oJrpohJ3eWZ1fY=
golang.org/x/sys v0.0.0-20220715151400-c0bba94af5f8/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg=
golang.org/x/sys v0.1.0 h1:kunALQeHf1/185U1i0GOB/fy1IPRDDpuoOOqRReG57U=
golang.org/x/sys v0.1.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg=
Expand Down

0 comments on commit 60f6cbc

Please sign in to comment.