all: replace execabs with os/exec

os/exec no longer searches executablse in the current directory as of
Go 1.19. See https://go.dev/blog/path-security and https://go.dev/issue/43724.
This commit is contained in:
Hajime Hoshi 2024-05-03 23:39:36 +09:00
parent 903ab6727b
commit c658a25171
5 changed files with 5 additions and 6 deletions

View File

@ -23,10 +23,10 @@ import (
"fmt" "fmt"
"log" "log"
"os" "os"
"os/exec"
"path/filepath" "path/filepath"
"strings" "strings"
exec "golang.org/x/sys/execabs"
"golang.org/x/tools/go/packages" "golang.org/x/tools/go/packages"
) )

View File

@ -18,13 +18,13 @@ import (
_ "embed" _ "embed"
"fmt" "fmt"
"os" "os"
"os/exec"
"path/filepath" "path/filepath"
"runtime" "runtime"
"runtime/debug" "runtime/debug"
// Add a dependency on gomobile in order to get the version via debug.ReadBuildInfo(). // Add a dependency on gomobile in order to get the version via debug.ReadBuildInfo().
_ "github.com/ebitengine/gomobile/geom" _ "github.com/ebitengine/gomobile/geom"
exec "golang.org/x/sys/execabs"
) )
//go:embed gobind.go //go:embed gobind.go

View File

@ -27,12 +27,12 @@ import (
"fmt" "fmt"
"log" "log"
"os" "os"
"os/exec"
"path/filepath" "path/filepath"
"strings" "strings"
"text/template" "text/template"
"unicode" "unicode"
exec "golang.org/x/sys/execabs"
"golang.org/x/tools/go/packages" "golang.org/x/tools/go/packages"
) )

View File

@ -23,13 +23,13 @@ import (
"go/parser" "go/parser"
"go/token" "go/token"
"os" "os"
"os/exec"
"path/filepath" "path/filepath"
"regexp" "regexp"
"runtime" "runtime"
"strconv" "strconv"
"strings" "strings"
exec "golang.org/x/sys/execabs"
"golang.org/x/tools/go/ast/astutil" "golang.org/x/tools/go/ast/astutil"
) )

View File

@ -20,14 +20,13 @@ import (
"bytes" "bytes"
"context" "context"
"os" "os"
"os/exec"
"path/filepath" "path/filepath"
"runtime" "runtime"
"strings" "strings"
"sync" "sync"
"testing" "testing"
"time" "time"
exec "golang.org/x/sys/execabs"
) )
func isWSL() (bool, error) { func isWSL() (bool, error) {