Skip to content
This repository has been archived by the owner on Sep 7, 2022. It is now read-only.

Commit

Permalink
Bump to go 1.16.7
Browse files Browse the repository at this point in the history
This bumps to `go` `1.16.7` generated via:
```
$ docker run -v ~/Code/open-source/dependabot/gomodules-extracted:/gomodules -it --rm  golang:1.16.7
root@f5a9ea6a8efe:/go# cd /gomodules/
root@f5a9ea6a8efe:/gomodules# ./script/extract
```
  • Loading branch information
jeffwidman committed Aug 19, 2021
1 parent 06c097c commit d23b93a
Show file tree
Hide file tree
Showing 5 changed files with 40 additions and 9 deletions.
2 changes: 1 addition & 1 deletion cmd/_internal_/objabi/zbootstrap.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

4 changes: 2 additions & 2 deletions cmd/go/_internal_/cfg/zdefaultcc.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

30 changes: 30 additions & 0 deletions cmd/go/_internal_/modload/buildlist.go
Original file line number Diff line number Diff line change
Expand Up @@ -11,10 +11,13 @@ import (
"github.com/dependabot/gomodules-extracted/cmd/go/_internal_/mvs"
"context"
"fmt"
"go/build"
"os"
"strings"

"golang.org/x/mod/modfile"
"golang.org/x/mod/module"
"golang.org/x/mod/semver"
)

// buildList is the list of modules to use for building packages.
Expand Down Expand Up @@ -226,6 +229,33 @@ func ReloadBuildList() []module.Version {
return capVersionSlice(buildList)
}

// CheckTidyVersion reports an error to stderr if the Go version indicated by
// the go.mod file is not supported by this version of the 'go' command.
//
// If allowError is false, such an error terminates the program.
func CheckTidyVersion(ctx context.Context, allowError bool) {
LoadModFile(ctx)
if index.goVersionV == "" {
return
}

tags := build.Default.ReleaseTags
maxGo := tags[len(tags)-1]
if !strings.HasPrefix(maxGo, "go") || !modfile.GoVersionRE.MatchString(maxGo[2:]) {
base.Fatalf("go: unrecognized go version %q", maxGo)
}
max := maxGo[2:]

if semver.Compare(index.goVersionV, "v"+max) > 0 {
have := index.goVersionV[1:]
if allowError {
fmt.Fprintf(os.Stderr, "go mod tidy: go.mod file indicates go %s, but maximum supported version is %s\n", have, max)
} else {
base.Fatalf("go mod tidy: go.mod file indicates go %s, but maximum supported version is %s\n", have, max)
}
}
}

// TidyBuildList trims the build list to the minimal requirements needed to
// retain the same versions of all packages from the preceding call to
// LoadPackages.
Expand Down
10 changes: 6 additions & 4 deletions cmd/go/_internal_/modload/import.go
Original file line number Diff line number Diff line change
Expand Up @@ -160,11 +160,13 @@ func (e *ImportMissingSumError) Error() string {
// Importing package is unknown, or the missing package was named on the
// command line. Recommend 'go mod download' for the modules that could
// provide the package, since that shouldn't change go.mod.
args := make([]string, len(e.mods))
for i, mod := range e.mods {
args[i] = mod.Path
if len(e.mods) > 0 {
args := make([]string, len(e.mods))
for i, mod := range e.mods {
args[i] = mod.Path
}
hint = fmt.Sprintf("; to add:\n\tgo mod download %s", strings.Join(args, " "))
}
hint = fmt.Sprintf("; to add:\n\tgo mod download %s", strings.Join(args, " "))
} else {
// Importing package is known (common case). Recommend 'go get' on the
// current version of the importing package.
Expand Down
3 changes: 1 addition & 2 deletions cmd/go/_internal_/robustio/robustio_other.go
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,6 @@
package robustio

import (
"io/ioutil"
"os"
)

Expand All @@ -16,7 +15,7 @@ func rename(oldpath, newpath string) error {
}

func readFile(filename string) ([]byte, error) {
return ioutil.ReadFile(filename)
return os.ReadFile(filename)
}

func removeAll(path string) error {
Expand Down

0 comments on commit d23b93a

Please sign in to comment.