You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
The go command recognizes a go.mod file using a case-insensitive match, presumably to support file systems that do not preserve case. However, it does not retain the actual name of the file thus found, and later synthesizes a name by appending the canonical lowercase go.mod to the directory name. Example:
$ mkdir foo
$ cd foo
$ go mod init foo
go: creating new go.mod: module foo
$ mv go.mod gO.MoD
$ go list -m -json
{
"Path": "foo",
"Main": true,
"Dir": "/Users/adonovan/w/foo",
"GoMod": "/Users/adonovan/w/foo/go.mod",
"GoVersion": "1.16"
}
Consequently, the GoMod file in the JSON output does not necessarily exist. Irregularly cased files thus pose an unexpected source of fragility in tools that process modules.
The text was updated successfully, but these errors were encountered:
Today I learned that the Mac OS file system, despite its UNIXy feel, preserves case but uses case-insensitive match. Not sure how that escaped my attention for so long.
tmp$ echo foo > foo
tmp$ cat FOO
foo
So the filename in my first example is a valid alias for the actual go.mod file. On Linux, the go command does not recognize alternative casings of go.mod. So I think there is no problem here.
The
go
command recognizes ago.mod
file using a case-insensitive match, presumably to support file systems that do not preserve case. However, it does not retain the actual name of the file thus found, and later synthesizes a name by appending the canonical lowercasego.mod
to the directory name. Example:Consequently, the GoMod file in the JSON output does not necessarily exist. Irregularly cased files thus pose an unexpected source of fragility in tools that process modules.
The text was updated successfully, but these errors were encountered: