func (runner *Runner) RunRaw(ctx context.Context, inv Invocation) (*bytes.Buffer, *bytes.Buffer, error, error) {
	runner.initialize()
	stdout, stderr, friendlyErr, err := runner.runConcurrent(ctx, inv)
	if friendlyErr == nil || !modConcurrencyError.MatchString(friendlyErr.Error()) {
		return stdout, stderr, friendlyErr, err
	}
	event.Error(ctx, "Load concurrency error, will retry serially", err)
	stdout.Reset()
	stderr.Reset()
	friendlyErr, err = runner.runPiped(ctx, inv, stdout, stderr)
	return stdout, stderr, friendlyErr, err
}
RunRaw runs the invocation, serializing requests only if they fight over
go.mod changes.
package gocommand
import (
	"bytes"
	"context"
	"fmt"
	exec "golang.org/x/sys/execabs"
	"io"
	"os"
	"regexp"
	"strconv"
	"strings"
	"sync"
	"time"
	"golang.org/x/tools/internal/event"
)
type Runner struct {
	once sync.Once
	inFlight chan struct{}
	serialized chan struct{}
}
const maxInFlight = 10
func (runner *Runner) initialize() {
	runner.once.Do(func() {
		runner.inFlight = make(chan struct{}, maxInFlight)
		runner.serialized = make(chan struct{}, 1)
	})
}
var modConcurrencyError = regexp.MustCompile(`go:.*go.mod.*contents have changed`)
func (runner *Runner) Run(ctx context.Context, inv Invocation) (*bytes.Buffer, error) {
	stdout, _, friendly, _ := runner.RunRaw(ctx, inv)
	return stdout, friendly
}
func (runner *Runner) RunPiped(ctx context.Context, inv Invocation, stdout, stderr io.Writer) error {
	_, err := runner.runPiped(ctx, inv, stdout, stderr)
	return err
}