func (r *BlockedModule) IsCurrentModuleARecommendation(currentModuleName string) bool {
	if r == nil {
		return false
	}
	for n := range r.Recommendations {
		if strings.TrimSpace(currentModuleName) == strings.TrimSpace(r.Recommendations[n]) {
			return true
		}
	}
	return false
}
IsCurrentModuleARecommendation returns true if the current module is in the Recommendations list.

If the current go.mod file being linted is a recommended module of a
blocked module and it imports that blocked module, do not set as blocked.
This could mean that the linted module is a wrapper for that blocked module.
package gomodguard
import (
	"bytes"
	"encoding/json"
	"errors"
	"fmt"
	"go/parser"
	"go/token"
	"io/ioutil"
	"os"
	"os/exec"
	"strings"
	"github.com/Masterminds/semver"
	"golang.org/x/mod/modfile"
)
const (
	goModFilename       = "go.mod"
	errReadingGoModFile = "unable to read module file %s: %w"
	errParsingGoModFile = "unable to parse module file %s: %w"
)
var (
	blockReasonNotInAllowedList = "import of package `%s` is blocked because the module is not in the " +
		"allowed modules list."
	blockReasonInBlockedList = "import of package `%s` is blocked because the module is in the " +
		"blocked modules list."
	blockReasonHasLocalReplaceDirective = "import of package `%s` is blocked because the module has a " +
		"local replace directive."
)
type BlockedVersion struct {
	Version string `yaml:"version"`
	Reason  string `yaml:"reason"`
}
func (r *BlockedVersion) IsLintedModuleVersionBlocked(lintedModuleVersion string) bool {
	if r.Version == "" {
		return false
	}
	constraint, err := semver.NewConstraint(r.Version)
	if err != nil {
		return false
	}
	version, err := semver.NewVersion(lintedModuleVersion)
	if err != nil {
		return false
	}
	meet := constraint.Check(version)
	return meet
}
func (r *BlockedVersion) Message(lintedModuleVersion string) string {
	var sb strings.Builder
	_, _ = fmt.Fprintf(&sb, "version `%s` is blocked because it does not meet the version constraint `%s`.",
		lintedModuleVersion, r.Version)
	if r.Reason == "" {
		return sb.String()
	}
	_, _ = fmt.Fprintf(&sb, " %s.", strings.TrimRight(r.Reason, "."))
	return sb.String()
}
type BlockedModule struct {
	Recommendations []string `yaml:"recommendations"`
	Reason          string   `yaml:"reason"`
}