update linters for go1.25 base version
Signed-off-by: Tonis Tiigi <tonistiigi@gmail.com>
This commit is contained in:
@@ -87,6 +87,9 @@ linters:
|
|||||||
- linters:
|
- linters:
|
||||||
- revive
|
- revive
|
||||||
text: stutters
|
text: stutters
|
||||||
|
- linters:
|
||||||
|
- revive
|
||||||
|
text: var-naming
|
||||||
- linters:
|
- linters:
|
||||||
- revive
|
- revive
|
||||||
text: empty-block
|
text: empty-block
|
||||||
|
|||||||
@@ -140,11 +140,11 @@ func getFieldTags(ty reflect.Type) *fieldTags {
|
|||||||
continue
|
continue
|
||||||
}
|
}
|
||||||
|
|
||||||
comma := strings.Index(tag, ",")
|
before, after, ok := strings.Cut(tag, ",")
|
||||||
var name, kind string
|
var name, kind string
|
||||||
if comma != -1 {
|
if ok {
|
||||||
name = tag[:comma]
|
name = before
|
||||||
kind = tag[comma+1:]
|
kind = after
|
||||||
} else {
|
} else {
|
||||||
name = tag
|
name = tag
|
||||||
kind = "attr"
|
kind = "attr"
|
||||||
|
|||||||
@@ -9,11 +9,8 @@ import (
|
|||||||
"github.com/hashicorp/hcl/v2"
|
"github.com/hashicorp/hcl/v2"
|
||||||
)
|
)
|
||||||
|
|
||||||
var victimExpr hcl.Expression
|
var exprType = reflect.TypeFor[hcl.Expression]()
|
||||||
var victimBody hcl.Body
|
var bodyType = reflect.TypeFor[hcl.Body]()
|
||||||
|
var blockType = reflect.TypeFor[*hcl.Block]() //nolint:unused
|
||||||
var exprType = reflect.TypeOf(&victimExpr).Elem()
|
var attrType = reflect.TypeFor[*hcl.Attribute]()
|
||||||
var bodyType = reflect.TypeOf(&victimBody).Elem()
|
var attrsType = reflect.TypeFor[hcl.Attributes]()
|
||||||
var blockType = reflect.TypeOf((*hcl.Block)(nil)) //nolint:unused
|
|
||||||
var attrType = reflect.TypeOf((*hcl.Attribute)(nil))
|
|
||||||
var attrsType = reflect.TypeOf(hcl.Attributes(nil))
|
|
||||||
|
|||||||
@@ -34,7 +34,6 @@ func TestIndexOf(t *testing.T) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
for name, test := range tests {
|
for name, test := range tests {
|
||||||
name, test := name, test
|
|
||||||
t.Run(name, func(t *testing.T) {
|
t.Run(name, func(t *testing.T) {
|
||||||
got, err := indexOfFunc().Call([]cty.Value{test.input, test.key})
|
got, err := indexOfFunc().Call([]cty.Value{test.input, test.key})
|
||||||
if test.wantErr {
|
if test.wantErr {
|
||||||
@@ -85,7 +84,6 @@ func TestBasename(t *testing.T) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
for name, test := range tests {
|
for name, test := range tests {
|
||||||
name, test := name, test
|
|
||||||
t.Run(name, func(t *testing.T) {
|
t.Run(name, func(t *testing.T) {
|
||||||
got, err := basenameFunc().Call([]cty.Value{test.input})
|
got, err := basenameFunc().Call([]cty.Value{test.input})
|
||||||
if test.wantErr {
|
if test.wantErr {
|
||||||
@@ -136,7 +134,6 @@ func TestDirname(t *testing.T) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
for name, test := range tests {
|
for name, test := range tests {
|
||||||
name, test := name, test
|
|
||||||
t.Run(name, func(t *testing.T) {
|
t.Run(name, func(t *testing.T) {
|
||||||
got, err := dirnameFunc().Call([]cty.Value{test.input})
|
got, err := dirnameFunc().Call([]cty.Value{test.input})
|
||||||
if test.wantErr {
|
if test.wantErr {
|
||||||
@@ -190,7 +187,6 @@ func TestSanitize(t *testing.T) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
for name, test := range tests {
|
for name, test := range tests {
|
||||||
name, test := name, test
|
|
||||||
t.Run(name, func(t *testing.T) {
|
t.Run(name, func(t *testing.T) {
|
||||||
got, err := sanitizeFunc().Call([]cty.Value{test.input})
|
got, err := sanitizeFunc().Call([]cty.Value{test.input})
|
||||||
require.NoError(t, err)
|
require.NoError(t, err)
|
||||||
@@ -251,7 +247,6 @@ func TestSemverCmp(t *testing.T) {
|
|||||||
},
|
},
|
||||||
}
|
}
|
||||||
for name, test := range tests {
|
for name, test := range tests {
|
||||||
name, test := name, test
|
|
||||||
t.Run(name, func(t *testing.T) {
|
t.Run(name, func(t *testing.T) {
|
||||||
got, err := semvercmpFunc().Call([]cty.Value{test.version, test.constraint})
|
got, err := semvercmpFunc().Call([]cty.Value{test.version, test.constraint})
|
||||||
if test.wantErr {
|
if test.wantErr {
|
||||||
|
|||||||
@@ -133,8 +133,8 @@ func impliedStructType(rt reflect.Type, path cty.Path) (cty.Type, error) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
var (
|
var (
|
||||||
valueType = reflect.TypeOf(cty.Value{})
|
valueType = reflect.TypeFor[cty.Value]()
|
||||||
stringType = reflect.TypeOf("")
|
stringType = reflect.TypeFor[string]()
|
||||||
)
|
)
|
||||||
|
|
||||||
// structTagIndices interrogates the fields of the given type (which must
|
// structTagIndices interrogates the fields of the given type (which must
|
||||||
|
|||||||
@@ -395,7 +395,6 @@ func BuildWithResultHandler(ctx context.Context, nodes []builder.Node, opts map[
|
|||||||
var insecurePush bool
|
var insecurePush bool
|
||||||
|
|
||||||
for i, dp := range dps {
|
for i, dp := range dps {
|
||||||
i, dp := i, dp
|
|
||||||
node := dp.Node()
|
node := dp.Node()
|
||||||
so := reqForNodes[k][i].so
|
so := reqForNodes[k][i].so
|
||||||
if multiDriver {
|
if multiDriver {
|
||||||
|
|||||||
@@ -131,7 +131,6 @@ func (r *nodeResolver) Resolve(ctx context.Context, optPlatforms map[string][]oc
|
|||||||
eg, egCtx := errgroup.WithContext(ctx)
|
eg, egCtx := errgroup.WithContext(ctx)
|
||||||
workers := make([][]ocispecs.Platform, len(clients))
|
workers := make([][]ocispecs.Platform, len(clients))
|
||||||
for i, c := range clients {
|
for i, c := range clients {
|
||||||
i, c := i, c
|
|
||||||
if c == nil {
|
if c == nil {
|
||||||
continue
|
continue
|
||||||
}
|
}
|
||||||
@@ -269,7 +268,6 @@ func (r *nodeResolver) boot(ctx context.Context, idxs []int, pw progress.Writer)
|
|||||||
eg, ctx := errgroup.WithContext(ctx)
|
eg, ctx := errgroup.WithContext(ctx)
|
||||||
|
|
||||||
for i, idx := range idxs {
|
for i, idx := range idxs {
|
||||||
i, idx := i, idx
|
|
||||||
eg.Go(func() error {
|
eg.Go(func() error {
|
||||||
c, err := r.clients.g.Do(ctx, fmt.Sprint(idx), func(ctx context.Context) (*client.Client, error) {
|
c, err := r.clients.g.Do(ctx, fmt.Sprint(idx), func(ctx context.Context) (*client.Client, error) {
|
||||||
if r.nodes[idx].Driver == nil {
|
if r.nodes[idx].Driver == nil {
|
||||||
|
|||||||
+2
-1
@@ -102,7 +102,8 @@ func dapAttachCmd() *cobra.Command {
|
|||||||
return err
|
return err
|
||||||
}
|
}
|
||||||
|
|
||||||
conn, err := net.Dial("unix", args[0])
|
dialer := net.Dialer{}
|
||||||
|
conn, err := dialer.DialContext(cmd.Context(), "unix", args[0])
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return err
|
return err
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -156,7 +156,8 @@ func runTrace(ctx context.Context, dockerCli command.Cli, opts traceOptions) err
|
|||||||
return nil
|
return nil
|
||||||
}
|
}
|
||||||
|
|
||||||
ln, err := net.Listen("tcp", opts.addr)
|
lc := net.ListenConfig{}
|
||||||
|
ln, err := lc.Listen(ctx, "tcp", opts.addr)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return err
|
return err
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -425,8 +425,8 @@ func timeBasedFilter(key, value, sep string) (matchFunc, error) {
|
|||||||
|
|
||||||
func cutAny(s string, seps ...string) (before, after, sep string, found bool) {
|
func cutAny(s string, seps ...string) (before, after, sep string, found bool) {
|
||||||
for _, sep := range seps {
|
for _, sep := range seps {
|
||||||
if idx := strings.Index(s, sep); idx != -1 {
|
if before0, after0, ok := strings.Cut(s, sep); ok {
|
||||||
return s[:idx], s[idx+len(sep):], sep, true
|
return before0, after0, sep, true
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
return s, "", "", false
|
return s, "", "", false
|
||||||
|
|||||||
+2
-1
@@ -77,7 +77,8 @@ func (s *shell) listen() error {
|
|||||||
}()
|
}()
|
||||||
s.SocketPath = filepath.Join(dir, "s.sock")
|
s.SocketPath = filepath.Join(dir, "s.sock")
|
||||||
|
|
||||||
s.l, s.err = net.Listen("unix", s.SocketPath)
|
lc := net.ListenConfig{}
|
||||||
|
s.l, s.err = lc.Listen(context.Background(), "unix", s.SocketPath)
|
||||||
if s.err != nil {
|
if s.err != nil {
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
|||||||
+2
-1
@@ -120,7 +120,8 @@ func (t *thread) Exec(ctx Context, args []string) (message string, retErr error)
|
|||||||
}()
|
}()
|
||||||
|
|
||||||
socketPath := filepath.Join(dir, "s.sock")
|
socketPath := filepath.Join(dir, "s.sock")
|
||||||
l, err := net.Listen("unix", socketPath)
|
lc := net.ListenConfig{}
|
||||||
|
l, err := lc.Listen(ctx, "unix", socketPath)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return "", err
|
return "", err
|
||||||
}
|
}
|
||||||
|
|||||||
+2
-4
@@ -355,11 +355,9 @@ func (t *thread) prepareResultHandle(c Context, ref gateway.Reference, err error
|
|||||||
|
|
||||||
// Start the attach. Use the context we created and perform it in
|
// Start the attach. Use the context we created and perform it in
|
||||||
// a goroutine. We aren't necessarily assuming this will actually work.
|
// a goroutine. We aren't necessarily assuming this will actually work.
|
||||||
wg.Add(1)
|
wg.Go(func() {
|
||||||
go func() {
|
|
||||||
defer wg.Done()
|
|
||||||
t.sh.Attach(ctx, t)
|
t.sh.Attach(ctx, t)
|
||||||
}()
|
})
|
||||||
}
|
}
|
||||||
|
|
||||||
func (t *thread) Continue() {
|
func (t *thread) Continue() {
|
||||||
|
|||||||
+3
-3
@@ -135,9 +135,9 @@ func generateBakeStdlibDocs(filename string) error {
|
|||||||
}
|
}
|
||||||
currentContent := string(dt)
|
currentContent := string(dt)
|
||||||
|
|
||||||
start := strings.Index(currentContent, "<!---MARKER_STDLIB_START-->")
|
before, _, ok := strings.Cut(currentContent, "<!---MARKER_STDLIB_START-->")
|
||||||
end := strings.Index(currentContent, "<!---MARKER_STDLIB_END-->")
|
end := strings.Index(currentContent, "<!---MARKER_STDLIB_END-->")
|
||||||
if start == -1 {
|
if !ok {
|
||||||
return errors.Errorf("no start marker in %s", filename)
|
return errors.Errorf("no start marker in %s", filename)
|
||||||
}
|
}
|
||||||
if end == -1 {
|
if end == -1 {
|
||||||
@@ -164,7 +164,7 @@ func generateBakeStdlibDocs(filename string) error {
|
|||||||
table.AddRow(fname, fdesc)
|
table.AddRow(fname, fdesc)
|
||||||
}
|
}
|
||||||
|
|
||||||
newContent := currentContent[:start] + "<!---MARKER_STDLIB_START-->\n\n" + table.String() + "\n" + currentContent[end:]
|
newContent := before + "<!---MARKER_STDLIB_START-->\n\n" + table.String() + "\n" + currentContent[end:]
|
||||||
return os.WriteFile(filename, []byte(newContent), 0644)
|
return os.WriteFile(filename, []byte(newContent), 0644)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -1,5 +1,4 @@
|
|||||||
//go:build !windows
|
//go:build !windows
|
||||||
// +build !windows
|
|
||||||
|
|
||||||
package remoteutil
|
package remoteutil
|
||||||
|
|
||||||
|
|||||||
@@ -1,6 +1,6 @@
|
|||||||
module github.com/docker/buildx
|
module github.com/docker/buildx
|
||||||
|
|
||||||
go 1.24.3
|
go 1.25.0
|
||||||
|
|
||||||
require (
|
require (
|
||||||
github.com/Masterminds/semver/v3 v3.4.0
|
github.com/Masterminds/semver/v3 v3.4.0
|
||||||
|
|||||||
@@ -4,9 +4,9 @@ ARG GO_VERSION=1.25
|
|||||||
ARG ALPINE_VERSION=3.22
|
ARG ALPINE_VERSION=3.22
|
||||||
ARG XX_VERSION=1.7.0
|
ARG XX_VERSION=1.7.0
|
||||||
|
|
||||||
ARG GOLANGCI_LINT_VERSION=v2.1.5
|
ARG GOLANGCI_LINT_VERSION=v2.8.0
|
||||||
ARG GOLANGCI_FROM_SOURCE=false
|
ARG GOLANGCI_FROM_SOURCE=false
|
||||||
ARG GOPLS_VERSION=v0.33.0
|
ARG GOPLS_VERSION=v0.40.0
|
||||||
# GOPLS_ANALYZERS defines gopls analyzers to be run. disabled by default: deprecated simplifyrange unusedfunc unusedvariable
|
# GOPLS_ANALYZERS defines gopls analyzers to be run. disabled by default: deprecated simplifyrange unusedfunc unusedvariable
|
||||||
ARG GOPLS_ANALYZERS="embeddirective fillreturns infertypeargs maprange modernize nonewvars noresultvalues simplifycompositelit simplifyslice unusedparams yield"
|
ARG GOPLS_ANALYZERS="embeddirective fillreturns infertypeargs maprange modernize nonewvars noresultvalues simplifycompositelit simplifyslice unusedparams yield"
|
||||||
|
|
||||||
@@ -60,16 +60,30 @@ RUN <<'EOF'
|
|||||||
mkdir -p /out
|
mkdir -p /out
|
||||||
for analyzer in ${GOPLS_ANALYZERS}; do
|
for analyzer in ${GOPLS_ANALYZERS}; do
|
||||||
mkdir -p internal/cmd/$analyzer
|
mkdir -p internal/cmd/$analyzer
|
||||||
cat <<eot > internal/cmd/$analyzer/main.go
|
if [ "$analyzer" = "modernize" ]; then
|
||||||
|
cat <<'eot' > internal/cmd/$analyzer/main.go
|
||||||
|
package main
|
||||||
|
|
||||||
|
import (
|
||||||
|
"golang.org/x/tools/go/analysis/multichecker"
|
||||||
|
"golang.org/x/tools/go/analysis/passes/modernize"
|
||||||
|
)
|
||||||
|
|
||||||
|
func main() { multichecker.Main(modernize.Suite...) }
|
||||||
|
eot
|
||||||
|
else
|
||||||
|
pkg="golang.org/x/tools/gopls/internal/analysis/$analyzer"
|
||||||
|
cat <<eot > internal/cmd/$analyzer/main.go
|
||||||
package main
|
package main
|
||||||
|
|
||||||
import (
|
import (
|
||||||
"golang.org/x/tools/go/analysis/singlechecker"
|
"golang.org/x/tools/go/analysis/singlechecker"
|
||||||
analyzer "golang.org/x/tools/gopls/internal/analysis/$analyzer"
|
analyzer "${pkg}"
|
||||||
)
|
)
|
||||||
|
|
||||||
func main() { singlechecker.Main(analyzer.Analyzer) }
|
func main() { singlechecker.Main(analyzer.Analyzer) }
|
||||||
eot
|
eot
|
||||||
|
fi
|
||||||
echo "Analyzing with ${analyzer}..."
|
echo "Analyzing with ${analyzer}..."
|
||||||
go build -o /out/$analyzer ./internal/cmd/$analyzer
|
go build -o /out/$analyzer ./internal/cmd/$analyzer
|
||||||
done
|
done
|
||||||
|
|||||||
@@ -1,6 +1,7 @@
|
|||||||
package tests
|
package tests
|
||||||
|
|
||||||
import (
|
import (
|
||||||
|
"context"
|
||||||
"os"
|
"os"
|
||||||
"os/exec"
|
"os/exec"
|
||||||
"path/filepath"
|
"path/filepath"
|
||||||
@@ -49,7 +50,7 @@ func withDir(dir string) cmdOpt {
|
|||||||
}
|
}
|
||||||
|
|
||||||
func buildxCmd(sb integration.Sandbox, opts ...cmdOpt) *exec.Cmd {
|
func buildxCmd(sb integration.Sandbox, opts ...cmdOpt) *exec.Cmd {
|
||||||
cmd := exec.Command("buildx")
|
cmd := exec.CommandContext(context.TODO(), "buildx")
|
||||||
cmd.Env = os.Environ()
|
cmd.Env = os.Environ()
|
||||||
for _, opt := range opts {
|
for _, opt := range opts {
|
||||||
opt(cmd)
|
opt(cmd)
|
||||||
@@ -76,7 +77,7 @@ func buildxCmd(sb integration.Sandbox, opts ...cmdOpt) *exec.Cmd {
|
|||||||
}
|
}
|
||||||
|
|
||||||
func composeCmd(sb integration.Sandbox, opts ...cmdOpt) *exec.Cmd {
|
func composeCmd(sb integration.Sandbox, opts ...cmdOpt) *exec.Cmd {
|
||||||
cmd := exec.Command("compose")
|
cmd := exec.CommandContext(context.TODO(), "compose")
|
||||||
cmd.Env = os.Environ()
|
cmd.Env = os.Environ()
|
||||||
for _, opt := range opts {
|
for _, opt := range opts {
|
||||||
opt(cmd)
|
opt(cmd)
|
||||||
@@ -100,7 +101,7 @@ func composeCmd(sb integration.Sandbox, opts ...cmdOpt) *exec.Cmd {
|
|||||||
}
|
}
|
||||||
|
|
||||||
func dockerCmd(sb integration.Sandbox, opts ...cmdOpt) *exec.Cmd {
|
func dockerCmd(sb integration.Sandbox, opts ...cmdOpt) *exec.Cmd {
|
||||||
cmd := exec.Command("docker")
|
cmd := exec.CommandContext(context.TODO(), "docker")
|
||||||
cmd.Env = os.Environ()
|
cmd.Env = os.Environ()
|
||||||
for _, opt := range opts {
|
for _, opt := range opts {
|
||||||
opt(cmd)
|
opt(cmd)
|
||||||
@@ -200,10 +201,10 @@ func buildkitVersion(t *testing.T, sb integration.Sandbox) string {
|
|||||||
os.RemoveAll(destDir)
|
os.RemoveAll(destDir)
|
||||||
})
|
})
|
||||||
|
|
||||||
cmd := exec.Command(undockBin, "--cachedir", "/root/.cache/undock", "--include", "/usr/bin/buildkitd", "--rm-dist", buildkitImage, destDir)
|
cmd := exec.CommandContext(context.TODO(), undockBin, "--cachedir", "/root/.cache/undock", "--include", "/usr/bin/buildkitd", "--rm-dist", buildkitImage, destDir)
|
||||||
require.NoErrorf(t, cmd.Run(), "failed to extract buildkitd binary from %q", buildkitImage)
|
require.NoErrorf(t, cmd.Run(), "failed to extract buildkitd binary from %q", buildkitImage)
|
||||||
|
|
||||||
cmd = exec.Command(filepath.Join(destDir, "usr", "bin", "buildkitd"), "--version")
|
cmd = exec.CommandContext(context.TODO(), filepath.Join(destDir, "usr", "bin", "buildkitd"), "--version")
|
||||||
out, err := cmd.CombinedOutput()
|
out, err := cmd.CombinedOutput()
|
||||||
require.NoErrorf(t, err, "failed to get BuildKit version from %q: %s", buildkitImage, string(out))
|
require.NoErrorf(t, err, "failed to get BuildKit version from %q: %s", buildkitImage, string(out))
|
||||||
|
|
||||||
|
|||||||
@@ -58,7 +58,7 @@ func (w *containerWorker) New(ctx context.Context, cfg *integration.BackendConfi
|
|||||||
}
|
}
|
||||||
defer os.RemoveAll(filepath.Dir(cfgfile))
|
defer os.RemoveAll(filepath.Dir(cfgfile))
|
||||||
name := "integration-container-" + identity.NewID()
|
name := "integration-container-" + identity.NewID()
|
||||||
cmd := exec.Command("buildx", "create",
|
cmd := exec.CommandContext(ctx, "buildx", "create",
|
||||||
"--bootstrap",
|
"--bootstrap",
|
||||||
"--name="+name,
|
"--name="+name,
|
||||||
"--buildkitd-config="+cfgfile,
|
"--buildkitd-config="+cfgfile,
|
||||||
@@ -75,7 +75,7 @@ func (w *containerWorker) New(ctx context.Context, cfg *integration.BackendConfi
|
|||||||
}
|
}
|
||||||
|
|
||||||
cl := func() error {
|
cl := func() error {
|
||||||
cmd := exec.Command("buildx", "rm", "-f", name)
|
cmd := exec.CommandContext(context.Background(), "buildx", "rm", "-f", name)
|
||||||
cmd.Env = append(
|
cmd.Env = append(
|
||||||
os.Environ(),
|
os.Environ(),
|
||||||
"BUILDX_CONFIG=/tmp/buildx-"+name,
|
"BUILDX_CONFIG=/tmp/buildx-"+name,
|
||||||
|
|||||||
@@ -98,7 +98,7 @@ func (c dockerWorker) New(ctx context.Context, cfg *integration.BackendConfig) (
|
|||||||
}
|
}
|
||||||
|
|
||||||
name := "integration-" + identity.NewID()
|
name := "integration-" + identity.NewID()
|
||||||
cmd := exec.Command("docker", "context", "create",
|
cmd := exec.CommandContext(ctx, "docker", "context", "create",
|
||||||
name,
|
name,
|
||||||
"--docker", "host="+bk.DockerAddress(),
|
"--docker", "host="+bk.DockerAddress(),
|
||||||
)
|
)
|
||||||
@@ -109,7 +109,7 @@ func (c dockerWorker) New(ctx context.Context, cfg *integration.BackendConfig) (
|
|||||||
|
|
||||||
cl = func() error {
|
cl = func() error {
|
||||||
err := bkclose()
|
err := bkclose()
|
||||||
cmd := exec.Command("docker", "context", "rm", "-f", name)
|
cmd := exec.CommandContext(context.Background(), "docker", "context", "rm", "-f", name)
|
||||||
if err1 := cmd.Run(); err == nil {
|
if err1 := cmd.Run(); err == nil {
|
||||||
err = errors.Wrapf(err1, "failed to remove buildx instance %s", name)
|
err = errors.Wrapf(err1, "failed to remove buildx instance %s", name)
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -42,7 +42,7 @@ func (w remoteWorker) New(ctx context.Context, cfg *integration.BackendConfig) (
|
|||||||
}
|
}
|
||||||
|
|
||||||
name := "integration-remote-" + identity.NewID()
|
name := "integration-remote-" + identity.NewID()
|
||||||
cmd := exec.Command("buildx", "create",
|
cmd := exec.CommandContext(ctx, "buildx", "create",
|
||||||
"--bootstrap",
|
"--bootstrap",
|
||||||
"--name="+name,
|
"--name="+name,
|
||||||
"--driver=remote",
|
"--driver=remote",
|
||||||
@@ -55,7 +55,7 @@ func (w remoteWorker) New(ctx context.Context, cfg *integration.BackendConfig) (
|
|||||||
|
|
||||||
cl = func() error {
|
cl = func() error {
|
||||||
err := bkclose()
|
err := bkclose()
|
||||||
cmd := exec.Command("buildx", "rm", "-f", name)
|
cmd := exec.CommandContext(context.Background(), "buildx", "rm", "-f", name)
|
||||||
cmd.Env = append(os.Environ(), "BUILDX_CONFIG=/tmp/buildx-"+name)
|
cmd.Env = append(os.Environ(), "BUILDX_CONFIG=/tmp/buildx-"+name)
|
||||||
if err1 := cmd.Run(); err == nil {
|
if err1 := cmd.Run(); err == nil {
|
||||||
err = err1
|
err = err1
|
||||||
|
|||||||
@@ -1,5 +1,4 @@
|
|||||||
//go:build !windows
|
//go:build !windows
|
||||||
// +build !windows
|
|
||||||
|
|
||||||
package confutil
|
package confutil
|
||||||
|
|
||||||
|
|||||||
@@ -1,5 +1,4 @@
|
|||||||
//go:build !windows
|
//go:build !windows
|
||||||
// +build !windows
|
|
||||||
|
|
||||||
package confutil
|
package confutil
|
||||||
|
|
||||||
|
|||||||
@@ -133,9 +133,9 @@ func parseConfigKey(key string) alternativeConfig {
|
|||||||
var out alternativeConfig
|
var out alternativeConfig
|
||||||
|
|
||||||
var mainPart, scopePart string
|
var mainPart, scopePart string
|
||||||
if i := strings.IndexByte(key, '@'); i >= 0 {
|
if before, after, ok := strings.Cut(key, "@"); ok {
|
||||||
mainPart = key[:i]
|
mainPart = before
|
||||||
scopePart = key[i+1:]
|
scopePart = after
|
||||||
} else {
|
} else {
|
||||||
mainPart = key
|
mainPart = key
|
||||||
}
|
}
|
||||||
@@ -153,14 +153,14 @@ func parseConfigKey(key string) alternativeConfig {
|
|||||||
return out
|
return out
|
||||||
}
|
}
|
||||||
|
|
||||||
slash := strings.IndexByte(mainPart, '/')
|
before, after, ok := strings.Cut(mainPart, "/")
|
||||||
if slash < 0 {
|
if !ok {
|
||||||
out.host = mainPart
|
out.host = mainPart
|
||||||
return out
|
return out
|
||||||
}
|
}
|
||||||
|
|
||||||
out.host = mainPart[:slash]
|
out.host = before
|
||||||
out.repo = mainPart[slash+1:]
|
out.repo = after
|
||||||
|
|
||||||
return out
|
return out
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -66,7 +66,8 @@ func GitServeHTTP(c *gitutil.Git, t testing.TB, opts ...GitServeOpt) (url string
|
|||||||
}
|
}
|
||||||
|
|
||||||
mux.Handle(prefix, handler(http.StripPrefix(prefix, http.FileServer(http.Dir(dir)))))
|
mux.Handle(prefix, handler(http.StripPrefix(prefix, http.FileServer(http.Dir(dir)))))
|
||||||
l, err := net.Listen("tcp", "localhost:0")
|
lc := net.ListenConfig{}
|
||||||
|
l, err := lc.Listen(ctx, "tcp", "localhost:0")
|
||||||
if err != nil {
|
if err != nil {
|
||||||
panic(err)
|
panic(err)
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,5 +1,4 @@
|
|||||||
//go:build !windows
|
//go:build !windows
|
||||||
// +build !windows
|
|
||||||
|
|
||||||
package gitutil
|
package gitutil
|
||||||
|
|
||||||
|
|||||||
@@ -1,5 +1,4 @@
|
|||||||
//go:build !windows
|
//go:build !windows
|
||||||
// +build !windows
|
|
||||||
|
|
||||||
package gitutil
|
package gitutil
|
||||||
|
|
||||||
|
|||||||
+4
-9
@@ -36,10 +36,7 @@ func NewMuxIO(in In, outs []MuxOut, initIdx int, toggleMessage func(prev int, re
|
|||||||
var wg sync.WaitGroup
|
var wg sync.WaitGroup
|
||||||
var mu sync.Mutex
|
var mu sync.Mutex
|
||||||
for i, o := range outs {
|
for i, o := range outs {
|
||||||
i, o := i, o
|
wg.Go(func() {
|
||||||
wg.Add(1)
|
|
||||||
go func() {
|
|
||||||
defer wg.Done()
|
|
||||||
if err := copyToFunc(o.Stdout, func() (io.Writer, error) {
|
if err := copyToFunc(o.Stdout, func() (io.Writer, error) {
|
||||||
if m.cur == i {
|
if m.cur == i {
|
||||||
return in.Stdout, nil
|
return in.Stdout, nil
|
||||||
@@ -51,10 +48,8 @@ func NewMuxIO(in In, outs []MuxOut, initIdx int, toggleMessage func(prev int, re
|
|||||||
if err := o.Stdout.Close(); err != nil {
|
if err := o.Stdout.Close(); err != nil {
|
||||||
logrus.WithField("output index", i).WithError(err).Warnf("failed to close stdout")
|
logrus.WithField("output index", i).WithError(err).Warnf("failed to close stdout")
|
||||||
}
|
}
|
||||||
}()
|
})
|
||||||
wg.Add(1)
|
wg.Go(func() {
|
||||||
go func() {
|
|
||||||
defer wg.Done()
|
|
||||||
if err := copyToFunc(o.Stderr, func() (io.Writer, error) {
|
if err := copyToFunc(o.Stderr, func() (io.Writer, error) {
|
||||||
if m.cur == i {
|
if m.cur == i {
|
||||||
return in.Stderr, nil
|
return in.Stderr, nil
|
||||||
@@ -66,7 +61,7 @@ func NewMuxIO(in In, outs []MuxOut, initIdx int, toggleMessage func(prev int, re
|
|||||||
if err := o.Stderr.Close(); err != nil {
|
if err := o.Stderr.Close(); err != nil {
|
||||||
logrus.WithField("output index", i).WithError(err).Warnf("failed to close stderr")
|
logrus.WithField("output index", i).WithError(err).Warnf("failed to close stderr")
|
||||||
}
|
}
|
||||||
}()
|
})
|
||||||
}
|
}
|
||||||
go func() {
|
go func() {
|
||||||
errToggle := errors.Errorf("toggle IO")
|
errToggle := errors.Errorf("toggle IO")
|
||||||
|
|||||||
@@ -303,11 +303,11 @@ func writeMasked(w io.Writer, s string) io.Writer {
|
|||||||
pr.CloseWithError(readErr)
|
pr.CloseWithError(readErr)
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
var masked string
|
var masked strings.Builder
|
||||||
for range n {
|
for range n {
|
||||||
masked += s
|
masked.WriteString(s)
|
||||||
}
|
}
|
||||||
if _, err := w.Write([]byte(masked)); err != nil {
|
if _, err := w.Write([]byte(masked.String())); err != nil {
|
||||||
pr.CloseWithError(err)
|
pr.CloseWithError(err)
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,5 +1,4 @@
|
|||||||
//go:build !windows
|
//go:build !windows
|
||||||
// +build !windows
|
|
||||||
|
|
||||||
package osutil
|
package osutil
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user