aboutsummaryrefslogtreecommitdiff
path: root/src/cmd/pack
AgeCommit message (Collapse)Author
2021-12-13all: gofmt -w -r 'interface{} -> any' srcRuss Cox
And then revert the bootstrap cmd directories and certain testdata. And adjust tests as needed. Not reverting the changes in std that are bootstrapped, because some of those changes would appear in API docs, and we want to use any consistently. Instead, rewrite 'any' to 'interface{}' in cmd/dist for those directories when preparing the bootstrap copy. A few files changed as a result of running gofmt -w not because of interface{} -> any but because they hadn't been updated for the new //go:build lines. Fixes #49884. Change-Id: Ie8045cba995f65bd79c694ec77a1b3d1fe01bb09 Reviewed-on: https://go-review.googlesource.com/c/go/+/368254 Trust: Russ Cox <rsc@golang.org> Run-TryBot: Russ Cox <rsc@golang.org> Reviewed-by: Robert Griesemer <gri@golang.org> TryBot-Result: Gopher Robot <gobot@golang.org>
2021-04-07cmd/pack: use testing.T.TempDir in testsTobias Klauser
Change-Id: I7371259cf5d64f04698ae1477c3de1255664178d Reviewed-on: https://go-review.googlesource.com/c/go/+/307969 Run-TryBot: Tobias Klauser <tobias.klauser@gmail.com> Reviewed-by: Dave Cheney <dave@cheney.net> Reviewed-by: Than McIntosh <thanm@google.com> Trust: Tobias Klauser <tobias.klauser@gmail.com> TryBot-Result: Go Bot <gobot@golang.org>
2020-12-22cmd/pack: r command create output file if not existCherry Zhang
Go 1.15 pack's r command creates the output file if it does not exist. The system "ar" command does this as well. Do the same. For bazelbuild/rules_go#2762. Change-Id: Icd88396b5c714b735c859a29ab29851e4301f4d2 Reviewed-on: https://go-review.googlesource.com/c/go/+/279516 Trust: Cherry Zhang <cherryyz@google.com> Run-TryBot: Cherry Zhang <cherryyz@google.com> Reviewed-by: Than McIntosh <thanm@google.com> TryBot-Result: Go Bot <gobot@golang.org>
2020-12-22cmd/pack: treat compiler's -linkobj output as "compiler object"Cherry Zhang
Treat the compiler's -linkobj output as "compiler object, which means "pack c" will "see through" the file and add individual entry to the new archive, instead of the object as a whole. This is somewhat peculiar. But Go 1.15's cmd/pack does this, although seemingly accidental. We just do the same. FWIW, it does make things more consistent with/without -linkobj flag. Fixes #43271. Change-Id: I6b2d99256db7ebf0fa430f85afa7464e334f6bcb Reviewed-on: https://go-review.googlesource.com/c/go/+/279483 Trust: Cherry Zhang <cherryyz@google.com> Run-TryBot: Cherry Zhang <cherryyz@google.com> Reviewed-by: Jeremy Faller <jeremy@golang.org> Reviewed-by: Than McIntosh <thanm@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-10-20all: update references to symbols moved from os to io/fsRuss Cox
The old os references are still valid, but update our code to reflect best practices and get used to the new locations. Code compiled with the bootstrap toolchain (cmd/asm, cmd/dist, cmd/compile, debug/elf) must remain Go 1.4-compatible and is excluded. For #41190. Change-Id: I8f9526977867c10a221e2f392f78d7dec073f1bd Reviewed-on: https://go-review.googlesource.com/c/go/+/243907 Trust: Russ Cox <rsc@golang.org> Run-TryBot: Russ Cox <rsc@golang.org> TryBot-Result: Go Bot <gobot@golang.org> Reviewed-by: Rob Pike <r@golang.org>
2020-08-11[dev.link] cmd/pack: use cmd/internal/archive packageCherry Zhang
Rewrite part of cmd/pack to use the cmd/internal/archive package. Change-Id: Ia7688810d3ea4d0277056870091f59cf09cffcad Reviewed-on: https://go-review.googlesource.com/c/go/+/247917 Run-TryBot: Cherry Zhang <cherryyz@google.com> TryBot-Result: Gobot Gobot <gobot@golang.org> Reviewed-by: Than McIntosh <thanm@google.com>
2019-05-22all: shorten some testsRuss Cox
Shorten some of the longest tests that run during all.bash. Removes 7r 50u 21s from all.bash. After this change, all.bash is under 5 minutes again on my laptop. For #26473. Change-Id: Ie0460aa935808d65460408feaed210fbaa1d5d79 Reviewed-on: https://go-review.googlesource.com/c/go/+/177559 Run-TryBot: Russ Cox <rsc@golang.org> TryBot-Result: Gobot Gobot <gobot@golang.org> Reviewed-by: Ian Lance Taylor <iant@golang.org>
2018-04-02cmd: remove some unused parametersDaniel Martí
Change-Id: I9d2a4b8df324897e264d30801e95ddc0f0e75f3a Reviewed-on: https://go-review.googlesource.com/102337 Run-TryBot: Daniel Martí <mvdan@mvdan.cc> TryBot-Result: Gobot Gobot <gobot@golang.org> Reviewed-by: Ilya Tocar <ilya.tocar@intel.com>
2018-03-24cmd/compile: always write pack filesMatthew Dempsky
By always writing out pack files, the object file format can be simplified somewhat. In particular, the export data format will no longer require escaping, because the pack file provides appropriate framing. This CL does not affect build systems that use -pack, which includes all major Go build systems (cmd/go, gb, bazel). Also, existing package import logic already distinguishes pack/object files based on file contents rather than file extension. The only exception is cmd/pack, which specially handled object files created by cmd/compile when used with the 'c' mode. This mode is extended to now recognize the pack files produced by cmd/compile and handle them as before. Passes toolstash-check. Updates #21705. Updates #24512. Change-Id: Idf131013bfebd73a5cde7e087eb19964503a9422 Reviewed-on: https://go-review.googlesource.com/102236 Run-TryBot: Matthew Dempsky <mdempsky@google.com> TryBot-Result: Gobot Gobot <gobot@golang.org> Reviewed-by: Ian Lance Taylor <iant@golang.org>
2017-09-09cmd/pack: fix export data truncation bugMatthew Dempsky
The binary export data format includes escaping to prevent "\n$$" from appearing internally, but not "\n!\n". This could result in a false positive when cmd/pack searched for "\n!\n" as the delimiter between package definition and linker object. To address this, this CL changes cmd/pack to also be aware of the "\n$$" markers, and to ignore "\n!\n" within the export data. Fixes #21703. Change-Id: I71ea8ba49dbd066c7afb7717ddc0190e38fe5649 Reviewed-on: https://go-review.googlesource.com/60773 Run-TryBot: Matthew Dempsky <mdempsky@google.com> TryBot-Result: Gobot Gobot <gobot@golang.org> Reviewed-by: Ian Lance Taylor <iant@golang.org>
2016-08-30all: use testing.GoToolPath instead of "go"Keith Randall
This change makes sure that tests are run with the correct version of the go tool. The correct version is the one that we invoked with "go test", not the one that is first in our path. Fixes #16577 Change-Id: If22c8f8c3ec9e7c35d094362873819f2fbb8559b Reviewed-on: https://go-review.googlesource.com/28089 Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org> Run-TryBot: Keith Randall <khr@golang.org> TryBot-Result: Gobot Gobot <gobot@golang.org>
2016-05-06all: use SeekStart, SeekCurrent, SeekEndJoe Tsai
CL/19862 (f79b50b8d5bc159561c1dcf7c17e2a0db96a9a11) recently introduced the constants SeekStart, SeekCurrent, and SeekEnd to the io package. We should use these constants consistently throughout the code base. Updates #15269 Change-Id: If7fcaca7676e4a51f588528f5ced28220d9639a2 Reviewed-on: https://go-review.googlesource.com/22097 Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org> Run-TryBot: Joe Tsai <joetsai@digital-static.net> TryBot-Result: Gobot Gobot <gobot@golang.org>
2016-03-17cmd/pack,vet: use `go doc` instead of `godoc` in docHyang-Ah Hana Kim
Change-Id: Ic5f62a7d0a5c090da69213d1d0187af0ea48e358 Reviewed-on: https://go-review.googlesource.com/20820 Reviewed-by: Rob Pike <r@golang.org>
2015-06-16all: extract "can I exec?" check from tests into internal/testenvRuss Cox
Change-Id: I7b54be9d8b50b39e01c6be21f310ae9a10404e9d Reviewed-on: https://go-review.googlesource.com/10753 Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org> Reviewed-by: David Crawshaw <crawshaw@golang.org> Reviewed-by: Ian Lance Taylor <iant@golang.org>
2015-05-21all: retire architecture letter in file names, public APIRuss Cox
This CL removes the remaining visible uses of the "architecture letter" concept. (They are no longer in tool names nor in source directory names.) Because the architecture letter concept is now gone, delete GOCHAR from "go env" output, and change go/build.ArchChar to return an error always. The architecture letter is still used in the compiler and linker sources as a clumsy architecture enumeration, but that use is not visible to Go users and can be cleaned up separately. Change-Id: I4d97a38f372003fb610c9c5241bea440d9dbeb8d Reviewed-on: https://go-review.googlesource.com/10289 Reviewed-by: Rob Pike <r@golang.org>
2015-05-21all: build and use go tool compile, go tool linkRuss Cox
This CL fixes the build to use the newly created go tool compile and go tool link in place of go tool 5g, go tool 5l, and so on. See golang-dev thread titled "go tool compile, etc" for background. Although it was not a primary motivation, this conversion does reduce the wall clock time and cpu time required for make.bash by about 10%. Change-Id: I79cbbdb676cab029db8aeefb99a53178ff55f98d Reviewed-on: https://go-review.googlesource.com/10288 Reviewed-by: Rob Pike <r@golang.org>
2015-04-13cmd/pack: skip fork test on darwin/arm64David Crawshaw
Just like darwin/arm. Change-Id: I5ed26975670d4189a46b585a56c66c199905d168 Reviewed-on: https://go-review.googlesource.com/8823 Reviewed-by: Minux Ma <minux@golang.org>
2015-03-01cmd/pack: skip fork test on darwin/armDavid Crawshaw
Change-Id: I65b50d2501fe822bc9044a851ac0b3467feadd9f Reviewed-on: https://go-review.googlesource.com/6330 Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
2015-02-05cmd/pack: simplify the testing logic slightlyRob Pike
Followup to https://go-review.googlesource.com/3910 We only need 1000 iteratinons. Change-Id: Ib63ae53105176abec77bad9609d638aeda7bcd61 Reviewed-on: https://go-review.googlesource.com/3901 Reviewed-by: Minux Ma <minux@golang.org> Reviewed-by: Ian Lance Taylor <iant@golang.org>
2015-01-30cmd/pack: make a test less disk-intensive in short modeBrad Fitzpatrick
Fixes #9656 Change-Id: I1158636683492ef12eeafb12e257d205026adc3f Reviewed-on: https://go-review.googlesource.com/3175 Reviewed-by: Minux Ma <minux@golang.org>
2014-12-28cmd/pack: address go vet reportsEmil Hessman
Use log.Fatalf for formatting directives instead of log.Fatal Change-Id: Ia207b320f5795c63cdfa71f92c19ca6d05cc833f Reviewed-on: https://go-review.googlesource.com/2160 Reviewed-by: Minux Ma <minux@golang.org>
2014-09-23cmd/pack: fix c command for existing fileRob Pike
There were at least two bugs: 1) It would overwrite a non-archive. 2) It would truncate a non-archive and then fail. In general the file handling was too clever to be correct. Make it more straightforward, doing the creation separately from archive management. Fixes #8369. LGTM=adg, iant R=golang-codereviews, adg, iant CC=golang-codereviews https://golang.org/cl/147010046
2014-07-08cmd/pack: skip test on android (no Go tool)David Crawshaw
LGTM=minux R=golang-codereviews, minux CC=golang-codereviews https://golang.org/cl/107600043
2014-05-20build: make nacl passRuss Cox
Add nacl.bash, the NaCl version of all.bash. It's a separate script because it builds a variant of package syscall with a large zip file embedded in it, containing all the input files needed for tests. Disable various tests new since the last round, mostly the ones using os/exec. Fixes #7945. LGTM=dave R=golang-codereviews, remyoudompheng, dave, bradfitz CC=golang-codereviews https://golang.org/cl/100590044
2014-05-15cmd/pack: buffer writes in TestLargeDefsAnthony Martin
TestLargeDefs was issuing over one million small writes to create a 7MB file (large.go). This is quite slow on Plan 9 since our disk file systems aren't very fast and they're usually accessed over the network. Buffering the writes makes the test about six times faster. Even on Linux, it's about 1.5 times faster. Here are the results on a slow Plan 9 machine: Before: % ./pack.test -test.v -test.run TestLargeDefs === RUN TestLargeDefs --- PASS: TestLargeDefs (125.11 seconds) PASS After: % ./pack.test -test.v -test.run TestLargeDefs === RUN TestLargeDefs --- PASS: TestLargeDefs (20.835 seconds) PASS LGTM=iant R=golang-codereviews, iant CC=golang-codereviews https://golang.org/cl/95040044
2014-04-26src: fix issues found by go vet stdRobert Hencke
LGTM=iant R=golang-codereviews, iant CC=golang-codereviews https://golang.org/cl/96850043
2014-04-17cmd/pack: avoid ./ import in test (fix Windows build)Russ Cox
It is possible to use ./ imports on Windows but it requires some extra command-line work ('go build' does this automatically, but we can't use 'go build' here). Instead, use an ordinary import and -I/-L, which are easier to use. LGTM=iant R=iant CC=golang-codereviews https://golang.org/cl/89040043
2014-04-17cmd/pack: handle very long lines in pkgdefIan Lance Taylor
LGTM=rsc, bradfitz R=golang-codereviews, rsc, bradfitz CC=golang-codereviews https://golang.org/cl/88170049
2014-04-15cmd/pack: print error along with usageRuss Cox
My cmd/go got in a weird state where it started invoking pack grcP. Change pack to print a 1-line explanation of the usage problem before the generic usage message. LGTM=r R=r CC=golang-codereviews https://golang.org/cl/87770047
2014-04-04os/exec: always try appropriate command extensions during Cmd.Start on windowsAlex Brainman
Update #7362 Fixes #7377 Fixes #7570 LGTM=rsc R=golang-codereviews, rsc CC=golang-codereviews https://golang.org/cl/83020043
2014-04-03cmd/pack: fix format string error in log messageDave Cheney
Fixes #7693. pack.go:347: possible formatting directive in Fatal call LGTM=iant R=golang-codereviews, iant CC=golang-codereviews https://golang.org/cl/83310045
2014-02-20cmd/pack: fix matchRuss Cox
Match used len(ar.files) == 0 to mean "match everything" but it also deleted matched things from the list, so once you had matched everything you asked for, match returned true for whatever was left in the archive too. Concretely, if you have an archive containing f1, f2, then pack t foo.a f1 would match f1 and then, because len(ar.files) == 0 after deleting f1 from the match list, also match f2. Avoid the problem by recording explicitly whether match matches everything. LGTM=r, dsymonds R=r, dsymonds CC=golang-codereviews https://golang.org/cl/65630046
2014-02-20cmd/pack: provide executable name in TestHelloAlex Brainman
otherwise go build command adds .exe suffix Fixes #7362 LGTM=bradfitz R=golang-codereviews, bradfitz CC=golang-codereviews https://golang.org/cl/66250043
2014-02-19cmd/pack: another attempt to fix the build for TestHelloRob Pike
Plan 9 uses single quotes, not double quotes. I should have known. LGTM=bradfitz R=bradfitz CC=golang-codereviews https://golang.org/cl/66240043
2014-02-19cmd/pack: don't look for " in output from go envRob Pike
Windows at least doesn't emit one. Maybe fix Windows build. LGTM=bradfitz R=bradfitz CC=golang-codereviews https://golang.org/cl/66120046
2014-02-19cmd/pack: dump output of command of "go env" command in testRob Pike
Get more information to help understand build failure on Plan 9. Also Windows. (TestHello is failing because GOCHAR does not appear in output. What does?) Update #7362 LGTM=bradfitz R=rsc, bradfitz CC=golang-codereviews https://golang.org/cl/66070044
2014-02-19cmd/pack: add 'c' command to create archiveRuss Cox
When Go 1.3 is released, this will keep existing Go 1.2 build scripts that use 'go tool pack grc' working. For efficiency, such scripts should be changed to use 6g -pack instead, but keeping the old behavior available enables a more graceful transition. LGTM=r R=r CC=golang-codereviews https://golang.org/cl/66130043
2014-02-19cmd/pack: use log.SetPrefix to make log calls more compact and consistentRob Pike
Taking my own advice from a review of addr2line. LGTM=rsc R=rsc CC=golang-codereviews https://golang.org/cl/65950044
2014-01-15cmd/pack: rewrite in GoRob Pike
Replace the pack command, a C program, with a clean reimplementation in Go. It does not need to reproduce the full feature set and it is no longer used by the build chain, but has a role in looking inside archives created by the build chain directly. Since it's not in C, it is no longer build by dist, so remove it from cmd/dist and make it a "tool" in cmd/go terminology. Fixes #2705 R=rsc, dave, minux.ma, josharian CC=golang-codereviews https://golang.org/cl/52310044
2013-12-20libmach: remove old object file readersRuss Cox
These no longer work; removing them makes other refactoring easier. The code for pack P being deleted in this CL does not work either. I created issue 6989 to track restoring this functionality (probably not until pack is written in Go). R=golang-codereviews, bradfitz CC=golang-codereviews https://golang.org/cl/44300043
2013-12-09cmd/pack: stop parsing object files to generate __.SYMDEFRuss Cox
Nothing looks at __.SYMDEF, and the object file format is changing. R=golang-dev, r CC=golang-dev https://golang.org/cl/39580044
2013-09-09build: remove various uses of C undefined behaviorRuss Cox
If you thought gcc -ansi -pedantic was pedantic, just wait until you meet clang -fsanitize=undefined. I think this addresses all the reported "errors", but we'll need another run to be sure. all.bash still passes. Update #5764 Dave, can you please try again? R=golang-dev, bradfitz CC=golang-dev https://golang.org/cl/13334049
2013-08-30libbio, all cmd: consistently use BGETC/BPUTC instead of Bgetc/BputcDmitriy Vyukov
Also introduce BGET2/4, BPUT2/4 as they are widely used. Slightly improve BGETC/BPUTC implementation. This gives ~5% CPU time improvement on go install -a -p1 std. Before: real user sys 0m23.561s 0m16.625s 0m5.848s 0m23.766s 0m16.624s 0m5.846s 0m23.742s 0m16.621s 0m5.868s after: 0m22.999s 0m15.841s 0m5.889s 0m22.845s 0m15.808s 0m5.850s 0m22.889s 0m15.832s 0m5.848s R=golang-dev, r CC=golang-dev https://golang.org/cl/12745047
2013-07-26cmd/pack: support removing of leading file prefix on windowsAlex Brainman
Fixes #5550 R=golang-dev, r CC=golang-dev https://golang.org/cl/11904043
2013-02-19cmd/godoc: use go/build to determine package and example filesRobert Griesemer
Also: - faster code for example extraction - simplify handling of command documentation: all "main" packages are treated as commands - various minor cleanups along the way For commands written in Go, any doc.go file containing documentation must now be part of package main (rather then package documentation), otherwise the documentation won't show up in godoc (it will still build, though). For commands written in C, documentation may still be in doc.go files defining package documentation, but the recommended way is to explicitly ignore those files with a +build ignore constraint to define package main. Fixes #4806. R=adg, rsc, dave, bradfitz CC=golang-dev https://golang.org/cl/7333046
2012-09-13cmd/pack: rename __.SYMDEF to __.GOSYMDEFRuss Cox
This fixes a problem with ELF tools thinking they know the format of the symbol table, as we do not use any of the standard formats for that table. This change will probably annoy the Plan 9 users, but I believe there are other incompatibilities already that mean they have to use a Go-specific nm. Fixes #3473. R=golang-dev, iant CC=golang-dev https://golang.org/cl/6500117
2012-07-12cmd/pack: remove unused paging logicDave Cheney
This is the remainder of https://golang.org/cl/4601051. Partially addresses issue 2705. R=golang-dev, r, bradfitz, minux.ma CC=golang-dev https://golang.org/cl/6354066
2012-03-17cmd/pack: also recognize '\\' as path separator in filenamesShenghou Ma
R=golang-dev, rsc CC=golang-dev https://golang.org/cl/5841051
2012-03-05cmd: update formatting of usage messagesAndrew Gerrand
R=golang-dev, r, minux.ma CC=golang-dev https://golang.org/cl/5738045