Skip to content

Commit

Permalink
feat: support gopls check
Browse files Browse the repository at this point in the history
  • Loading branch information
joaoeinride committed Feb 14, 2025
1 parent f33c9ad commit ea6326b
Showing 1 changed file with 32 additions and 0 deletions.
32 changes: 32 additions & 0 deletions tools/sggopls/tools.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
package sggopls

import (
"context"
"os/exec"

"go.einride.tech/sage/sg"
"go.einride.tech/sage/sgtool"
)

const (
name = "gopls"
version = "v0.17.1"
)

// Check runs `gopls check <PATH1> <PATH2>`.
// gopls only works with paths to go files.
func Check(ctx context.Context, paths []string) *exec.Cmd {
sg.Deps(ctx, PrepareCommand)
args := []string{"check"}
args = append(args, paths...)
return sg.Command(
ctx,
name,
args...,
)
}

func PrepareCommand(ctx context.Context) error {
_, err := sgtool.GoInstall(ctx, "golang.org/x/tools/gopls", version)
return err
}

0 comments on commit ea6326b

Please sign in to comment.