Skip to content

Commit

Permalink
remove GopEnv
Browse files Browse the repository at this point in the history
  • Loading branch information
xushiwei committed Jun 4, 2022
1 parent fea093f commit df967ba
Showing 1 changed file with 3 additions and 5 deletions.
8 changes: 3 additions & 5 deletions modload/module.go
Original file line number Diff line number Diff line change
Expand Up @@ -36,8 +36,6 @@ var (
ErrNoModRoot = errors.New("gop.mod or go.mod file not found in current directory or any parent directory")
)

type GopEnv = env.Gop

type Module struct {
*modfile.File
}
Expand Down Expand Up @@ -161,7 +159,7 @@ const (
)

// UpdateGoMod updates the go.mod file.
func (p Module) UpdateGoMod(env *GopEnv, checkChanged bool) error {
func (p Module) UpdateGoMod(env *env.Gop, checkChanged bool) error {
gopmod := p.Modfile()
dir, file := filepath.Split(gopmod)
if file == "go.mod" {
Expand All @@ -174,7 +172,7 @@ func (p Module) UpdateGoMod(env *GopEnv, checkChanged bool) error {
return p.saveGoMod(gomod, env)
}

func (p Module) saveGoMod(gomod string, env *GopEnv) error {
func (p Module) saveGoMod(gomod string, env *env.Gop) error {
gof := p.convToGoMod(env)
data, err := gof.Format()
if err == nil {
Expand All @@ -183,7 +181,7 @@ func (p Module) saveGoMod(gomod string, env *GopEnv) error {
return err
}

func (p Module) convToGoMod(env *GopEnv) *gomodfile.File {
func (p Module) convToGoMod(env *env.Gop) *gomodfile.File {
copy := p.File.File
copy.Syntax = cloneGoFileSyntax(copy.Syntax)
addRequireIfNotExist(&copy, gopMod, env.Version)
Expand Down

0 comments on commit df967ba

Please sign in to comment.