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
While migrating a project from GoDeps to go modules, I noticed that some vendored files changed their permissions from 0755 to 0655. Looking for the source of truth, I looked at the files in the upstream repository, which showed that 0755 was the correct permission.
To reproduce:
mkdir repro &&cd repro
cat > foo.go <<'EOF'package reproimport "golang.org/x/sys/unix"_ = unix.R_OKEOF
go mod init repro && go mod tidy
# go: finding golang.org/x/sys/unix latest# go: finding golang.org/x/sys latest# go: downloading golang.org/x/sys v0.0.0-20210324051608-47abb6519492
go mod vendor
ls -la vendor/golang.org/x/sys/unix/mkall.sh
# -rw-r--r-- 1 root root 8528 Mar 25 12:07 vendor/golang.org/x/sys/unix/mkall.sh
Verifying the file permissions in the upstream source repository;
git clone https://github.com/golang/sys.git golang-sys
ls -la golang-sys/unix/mkall.sh
# -rwxr-xr-x 1 root root 8528 Mar 25 12:09 golang-sys/unix/mkall.sh
What did you expect to see?
In this case, these files (shell and perl scripts) may not be needed in the vendor directory, but since they are included, file mode should be preserved.
What did you see instead?
Files having the incorrect mode.
The text was updated successfully, but these errors were encountered:
Ah, thanks! I tried searching, but only found the ones about permissions in the go module cache.
We defined the Go module representation to be absolutely least common denominator across systems for portability. The Go module zip file is for dependencies that need to be downloaded and built by the go command. It is not meant to support anything more. By design, there are no permission bits, nor special files like symlinks, nor modification times.
I'm not sure if I agree with the choice here; IMO files should either be included (verbatim copy), or not included. Including files but discarding information that may have been set on purpose feels tricky.
That said; for the example at hand here (some script files), I could see that excluding those files could make sense.
What version of Go are you using (
go version
)?Does this issue reproduce with the latest release?
Yes
What operating system and processor architecture are you using (
go env
)?go env
OutputWhat did you do?
While migrating a project from GoDeps to go modules, I noticed that some vendored files changed their permissions from
0755
to0655
. Looking for the source of truth, I looked at the files in the upstream repository, which showed that0755
was the correct permission.To reproduce:
Verifying the file permissions in the upstream source repository;
git clone https://github.com/golang/sys.git golang-sys ls -la golang-sys/unix/mkall.sh # -rwxr-xr-x 1 root root 8528 Mar 25 12:09 golang-sys/unix/mkall.sh
What did you expect to see?
In this case, these files (shell and perl scripts) may not be needed in the vendor directory, but since they are included, file mode should be preserved.
What did you see instead?
Files having the incorrect mode.
The text was updated successfully, but these errors were encountered: