diff options
| author | Ian Alexander <jitsu@google.com> | 2026-04-07 09:30:23 -0400 |
|---|---|---|
| committer | Ian Alexander <jitsu@google.com> | 2026-04-07 07:15:24 -0700 |
| commit | fe5b750ce9e9443b42b20ed242664950499ffafe (patch) | |
| tree | 9eb02d9fc22cb66128c9a8fcd260a765edfca2e9 | |
| parent | a415314c0bdec971ecd503471c804ec0208c6a2b (diff) | |
| download | go-fe5b750ce9e9443b42b20ed242664950499ffafe.tar.xz | |
cmd/go/internal/modload: minor modernization fixes
* Add package comment.
* Make octal literal explicit.
* Simplify single var declaration.
Change-Id: I3841ca538034c75098502b35b1a713a98e936efc
Reviewed-on: https://go-review.googlesource.com/c/go/+/763360
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
Reviewed-by: Michael Matloob <matloob@golang.org>
Reviewed-by: Michael Matloob <matloob@google.com>
| -rw-r--r-- | src/cmd/go/internal/modload/init.go | 7 |
1 files changed, 3 insertions, 4 deletions
diff --git a/src/cmd/go/internal/modload/init.go b/src/cmd/go/internal/modload/init.go index 515b40a00d..13541f9350 100644 --- a/src/cmd/go/internal/modload/init.go +++ b/src/cmd/go/internal/modload/init.go @@ -2,6 +2,7 @@ // Use of this source code is governed by a BSD-style // license that can be found in the LICENSE file. +// Package modload provides module and package loading functionality. package modload import ( @@ -850,7 +851,7 @@ func WriteWorkFile(path string, wf *modfile.WorkFile) error { wf.Cleanup() out := modfile.Format(wf.Syntax) - return os.WriteFile(path, out, 0666) + return os.WriteFile(path, out, 0o666) } // UpdateWorkGoVersion updates the go line in wf to be at least goVers, @@ -1842,9 +1843,7 @@ Run 'go help mod init' for more information. return "", fmt.Errorf(msg, dir, reason) } -var ( - importCommentRE = lazyregexp.New(`(?m)^package[ \t]+[^ \t\r\n/]+[ \t]+//[ \t]+import[ \t]+(\"[^"]+\")[ \t]*\r?\n`) -) +var importCommentRE = lazyregexp.New(`(?m)^package[ \t]+[^ \t\r\n/]+[ \t]+//[ \t]+import[ \t]+(\"[^"]+\")[ \t]*\r?\n`) func findImportComment(file string) string { data, err := os.ReadFile(file) |
