aboutsummaryrefslogtreecommitdiff
path: root/src/embed
AgeCommit message (Collapse)Author
2021-05-04embed/internal/embedtest: add test for embedded path starting with dashIan Lance Taylor
Fixes #45447 Change-Id: I1b1a0a844ee4345ced1a007bbe53db035183175f Reviewed-on: https://go-review.googlesource.com/c/go/+/311529 Trust: Ian Lance Taylor <iant@golang.org> Run-TryBot: Ian Lance Taylor <iant@golang.org> TryBot-Result: Go Bot <gobot@golang.org> Reviewed-by: Jay Conrod <jayconrod@google.com>
2021-04-07embed, testing/fstest: small optimization for ReadDir徐志伟
Change-Id: If8dc6d917b55119b5662ce5b0b87328d220d684d GitHub-Last-Rev: cc9a1d5a7e2599ee7f98c61d35b2450b9b6a92c3 GitHub-Pull-Request: golang/go#45388 Reviewed-on: https://go-review.googlesource.com/c/go/+/307250 Run-TryBot: Ian Lance Taylor <iant@golang.org> TryBot-Result: Go Bot <gobot@golang.org> Reviewed-by: Ian Lance Taylor <iant@golang.org> Trust: Tobias Klauser <tobias.klauser@gmail.com>
2021-02-08[dev.regabi] all: merge master (1901853) into dev.regabiCherry Zhang
Merge List: + 2021-02-08 1901853098 runtime/metrics: fix panic in readingAllMetric example + 2021-02-08 ed3e4afa12 syscall/plan9: remove spooky fd action at a distance + 2021-02-05 724d0720b3 doc/go1.16: add missed heading tag in vet section + 2021-02-05 b54cd94d47 embed, io/fs: clarify that leading and trailing slashes are disallowed + 2021-02-05 4516afebed testing/fstest: avoid symlink-induced failures in tester + 2021-02-04 8869086d8f runtime: fix typo in histogram.go + 2021-02-03 e491c6eea9 math/big: fix comment in divRecursiveStep Change-Id: I5e2bd18f42251eeb4ad0bf5c93a08c6a9b873d7b
2021-02-05embed, io/fs: clarify that leading and trailing slashes are disallowedJay Conrod
Fixes #44012 Change-Id: I5782cea301a65ae12ba870ff1e6b2e0a2651dc09 Reviewed-on: https://go-review.googlesource.com/c/go/+/290071 Run-TryBot: Jay Conrod <jayconrod@google.com> Reviewed-by: Bryan C. Mills <bcmills@google.com> TryBot-Result: Go Bot <gobot@golang.org> Trust: Jay Conrod <jayconrod@google.com>
2021-02-02[dev.regabi] all: merge master (fca94ab) into dev.regabiRobert Griesemer
Conflicts: - src/syscall/mksyscall.pl Merge List: + 2021-02-02 fca94ab3ab spec: improve the example in Type assertions section + 2021-02-02 98f8454a73 cmd/link: don't decode type symbol in shared library in deadcode + 2021-02-02 1426a571b7 cmd/link: fix off-by-1 error in findShlibSection + 2021-02-01 32e789f4fb test: fix incorrectly laid out instructions in issue11656.go + 2021-02-01 0b6cfea634 doc/go1.16: document that on OpenBSD syscalls are now made through libc + 2021-02-01 26e29aa15a cmd/link: disable TestPIESize if CGO isn't enabled + 2021-02-01 6ac91e460c doc/go1.16: minor markup fixes + 2021-01-29 44361140c0 embed: update docs for proposal tweaks + 2021-01-29 68058edc39 runtime: document pointer write atomicity for memclrNoHeapPointers + 2021-01-28 c8bd8010ff syscall: generate readlen/writelen for openbsd libc + 2021-01-28 41bb49b878 cmd/go: revert TestScript/build_trimpath to use ioutil.ReadFile + 2021-01-28 725a642c2d runtime: correct syscall10/syscall10X on openbsd/amd64 + 2021-01-28 4b068cafb5 doc/go1.16: document go/build/constraint package + 2021-01-28 376518d77f runtime,syscall: convert syscall on openbsd/arm64 to libc + 2021-01-27 00f2ff5c94 api/go1.16: add go/build/constraint APIs + 2021-01-27 35334caf18 crypto/x509: remove leftover CertificateRequest field + 2021-01-27 a5a5e2c968 runtime: make sure to remove open-coded defer entries in all cases after a recover + 2021-01-27 8cfa01943a runtime: block console ctrlhandler when the signal is handled + 2021-01-27 ff9e8364c6 cmd/go: skip issue33139 when the 'cc' script command is unavailable + 2021-01-27 cd176b3615 runtime: switch runtime to libc for openbsd/arm64 + 2021-01-27 6c8fbfbdcf runtime: convert openbsd/arm64 locking to libc + 2021-01-27 5cdf0da1bf syscall: clean up mkasm related changes + 2021-01-27 210f70e298 doc/go1.16: fix closing brace in .Export format + 2021-01-27 0f797f168d math: fix typo in sqrt.go code comment + 2021-01-26 8634a234df runtime,syscall: convert syscall on openbsd/amd64 to libc + 2021-01-26 1d5e14632e os: further document limitations around naked file descriptors + 2021-01-26 cf263e9f77 os: correct names in CreateTemp and MkdirTemp doc comments + 2021-01-26 ce8b318624 net/http/fcgi: remove locking added to prevent a test-only race Change-Id: I9e89df040dfbbeb50f4ce653a8da437cb72b3ef9
2021-01-29embed: update docs for proposal tweaksIan Lance Taylor
//go:embed variables can be type aliases. //go:embed variables can't be local to a function. For #43216 For #43602 Fixes #43978 Change-Id: Ib1d104dfa32b97c91d8bfc5ed5d461ca14da188f Reviewed-on: https://go-review.googlesource.com/c/go/+/288072 Trust: Ian Lance Taylor <iant@golang.org> Reviewed-by: Russ Cox <rsc@golang.org>
2021-01-22[dev.regabi] all: merge master (dab3e5a) into dev.regabiMatthew Dempsky
This merge had two conflicts to resolve: 1. The embed code on master had somewhat substantially diverged, so this CL tediously backported the changes to dev.regabi. In particular, I went through all of the embed changes to gc/{embed,noder,syntax}.go and made sure the analogous code on dev.regabi in noder/noder.go and staticdata/embed.go mirrors it. 2. The init-cycle reporting code on master was extended slightly to track already visited declarations to avoid exponential behavior. The same fix is applied on dev.regabi, just using ir.NameSet instead of map[ir.Node]bool. Conflicts: - src/cmd/compile/internal/gc/embed.go - src/cmd/compile/internal/gc/noder.go - src/cmd/compile/internal/gc/syntax.go - src/cmd/compile/internal/pkginit/initorder.go - src/embed/internal/embedtest/embed_test.go - src/go/types/stdlib_test.go Merge List: + 2021-01-22 dab3e5affe runtime: switch runtime to libc for openbsd/amd64 + 2021-01-22 a1b53d85da cmd/go: add documentation for test and xtest fields output by go list + 2021-01-22 b268b60774 runtime: remove pthread_kill/pthread_self for openbsd + 2021-01-22 ec4051763d runtime: fix typo in mgcscavenge.go + 2021-01-22 7ece3a7b17 net/http: fix flaky TestDisableKeepAliveUpgrade + 2021-01-22 50cba0506f time: clarify Timer.Reset behavior on AfterFunc Timers + 2021-01-22 cf10e69f17 doc/go1.16: mention net/http.Transport.GetProxyConnectHeader + 2021-01-22 ec1b945265 doc/go1.16: mention path/filepath.WalkDir + 2021-01-22 11def3d40b doc/go1.16: mention syscall.AllThreadsSyscall + 2021-01-21 07b0235609 doc/go1.16: add notes about package-specific fs.FS changes + 2021-01-21 e2b4f1fea5 doc/go1.16: minor formatting fix + 2021-01-21 9f43a9e07b doc/go1.16: mention new debug/elf constants + 2021-01-21 3c2f11ba5b cmd/go: overwrite program name with full path + 2021-01-21 953d1feca9 all: introduce and use internal/execabs + 2021-01-21 b186e4d70d cmd/go: add test case for cgo CC setting + 2021-01-21 5a8a2265fb cmd/cgo: report exec errors a bit more clearly + 2021-01-21 46e2e2e9d9 cmd/go: pass resolved CC, GCCGO to cgo + 2021-01-21 3d40895e36 runtime: switch openbsd/arm64 to pthreads + 2021-01-21 d95ca91380 crypto/elliptic: fix P-224 field reduction + 2021-01-20 ecf4ebf100 cmd/internal/moddeps: check content of all modules in GOROOT + 2021-01-20 d2d155d1ae runtime: don't adjust timer pp field in timerWaiting status + 2021-01-20 803d18fc6c cmd/go: set Incomplete field on go list output if no files match embed + 2021-01-20 6e243ce71d cmd/go: have go mod vendor copy embedded files in subdirs + 2021-01-20 be28e5abc5 cmd/go: fix mod_get_fallback test + 2021-01-20 928bda4f4a runtime: convert openbsd/amd64 locking to libc + 2021-01-19 824f2d635c cmd/go: allow go fmt to complete when embedded file is missing + 2021-01-19 0575e35e50 cmd/compile: require 'go 1.16' go.mod line for //go:embed + 2021-01-19 ccb2e90688 cmd/link: exit before Asmb2 if error + 2021-01-19 ca5774a5a5 embed: treat uninitialized FS as empty + 2021-01-19 d047c91a6c cmd/link,runtime: switch openbsd/amd64 to pthreads + 2021-01-19 61debffd97 runtime: factor out usesLibcall + 2021-01-19 9fed39d281 runtime: factor out mStackIsSystemAllocated + 2021-01-18 dbab079835 runtime: free Windows event handles after last lock is dropped + 2021-01-18 5a8fbb0d2d os: do not close syscall.Stdin in TestReadStdin + 2021-01-15 682a1d2176 runtime: detect errors in DuplicateHandle + 2021-01-15 9f83418b83 cmd/link: remove GOROOT write in TestBuildForTvOS + 2021-01-15 ec9470162f cmd/compile: allow embed into any string or byte slice type + 2021-01-15 54198b04db cmd/compile: disallow embed of var inside func + 2021-01-15 b386c735e7 cmd/go: fix go generate docs + 2021-01-15 bb5075a525 syscall: remove RtlGenRandom and move it into internal/syscall + 2021-01-15 1deae0b597 os: invoke processKiller synchronously in testKillProcess + 2021-01-15 ff196c3e84 crypto/x509: update iOS bundled roots to version 55188.40.9 + 2021-01-14 e125ccd10e cmd/go: in 'go mod edit', validate versions given to -retract and -exclude + 2021-01-14 eb330020dc cmd/dist, cmd/go: pass -arch for C compilation on Darwin + 2021-01-14 84e8a06f62 cmd/cgo: remove unnecessary space in cgo export header + 2021-01-14 0c86b999c3 cmd/test2json: document passing -test.paniconexit0 + 2021-01-14 9135795891 cmd/go/internal/load: report positions for embed errors + 2021-01-14 d9b79e53bb cmd/compile: fix wrong complement for arm64 floating-point comparisons + 2021-01-14 c73232d08f cmd/go/internal/load: refactor setErrorPos to PackageError.setPos + 2021-01-14 6aa28d3e06 go/build: report positions for go:embed directives + 2021-01-13 7eb31d999c cmd/go: add hints to more missing sum error messages + 2021-01-12 ba76567bc2 cmd/go/internal/modload: delete unused *mvsReqs.next method + 2021-01-12 665def2c11 encoding/asn1: document unmarshaling behavior for IMPLICIT string fields + 2021-01-11 81ea89adf3 cmd/go: fix non-script staleness checks interacting badly with GOFLAGS + 2021-01-11 759309029f doc: update editors.html for Go 1.16 + 2021-01-11 c3b4c7093a cmd/internal/objfile: don't require runtime.symtab symbol for XCOFF + 2021-01-08 59bfc18e34 cmd/go: add hint to read 'go help vcs' to GOVCS errors + 2021-01-08 cd6f3a54e4 cmd/go: revise 'go help' documentation for modules + 2021-01-08 6192b98751 cmd/go: make hints in error messages more consistent + 2021-01-08 25886cf4bd cmd/go: preserve sums for indirect deps fetched by 'go mod download' + 2021-01-08 6250833911 runtime/metrics: mark histogram metrics as cumulative + 2021-01-08 8f6a9acbb3 runtime/metrics: remove unused StopTheWorld Description field + 2021-01-08 6598c65646 cmd/compile: fix exponential-time init-cycle reporting + 2021-01-08 fefad1dc85 test: fix timeout code for invoking compiler + 2021-01-08 6728118e0a cmd/go: pass signals forward during "go tool" + 2021-01-08 e65c543f3c go/build/constraint: add parser for build tag constraint expressions + 2021-01-08 0c5afc4fb7 testing/fstest,os: clarify racy behavior of TestFS + 2021-01-08 32afcc9436 runtime/metrics: change unit on *-by-size metrics to match bucket unit + 2021-01-08 c6513bca5a io/fs: minor corrections to Glob doc + 2021-01-08 304f769ffc cmd/compile: don't short-circuit copies whose source is volatile + 2021-01-08 ae97717133 runtime,runtime/metrics: use explicit histogram boundaries + 2021-01-08 a9ccd2d795 go/build: skip string literal while findEmbed + 2021-01-08 d92f8add32 archive/tar: fix typo in comment + 2021-01-08 cab1202183 cmd/link: accept extra blocks in TestFallocate + 2021-01-08 ee4d32249b io/fs: minor corrections to Glob release date + 2021-01-08 54bd1ccce2 cmd: update to latest golang.org/x/tools + 2021-01-07 9ec21a8f34 Revert "reflect: support multiple keys in struct tags" + 2021-01-07 091414b5b7 io/fs: correct WalkDirFunc documentation + 2021-01-07 9b55088d6b doc/go1.16: add release note for disallowing non-ASCII import paths + 2021-01-07 fa90aaca7d cmd/compile: fix late expand_calls leaf type for OpStructSelect/OpArraySelect + 2021-01-07 7cee66d4cb cmd/go: add documentation for Embed fields in go list output + 2021-01-07 e60cffa4ca html/template: attach functions to namespace + 2021-01-07 6da2d3b7d7 cmd/link: fix typo in asm.go + 2021-01-07 df81a15819 runtime: check mips64 VDSO clock_gettime return code + 2021-01-06 4787e906cf crypto/x509: rollback new CertificateRequest fields + 2021-01-06 c9658bee93 cmd/go: make module suggestion more friendly + 2021-01-06 4c668b25c6 runtime/metrics: fix panic message for Float64Histogram + 2021-01-06 d2131704a6 net/http/httputil: fix deadlock in DumpRequestOut + 2021-01-05 3e1e13ce6d cmd/go: set cfg.BuildMod to "readonly" by default with no module root + 2021-01-05 0b0d004983 cmd/go: pass embedcfg to gccgo if supported + 2021-01-05 1b85e7c057 cmd/go: don't scan gccgo standard library packages for imports + 2021-01-05 6b37b15d95 runtime: don't take allglock in tracebackothers + 2021-01-04 9eef49cfa6 math/rand: fix typo in comment + 2021-01-04 b01fb2af9e testing/fstest: fix typo in error message + 2021-01-01 3dd5867605 doc: 2021 is the Year of the Gopher + 2020-12-31 95ce805d14 io/fs: remove darwin/arm64 special condition + 2020-12-30 20d0991b86 lib/time, time/tzdata: update tzdata to 2020f + 2020-12-30 ed301733bb misc/cgo/testcarchive: remove special flags for Darwin/ARM + 2020-12-30 0ae2e032f2 misc/cgo/test: enable TestCrossPackageTests on darwin/arm64 + 2020-12-29 780b4de16b misc/ios: fix wording for command line instructions + 2020-12-29 b4a71c95d2 doc/go1.16: reference misc/ios/README for how to build iOS programs + 2020-12-29 f83e0f6616 misc/ios: add to README how to build ios executables + 2020-12-28 4fd9455882 io/fs: fix typo in comment Change-Id: I2f257bbc5fbb05f15c2d959f8cfe0ce13b083538
2021-01-19embed: treat uninitialized FS as emptyJay Conrod
As described in the FS documentation. This prevents http.FS and other clients from panicking when the go:embed directive is missing. For #43682 Related #43698 Change-Id: Iecf26d229a099e55d24670c3119cd6c6d17ecc6e Reviewed-on: https://go-review.googlesource.com/c/go/+/283852 Run-TryBot: Jay Conrod <jayconrod@google.com> TryBot-Result: Go Bot <gobot@golang.org> Trust: Jay Conrod <jayconrod@google.com> Reviewed-by: Bryan C. Mills <bcmills@google.com>
2021-01-16[dev.regabi] cmd/compile, runtime: fix up comments/error messages from ↵Dan Scales
recent renames Went in a semi-automated way through the clearest renames of functions, and updated comments and error messages where it made sense. Change-Id: Ied8e152b562b705da7f52f715991a77dab60da35 Reviewed-on: https://go-review.googlesource.com/c/go/+/284216 Trust: Dan Scales <danscales@google.com> Run-TryBot: Dan Scales <danscales@google.com> TryBot-Result: Go Bot <gobot@golang.org> Reviewed-by: Matthew Dempsky <mdempsky@google.com>
2021-01-15cmd/compile: disallow embed of var inside funcRuss Cox
Allowing embedding into []byte inside a func creates an unfortunate problem: either all calls start with the same underlying data and can see each other's changes to the underlying data (surprising and racy!) or all calls start by making their own copy of the underlying data (surprising and expensive!). After discussion on #43216, the consensus was to remove support for all vars embedded inside functions. Fixes #43216. Change-Id: I01e62b5f0dcd9e8566c6d2286218e97803f54704 Reviewed-on: https://go-review.googlesource.com/c/go/+/282714 Trust: Russ Cox <rsc@golang.org> Reviewed-by: Jay Conrod <jayconrod@google.com>
2020-12-21[dev.regabi] cmd/compile: separate noder more cleanlyRuss Cox
Separate embed, cgo pragmas, and Main trackScopes variable from noder more cleanly. This lets us split embed and noder into new packages. It also assumes that the local embedded variables will be removed and deletes them now for simplicity. Change-Id: I9638bcc2c5f0e76440de056c6285b6aa2f73a00d Reviewed-on: https://go-review.googlesource.com/c/go/+/279299 Trust: Russ Cox <rsc@golang.org> Run-TryBot: Russ Cox <rsc@golang.org> TryBot-Result: Go Bot <gobot@golang.org> Reviewed-by: Matthew Dempsky <mdempsky@google.com>
2020-12-09all: update to use os.ReadFile, os.WriteFile, os.CreateTemp, os.MkdirTempRuss Cox
As part of #42026, these helpers from io/ioutil were moved to os. (ioutil.TempFile and TempDir became os.CreateTemp and MkdirTemp.) Update the Go tree to use the preferred names. As usual, code compiled with the Go 1.4 bootstrap toolchain and code vendored from other sources is excluded. ReadDir changes are in a separate CL, because they are not a simple search and replace. For #42026. Change-Id: If318df0216d57e95ea0c4093b89f65e5b0ababb3 Reviewed-on: https://go-review.googlesource.com/c/go/+/266365 Trust: Russ Cox <rsc@golang.org> Run-TryBot: Russ Cox <rsc@golang.org> TryBot-Result: Go Bot <gobot@golang.org> Reviewed-by: Ian Lance Taylor <iant@golang.org>
2020-12-04io/fs: add SubRuss Cox
Sub provides a convenient way to refer to a subdirectory automatically in future operations, like Unix's chdir(2). The CL also includes updates to fstest to check Sub implementations. As part of updating fstest, I changed the meaning of TestFS's expected list to introduce a special case: if you list no expected files, that means the FS must be empty. In general it's OK not to list all the expected files, but if you list none, that's almost certainly a mistake - if your FS were broken and empty, you wouldn't find out. Making no expected files mean "must be empty" makes the mistake less likely - if your file system ever worked, then your test will keep it working. That change found a testing bug: embedtest was making exactly that mistake. Fixes #42322. Change-Id: I63fd4aa866b30061a0e51ca9a1927e576d6ec41e Reviewed-on: https://go-review.googlesource.com/c/go/+/274856 Trust: Russ Cox <rsc@golang.org> Run-TryBot: Russ Cox <rsc@golang.org> TryBot-Result: Go Bot <gobot@golang.org> Reviewed-by: Ian Lance Taylor <iant@golang.org>
2020-12-04cmd/go, embed: exclude .* and _* from embedded directory treesRuss Cox
Discussion on #42328 led to a decision to exclude files matching .* and _* from embedded directory results when embedding an entire directory tree. This CL implements that new behavior. Fixes #42328. Change-Id: I6188994e96348b3449c7d9d3d0d181cfbf2d4db1 Reviewed-on: https://go-review.googlesource.com/c/go/+/275092 Trust: Russ Cox <rsc@golang.org> Run-TryBot: Russ Cox <rsc@golang.org> TryBot-Result: Go Bot <gobot@golang.org> Reviewed-by: Ian Lance Taylor <iant@golang.org>
2020-10-29cmd/go: add //go:embed supportRuss Cox
The final piece of //go:embed support: have the go command stitch together parsing in go/build, low-level data initialization in cmd/compile, and the new data structures in package embed, to make the //go:embed feature actually function. And test, now that all the pieces are available to work together. For #41191. (Issue not fixed: still need to add a tool for use by Bazel.) Change-Id: Ib1d198345c3b4d557d340f292eda13b984b65d65 Reviewed-on: https://go-review.googlesource.com/c/go/+/243945 Trust: Russ Cox <rsc@golang.org> Trust: Jay Conrod <jayconrod@google.com> Trust: Johan Brandhorst <johan.brandhorst@gmail.com> Run-TryBot: Russ Cox <rsc@golang.org> TryBot-Result: Go Bot <gobot@golang.org> Reviewed-by: Jay Conrod <jayconrod@google.com> Reviewed-by: Johan Brandhorst <johan.brandhorst@gmail.com>
2020-10-23embed: implement FSRuss Cox
embed.FS is the implementation of embedded file trees, providing an fs.FS for each embed.FS variable. Tests are in a follow-up CL, in the package embed/internal/embedtest. (They can only be written once the toolchain can initialize one of these, which requires changes to cmd/compile and cmd/go.) For #41191. Change-Id: Ieb0ead1d305cdac3d5d4e11772dca75740a72730 Reviewed-on: https://go-review.googlesource.com/c/go/+/243942 Trust: Russ Cox <rsc@golang.org> Trust: Jay Conrod <jayconrod@google.com> Run-TryBot: Russ Cox <rsc@golang.org> TryBot-Result: Go Bot <gobot@golang.org> Reviewed-by: Rob Pike <r@golang.org> Reviewed-by: Jay Conrod <jayconrod@google.com>