Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 2 additions & 1 deletion devbox.json
Original file line number Diff line number Diff line change
@@ -1,7 +1,8 @@
{
"packages": [
"go@latest",
"runx:golangci/golangci-lint@latest"
"runx:golangci/golangci-lint@latest",
"runx:mvdan/gofumpt@latest"
],
"env": {
"GOENV": "off",
Expand Down
4 changes: 4 additions & 0 deletions devbox.lock
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,10 @@
"runx:golangci/golangci-lint@latest": {
"resolved": "golangci/golangci-lint@v1.54.2",
"version": "v1.54.2"
},
"runx:mvdan/gofumpt@latest": {
"resolved": "mvdan/gofumpt@v0.5.0",
"version": "v0.5.0"
}
}
}
2 changes: 1 addition & 1 deletion go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@ require (
github.com/stretchr/testify v1.8.4
github.com/wk8/go-ordered-map/v2 v2.1.8
github.com/zealic/go2node v0.1.0
go.jetpack.io/pkg v0.0.0-20231006204718-f59feb213022
go.jetpack.io/pkg v0.0.0-20231010185527-78c6902d51f7
golang.org/x/exp v0.0.0-20220303212507-bbda1eaf7a17
golang.org/x/mod v0.12.0
golang.org/x/sync v0.3.0
Expand Down
2 changes: 2 additions & 0 deletions go.sum
Original file line number Diff line number Diff line change
Expand Up @@ -339,6 +339,8 @@ go.jetpack.io/pkg v0.0.0-20231002215645-9afeb0623fd3 h1:aMydtVCHn7dfotOyV41VAxX5
go.jetpack.io/pkg v0.0.0-20231002215645-9afeb0623fd3/go.mod h1:iaf3e/aENp5luwYFlfCxj+GsiwqHagbvRAY3bIdEgGA=
go.jetpack.io/pkg v0.0.0-20231006204718-f59feb213022 h1:8TRpo0lYh1Y6zec8Px0yXbnVRXXs+yUPU+TnHNsREdA=
go.jetpack.io/pkg v0.0.0-20231006204718-f59feb213022/go.mod h1:iaf3e/aENp5luwYFlfCxj+GsiwqHagbvRAY3bIdEgGA=
go.jetpack.io/pkg v0.0.0-20231010185527-78c6902d51f7 h1:QGNfUfKmGtjPgYNgmXwsUa9+AN7rdcRx3N6Mfy5BXS0=
go.jetpack.io/pkg v0.0.0-20231010185527-78c6902d51f7/go.mod h1:iaf3e/aENp5luwYFlfCxj+GsiwqHagbvRAY3bIdEgGA=
go.opencensus.io v0.21.0/go.mod h1:mSImk1erAIZhrmZN+AvHh14ztQfjbGwt4TtuofqLduU=
go.opencensus.io v0.22.0/go.mod h1:+kGneAE2xo2IficOXnaByMWTGM9T73dGwxeWcUqIpI8=
go.opencensus.io v0.22.2/go.mod h1:yxeiOL68Rb0Xd1ddK5vPZ/oVn4vY4Ynel7k9FzqtOIw=
Expand Down
34 changes: 28 additions & 6 deletions internal/impl/devbox.go
Original file line number Diff line number Diff line change
Expand Up @@ -1210,18 +1210,40 @@ func (d *Devbox) Lockfile() *lock.File {
}

func (d *Devbox) RunXPaths(ctx context.Context) (string, error) {
packages := lo.Filter(d.InstallablePackages(), devpkg.IsRunX)
paths := []string{}
for _, pkg := range packages {
runxBinPath := filepath.Join(d.projectDir, ".devbox", "virtenv", "runx", "bin")
if err := os.RemoveAll(runxBinPath); err != nil {
return "", err
}
if err := os.MkdirAll(runxBinPath, 0o755); err != nil {
return "", err
}

for _, pkg := range d.InstallablePackages() {
if !pkg.IsRunX() {
continue
}
lockedPkg, err := d.lockfile.Resolve(pkg.Raw)
if err != nil {
return "", err
}
p, err := pkgtype.RunXClient().Install(ctx, lockedPkg.Resolved)
paths, err := pkgtype.RunXClient().Install(ctx, lockedPkg.Resolved)
if err != nil {
return "", err
}
paths = append(paths, p...)
for _, path := range paths {
// create symlink to all files in p
files, err := os.ReadDir(path)
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Won't this symlink all files in the archive, including non-binaries? I'm wondering if this will create a bunch of conflicts. For example, if multiple packages have a README in them.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yeah it will, but mostly for files we don't care about. We can fix this later on. (Requires priorities similar to nix)

if err != nil {
return "", err
}
for _, file := range files {
src := filepath.Join(path, file.Name())
dst := filepath.Join(runxBinPath, file.Name())
if err := os.Symlink(src, dst); err != nil && !errors.Is(err, os.ErrExist) {
return "", err
}
}
}
}
return envpath.JoinPathLists(paths...), nil
return runxBinPath, nil
}
6 changes: 1 addition & 5 deletions scripts/gofumpt.sh
Original file line number Diff line number Diff line change
@@ -1,10 +1,6 @@
#!/bin/bash

mkdir -p dist/tools
export GOBIN="$PWD/dist/tools"
go install mvdan.cc/gofumpt@latest

find . -name '*.go' -exec "$GOBIN/gofumpt" -extra -w {} \+
find . -name '*.go' -exec gofumpt -extra -w {} \+

if [ -n "${CI:-}" ]; then
git diff --exit-code
Expand Down