Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

affected/package: embed.FS #58127

Closed
noel-yap opened this issue Jan 28, 2023 · 1 comment
Closed

affected/package: embed.FS #58127

noel-yap opened this issue Jan 28, 2023 · 1 comment

Comments

@noel-yap
Copy link

What version of Go are you using (go version)?

$ go version
go version go1.18.4 darwin/amd64

Does this issue reproduce with the latest release?

Don't know

What operating system and processor architecture are you using (go env)?

go env Output
$ go env
GO111MODULE=""
GOARCH="amd64"
GOBIN=""
GOCACHE="/Users/nyap/Library/Caches/go-build"
GOENV="/Users/nyap/Library/Application Support/go/env"
GOEXE=""
GOEXPERIMENT=""
GOFLAGS=""
GOHOSTARCH="amd64"
GOHOSTOS="darwin"
GOINSECURE=""
GOMODCACHE="/Users/nyap/go/pkg/mod"
GONOPROXY=""
GONOSUMDB=""
GOOS="darwin"
GOPATH="/Users/nyap/go"
GOPRIVATE=""
GOPROXY="https://artifactory.ti-apps.aws.grail.com/artifactory/api/go/go,https://proxy.golang.org"
GOROOT="/Users/nyap/.gimme/versions/go1.18.4.darwin.amd64"
GOSUMDB="sum.golang.org"
GOTMPDIR=""
GOTOOLDIR="/Users/nyap/.gimme/versions/go1.18.4.darwin.amd64/pkg/tool/darwin_amd64"
GOVCS=""
GOVERSION="go1.18.4"
GCCGO="gccgo"
GOAMD64="v1"
AR="ar"
CC="clang"
CXX="clang++"
CGO_ENABLED="1"
GOMOD="/dev/null"
GOWORK=""
CGO_CFLAGS="-g -O2"
CGO_CPPFLAGS=""
CGO_CXXFLAGS="-g -O2"
CGO_FFLAGS="-g -O2"
CGO_LDFLAGS="-g -O2"
PKG_CONFIG="pkg-config"
GOGCCFLAGS="-fPIC -arch x86_64 -m64 -pthread -fno-caret-diagnostics -Qunused-arguments -fmessage-length=0 -fdebug-prefix-map=/var/folders/mn/1htbtmgn4r724vrmwkp6xxg00000gp/T/go-build1820793196=/tmp/go-build -gno-record-gcc-switches -fno-common"

What did you do?

Use embed.FS where some files in the file system are executable:

var (
	//go:embed mustache
	mustacheTemplateFS embed.FS
)

Create an embedded file system with executable files. Stat the executable file in the embedded file system. Observe that the file's mode has all execute bits off.

What did you expect to see?

The file's mode to have the execute bit(s) on.

What did you see instead?

The file's mode to have the execute bits off.

@seankhliao
Copy link
Member

Go source files that import "embed" can use the //go:embed directive to initialize a variable of type string, []byte, or FS with the contents of files read from the package directory or subdirectories at compile time.

embed is for file contents, not replicating an entire filesystem.

Closing as working as intended.

@seankhliao seankhliao closed this as not planned Won't fix, can't repro, duplicate, stale Jan 28, 2023
@golang golang locked and limited conversation to collaborators Jan 28, 2024
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

No branches or pull requests

3 participants