[go] embed: document the maximum file size supported

329 views
Skip to first unread message

korzhao (Gerrit)

unread,
Aug 12, 2021, 11:52:07 AM8/12/21
to goph...@pubsubhelper.golang.org, golang-co...@googlegroups.com

korzhao has uploaded this change for review.

View Change

embed: document the maximum file size supported

Fixes #47627

Change-Id: Ia1edfb6249863ab055fab68a35666bc2bdf21dcb
---
M src/cmd/compile/internal/staticdata/data.go
M src/embed/embed.go
2 files changed, 2 insertions(+), 1 deletion(-)

diff --git a/src/cmd/compile/internal/staticdata/data.go b/src/cmd/compile/internal/staticdata/data.go
index abb0bba..98b4ed5 100644
--- a/src/cmd/compile/internal/staticdata/data.go
+++ b/src/cmd/compile/internal/staticdata/data.go
@@ -138,7 +138,7 @@
// and probably the rest of the toolchain
// can't handle such big symbols either.
// See golang.org/issue/9862.
- return nil, 0, fmt.Errorf("file too large")
+ return nil, 0, fmt.Errorf("file is larger than 2 GB")
}

// File is too big to read and keep in memory.
diff --git a/src/embed/embed.go b/src/embed/embed.go
index 851cc21..9170969 100644
--- a/src/embed/embed.go
+++ b/src/embed/embed.go
@@ -7,6 +7,7 @@
// 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.
+// The maximum supported file size is 2 GB.
//
// For example, here are three ways to embed a file named hello.txt
// and then print its contents at run time.

To view, visit change 341689. To unsubscribe, or for help writing mail filters, visit settings.

Gerrit-Project: go
Gerrit-Branch: master
Gerrit-Change-Id: Ia1edfb6249863ab055fab68a35666bc2bdf21dcb
Gerrit-Change-Number: 341689
Gerrit-PatchSet: 1
Gerrit-Owner: korzhao <korz...@gmail.com>
Gerrit-MessageType: newchange

Jay Conrod (Gerrit)

unread,
Aug 12, 2021, 12:38:21 PM8/12/21
to korzhao, goph...@pubsubhelper.golang.org, Ian Lance Taylor, golang-co...@googlegroups.com

Attention is currently required from: Ian Lance Taylor, korzhao.

Patch set 1:Run-TryBot +1

View Change

1 comment:

  • File src/embed/embed.go:

    • Patch Set #1, Line 10: // The maximum supported file size is 2 GB.

      Let's move this sentence down near L94. There are a couple other sentences there about what can and can't be embedded, and it makes sense to keep that information together.

To view, visit change 341689. To unsubscribe, or for help writing mail filters, visit settings.

Gerrit-Project: go
Gerrit-Branch: master
Gerrit-Change-Id: Ia1edfb6249863ab055fab68a35666bc2bdf21dcb
Gerrit-Change-Number: 341689
Gerrit-PatchSet: 1
Gerrit-Owner: korzhao <korz...@gmail.com>
Gerrit-Reviewer: Ian Lance Taylor <ia...@golang.org>
Gerrit-Reviewer: Jay Conrod <jayc...@google.com>
Gerrit-Attention: Ian Lance Taylor <ia...@golang.org>
Gerrit-Attention: korzhao <korz...@gmail.com>
Gerrit-Comment-Date: Thu, 12 Aug 2021 16:38:16 +0000
Gerrit-HasComments: Yes
Gerrit-Has-Labels: Yes
Gerrit-MessageType: comment

korzhao (Gerrit)

unread,
Aug 12, 2021, 1:00:57 PM8/12/21
to goph...@pubsubhelper.golang.org, golang-co...@googlegroups.com

Attention is currently required from: Ian Lance Taylor, korzhao.

korzhao uploaded patch set #2 to this change.

View Change

embed: document the maximum file size supported

Fixes #47627

Change-Id: Ia1edfb6249863ab055fab68a35666bc2bdf21dcb
---
M src/cmd/compile/internal/staticdata/data.go
M src/embed/embed.go
2 files changed, 5 insertions(+), 1 deletion(-)

To view, visit change 341689. To unsubscribe, or for help writing mail filters, visit settings.

Gerrit-Project: go
Gerrit-Branch: master
Gerrit-Change-Id: Ia1edfb6249863ab055fab68a35666bc2bdf21dcb
Gerrit-Change-Number: 341689
Gerrit-PatchSet: 2
Gerrit-Owner: korzhao <korz...@gmail.com>
Gerrit-Reviewer: Go Bot <go...@golang.org>
Gerrit-Reviewer: Ian Lance Taylor <ia...@golang.org>
Gerrit-Reviewer: Jay Conrod <jayc...@google.com>
Gerrit-Attention: Ian Lance Taylor <ia...@golang.org>
Gerrit-Attention: korzhao <korz...@gmail.com>
Gerrit-MessageType: newpatchset

korzhao (Gerrit)

unread,
Aug 12, 2021, 1:01:14 PM8/12/21
to goph...@pubsubhelper.golang.org, Go Bot, Jay Conrod, Ian Lance Taylor, golang-co...@googlegroups.com

Attention is currently required from: Jay Conrod, Ian Lance Taylor.

View Change

1 comment:

  • File src/embed/embed.go:

    • Let's move this sentence down near L94. […]

      Done

To view, visit change 341689. To unsubscribe, or for help writing mail filters, visit settings.

Gerrit-Project: go
Gerrit-Branch: master
Gerrit-Change-Id: Ia1edfb6249863ab055fab68a35666bc2bdf21dcb
Gerrit-Change-Number: 341689
Gerrit-PatchSet: 2
Gerrit-Owner: korzhao <korz...@gmail.com>
Gerrit-Reviewer: Go Bot <go...@golang.org>
Gerrit-Reviewer: Ian Lance Taylor <ia...@golang.org>
Gerrit-Reviewer: Jay Conrod <jayc...@google.com>
Gerrit-Attention: Jay Conrod <jayc...@google.com>
Gerrit-Attention: Ian Lance Taylor <ia...@golang.org>
Gerrit-Comment-Date: Thu, 12 Aug 2021 17:01:06 +0000
Gerrit-HasComments: Yes
Gerrit-Has-Labels: No
Comment-In-Reply-To: Jay Conrod <jayc...@google.com>
Gerrit-MessageType: comment

Jay Conrod (Gerrit)

unread,
Aug 12, 2021, 1:06:16 PM8/12/21
to korzhao, goph...@pubsubhelper.golang.org, Go Bot, Ian Lance Taylor, golang-co...@googlegroups.com

Attention is currently required from: Ian Lance Taylor, korzhao.

View Change

1 comment:

  • File src/embed/embed.go:

    • Done

      I don't think this is important enough to merit its own section. Let's put it together with the other things that can't be matched near L94.

To view, visit change 341689. To unsubscribe, or for help writing mail filters, visit settings.

Gerrit-Project: go
Gerrit-Branch: master
Gerrit-Change-Id: Ia1edfb6249863ab055fab68a35666bc2bdf21dcb
Gerrit-Change-Number: 341689
Gerrit-PatchSet: 2
Gerrit-Owner: korzhao <korz...@gmail.com>
Gerrit-Reviewer: Go Bot <go...@golang.org>
Gerrit-Reviewer: Ian Lance Taylor <ia...@golang.org>
Gerrit-Reviewer: Jay Conrod <jayc...@google.com>
Gerrit-Attention: Ian Lance Taylor <ia...@golang.org>
Gerrit-Attention: korzhao <korz...@gmail.com>
Gerrit-Comment-Date: Thu, 12 Aug 2021 17:06:11 +0000
Gerrit-HasComments: Yes
Gerrit-Has-Labels: No
Comment-In-Reply-To: Jay Conrod <jayc...@google.com>
Comment-In-Reply-To: korzhao <korz...@gmail.com>
Gerrit-MessageType: comment

korzhao (Gerrit)

unread,
Aug 12, 2021, 10:15:02 PM8/12/21
to goph...@pubsubhelper.golang.org, golang-co...@googlegroups.com

Attention is currently required from: Ian Lance Taylor, korzhao.

korzhao uploaded patch set #3 to this change.

View Change

embed: document the maximum file size supported

Fixes #47627

Change-Id: Ia1edfb6249863ab055fab68a35666bc2bdf21dcb
---
M src/cmd/compile/internal/staticdata/data.go
M src/embed/embed.go
2 files changed, 2 insertions(+), 2 deletions(-)

To view, visit change 341689. To unsubscribe, or for help writing mail filters, visit settings.

Gerrit-Project: go
Gerrit-Branch: master
Gerrit-Change-Id: Ia1edfb6249863ab055fab68a35666bc2bdf21dcb
Gerrit-Change-Number: 341689
Gerrit-PatchSet: 3
Gerrit-Owner: korzhao <korz...@gmail.com>
Gerrit-Reviewer: Go Bot <go...@golang.org>
Gerrit-Reviewer: Ian Lance Taylor <ia...@golang.org>
Gerrit-Reviewer: Jay Conrod <jayc...@google.com>
Gerrit-Attention: Ian Lance Taylor <ia...@golang.org>
Gerrit-Attention: korzhao <korz...@gmail.com>
Gerrit-MessageType: newpatchset

korzhao (Gerrit)

unread,
Aug 12, 2021, 10:15:33 PM8/12/21
to goph...@pubsubhelper.golang.org, Go Bot, Jay Conrod, Ian Lance Taylor, golang-co...@googlegroups.com

Attention is currently required from: Jay Conrod, Ian Lance Taylor.

View Change

1 comment:

  • File src/embed/embed.go:

    • I don't think this is important enough to merit its own section. […]

      Done

To view, visit change 341689. To unsubscribe, or for help writing mail filters, visit settings.

Gerrit-Project: go
Gerrit-Branch: master
Gerrit-Change-Id: Ia1edfb6249863ab055fab68a35666bc2bdf21dcb
Gerrit-Change-Number: 341689
Gerrit-PatchSet: 3
Gerrit-Owner: korzhao <korz...@gmail.com>
Gerrit-Reviewer: Go Bot <go...@golang.org>
Gerrit-Reviewer: Ian Lance Taylor <ia...@golang.org>
Gerrit-Reviewer: Jay Conrod <jayc...@google.com>
Gerrit-Attention: Jay Conrod <jayc...@google.com>
Gerrit-Attention: Ian Lance Taylor <ia...@golang.org>
Gerrit-Comment-Date: Fri, 13 Aug 2021 02:15:26 +0000

Jay Conrod (Gerrit)

unread,
Aug 23, 2021, 12:57:14 PM8/23/21
to korzhao, goph...@pubsubhelper.golang.org, Go Bot, Ian Lance Taylor, golang-co...@googlegroups.com

Attention is currently required from: Ian Lance Taylor, korzhao.

Patch set 3:Run-TryBot +1

View Change

1 comment:

  • Patchset:

To view, visit change 341689. To unsubscribe, or for help writing mail filters, visit settings.

Gerrit-Project: go
Gerrit-Branch: master
Gerrit-Change-Id: Ia1edfb6249863ab055fab68a35666bc2bdf21dcb
Gerrit-Change-Number: 341689
Gerrit-PatchSet: 3
Gerrit-Owner: korzhao <korz...@gmail.com>
Gerrit-Reviewer: Go Bot <go...@golang.org>
Gerrit-Reviewer: Ian Lance Taylor <ia...@golang.org>
Gerrit-Reviewer: Jay Conrod <jayc...@google.com>
Gerrit-Attention: Ian Lance Taylor <ia...@golang.org>
Gerrit-Attention: korzhao <korz...@gmail.com>
Gerrit-Comment-Date: Mon, 23 Aug 2021 16:57:11 +0000
Gerrit-HasComments: Yes
Gerrit-Has-Labels: Yes
Gerrit-MessageType: comment

Jay Conrod (Gerrit)

unread,
Aug 23, 2021, 1:45:12 PM8/23/21
to korzhao, goph...@pubsubhelper.golang.org, Go Bot, Ian Lance Taylor, golang-co...@googlegroups.com

Attention is currently required from: Ian Lance Taylor, korzhao.

Patch set 3:Code-Review +2

View Change

    To view, visit change 341689. To unsubscribe, or for help writing mail filters, visit settings.

    Gerrit-Project: go
    Gerrit-Branch: master
    Gerrit-Change-Id: Ia1edfb6249863ab055fab68a35666bc2bdf21dcb
    Gerrit-Change-Number: 341689
    Gerrit-PatchSet: 3
    Gerrit-Owner: korzhao <korz...@gmail.com>
    Gerrit-Reviewer: Go Bot <go...@golang.org>
    Gerrit-Reviewer: Ian Lance Taylor <ia...@golang.org>
    Gerrit-Reviewer: Jay Conrod <jayc...@google.com>
    Gerrit-Attention: Ian Lance Taylor <ia...@golang.org>
    Gerrit-Attention: korzhao <korz...@gmail.com>
    Gerrit-Comment-Date: Mon, 23 Aug 2021 17:45:08 +0000
    Gerrit-HasComments: No
    Gerrit-Has-Labels: Yes
    Gerrit-MessageType: comment

    Michael Matloob (Gerrit)

    unread,
    Aug 23, 2021, 1:45:54 PM8/23/21
    to korzhao, goph...@pubsubhelper.golang.org, Jay Conrod, Go Bot, Ian Lance Taylor, golang-co...@googlegroups.com

    Attention is currently required from: Ian Lance Taylor, korzhao.

    Patch set 3:Trust +1

    View Change

      To view, visit change 341689. To unsubscribe, or for help writing mail filters, visit settings.

      Gerrit-Project: go
      Gerrit-Branch: master
      Gerrit-Change-Id: Ia1edfb6249863ab055fab68a35666bc2bdf21dcb
      Gerrit-Change-Number: 341689
      Gerrit-PatchSet: 3
      Gerrit-Owner: korzhao <korz...@gmail.com>
      Gerrit-Reviewer: Go Bot <go...@golang.org>
      Gerrit-Reviewer: Ian Lance Taylor <ia...@golang.org>
      Gerrit-Reviewer: Jay Conrod <jayc...@google.com>
      Gerrit-Reviewer: Michael Matloob <mat...@golang.org>
      Gerrit-Attention: Ian Lance Taylor <ia...@golang.org>
      Gerrit-Attention: korzhao <korz...@gmail.com>
      Gerrit-Comment-Date: Mon, 23 Aug 2021 17:45:50 +0000

      Jay Conrod (Gerrit)

      unread,
      Aug 23, 2021, 1:51:24 PM8/23/21
      to korzhao, goph...@pubsubhelper.golang.org, Michael Matloob, Go Bot, Ian Lance Taylor, golang-co...@googlegroups.com

      Attention is currently required from: Ian Lance Taylor, korzhao.

      Patch set 3:-Code-Review

      View Change

      1 comment:

      • File src/embed/embed.go:

        • Patch Set #3, Line 91: // must match at least one file or non-empty directory. The maximum supported file size is 2 GB.

          Let's actually drop this part of the change and not document this limit. Users seeing the new error message will at least understand what the limit is.

          I asked why we had this limit, and it's actually a toolchain implementation detail. It may change in the future. We also aren't confident the toolchain will behave well close to the limit, for example, embedding 10 1.9GB files may or may not work; this is not well tested.

          So let's not commit to anything specific here in the documentation.

      To view, visit change 341689. To unsubscribe, or for help writing mail filters, visit settings.

      Gerrit-Project: go
      Gerrit-Branch: master
      Gerrit-Change-Id: Ia1edfb6249863ab055fab68a35666bc2bdf21dcb
      Gerrit-Change-Number: 341689
      Gerrit-PatchSet: 3
      Gerrit-Owner: korzhao <korz...@gmail.com>
      Gerrit-Reviewer: Go Bot <go...@golang.org>
      Gerrit-Reviewer: Ian Lance Taylor <ia...@golang.org>
      Gerrit-Reviewer: Jay Conrod <jayc...@google.com>
      Gerrit-Reviewer: Michael Matloob <mat...@golang.org>
      Gerrit-Attention: Ian Lance Taylor <ia...@golang.org>
      Gerrit-Attention: korzhao <korz...@gmail.com>
      Gerrit-Comment-Date: Mon, 23 Aug 2021 17:51:19 +0000

      korzhao (Gerrit)

      unread,
      Aug 23, 2021, 11:49:12 PM8/23/21
      to goph...@pubsubhelper.golang.org, golang-co...@googlegroups.com

      Attention is currently required from: Ian Lance Taylor, korzhao.

      korzhao uploaded patch set #4 to this change.

      View Change

      embed: document the maximum file size supported

      Fixes #47627

      Change-Id: Ia1edfb6249863ab055fab68a35666bc2bdf21dcb
      ---
      M src/cmd/compile/internal/staticdata/data.go
      1 file changed, 1 insertion(+), 1 deletion(-)

      To view, visit change 341689. To unsubscribe, or for help writing mail filters, visit settings.

      Gerrit-Project: go
      Gerrit-Branch: master
      Gerrit-Change-Id: Ia1edfb6249863ab055fab68a35666bc2bdf21dcb
      Gerrit-Change-Number: 341689
      Gerrit-PatchSet: 4
      Gerrit-Owner: korzhao <korz...@gmail.com>
      Gerrit-Reviewer: Go Bot <go...@golang.org>
      Gerrit-Reviewer: Ian Lance Taylor <ia...@golang.org>
      Gerrit-Reviewer: Jay Conrod <jayc...@google.com>
      Gerrit-Reviewer: Michael Matloob <mat...@golang.org>
      Gerrit-Attention: Ian Lance Taylor <ia...@golang.org>
      Gerrit-Attention: korzhao <korz...@gmail.com>
      Gerrit-MessageType: newpatchset

      korzhao (Gerrit)

      unread,
      Aug 23, 2021, 11:49:31 PM8/23/21
      to goph...@pubsubhelper.golang.org, Michael Matloob, Jay Conrod, Go Bot, Ian Lance Taylor, golang-co...@googlegroups.com

      Attention is currently required from: Jay Conrod, Ian Lance Taylor.

      View Change

      1 comment:

      • File src/embed/embed.go:

        • Patch Set #3, Line 91: // must match at least one file or non-empty directory. The maximum supported file size is 2 GB.

        • Let's actually drop this part of the change and not document this limit. […]

          Done

      To view, visit change 341689. To unsubscribe, or for help writing mail filters, visit settings.

      Gerrit-Project: go
      Gerrit-Branch: master
      Gerrit-Change-Id: Ia1edfb6249863ab055fab68a35666bc2bdf21dcb
      Gerrit-Change-Number: 341689
      Gerrit-PatchSet: 4
      Gerrit-Owner: korzhao <korz...@gmail.com>
      Gerrit-Reviewer: Go Bot <go...@golang.org>
      Gerrit-Reviewer: Ian Lance Taylor <ia...@golang.org>
      Gerrit-Reviewer: Jay Conrod <jayc...@google.com>
      Gerrit-Reviewer: Michael Matloob <mat...@golang.org>
      Gerrit-Attention: Jay Conrod <jayc...@google.com>
      Gerrit-Attention: Ian Lance Taylor <ia...@golang.org>
      Gerrit-Comment-Date: Tue, 24 Aug 2021 03:49:26 +0000
      Gerrit-HasComments: Yes
      Gerrit-Has-Labels: No
      Comment-In-Reply-To: Jay Conrod <jayc...@google.com>
      Gerrit-MessageType: comment

      Rob Pike (Gerrit)

      unread,
      Aug 24, 2021, 12:28:39 AM8/24/21
      to korzhao, goph...@pubsubhelper.golang.org, Rob Pike, Michael Matloob, Jay Conrod, Go Bot, Ian Lance Taylor, golang-co...@googlegroups.com

      Attention is currently required from: Jay Conrod, Ian Lance Taylor, korzhao.

      View Change

      1 comment:

      • File src/cmd/compile/internal/staticdata/data.go:

        • Patch Set #4, Line 141: return nil, 0, fmt.Errorf("file is larger than 2 GB")

          If you're going to fix this, fix it right. 2e9 should be a constant (and probably not 2e9 but instead something like 1<<31-1, if the comment is accurate) and then use that in the print statement. Something like

          fmt.Errorf("%q has size %d; maximum allowed is %d", file, size, maxFileSize)

      To view, visit change 341689. To unsubscribe, or for help writing mail filters, visit settings.

      Gerrit-Project: go
      Gerrit-Branch: master
      Gerrit-Change-Id: Ia1edfb6249863ab055fab68a35666bc2bdf21dcb
      Gerrit-Change-Number: 341689
      Gerrit-PatchSet: 4
      Gerrit-Owner: korzhao <korz...@gmail.com>
      Gerrit-Reviewer: Go Bot <go...@golang.org>
      Gerrit-Reviewer: Ian Lance Taylor <ia...@golang.org>
      Gerrit-Reviewer: Jay Conrod <jayc...@google.com>
      Gerrit-Reviewer: Michael Matloob <mat...@golang.org>
      Gerrit-CC: Rob Pike <r...@golang.org>
      Gerrit-Attention: Jay Conrod <jayc...@google.com>
      Gerrit-Attention: Ian Lance Taylor <ia...@golang.org>
      Gerrit-Attention: korzhao <korz...@gmail.com>
      Gerrit-Comment-Date: Tue, 24 Aug 2021 04:28:32 +0000
      Gerrit-HasComments: Yes
      Gerrit-Has-Labels: No
      Gerrit-MessageType: comment

      korzhao (Gerrit)

      unread,
      Aug 24, 2021, 3:08:50 AM8/24/21
      to goph...@pubsubhelper.golang.org, golang-co...@googlegroups.com

      Attention is currently required from: Jay Conrod, Ian Lance Taylor, korzhao.

      korzhao uploaded patch set #5 to this change.

      View Change

      embed: document the maximum file size supported

      Fixes #47627

      Change-Id: Ia1edfb6249863ab055fab68a35666bc2bdf21dcb
      ---
      M src/cmd/compile/internal/staticdata/data.go
      1 file changed, 6 insertions(+), 2 deletions(-)

      To view, visit change 341689. To unsubscribe, or for help writing mail filters, visit settings.

      Gerrit-Project: go
      Gerrit-Branch: master
      Gerrit-Change-Id: Ia1edfb6249863ab055fab68a35666bc2bdf21dcb
      Gerrit-Change-Number: 341689
      Gerrit-PatchSet: 5
      Gerrit-Owner: korzhao <korz...@gmail.com>
      Gerrit-Reviewer: Go Bot <go...@golang.org>
      Gerrit-Reviewer: Ian Lance Taylor <ia...@golang.org>
      Gerrit-Reviewer: Jay Conrod <jayc...@google.com>
      Gerrit-Reviewer: Michael Matloob <mat...@golang.org>
      Gerrit-CC: Rob Pike <r...@golang.org>
      Gerrit-Attention: Jay Conrod <jayc...@google.com>
      Gerrit-Attention: Ian Lance Taylor <ia...@golang.org>
      Gerrit-Attention: korzhao <korz...@gmail.com>
      Gerrit-MessageType: newpatchset

      korzhao (Gerrit)

      unread,
      Aug 24, 2021, 3:33:21 AM8/24/21
      to goph...@pubsubhelper.golang.org, Rob Pike, Michael Matloob, Jay Conrod, Go Bot, Ian Lance Taylor, golang-co...@googlegroups.com

      Attention is currently required from: Jay Conrod, Ian Lance Taylor, Rob Pike.

      View Change

      1 comment:

      • File src/cmd/compile/internal/staticdata/data.go:

      To view, visit change 341689. To unsubscribe, or for help writing mail filters, visit settings.

      Gerrit-Project: go
      Gerrit-Branch: master
      Gerrit-Change-Id: Ia1edfb6249863ab055fab68a35666bc2bdf21dcb
      Gerrit-Change-Number: 341689
      Gerrit-PatchSet: 5
      Gerrit-Owner: korzhao <korz...@gmail.com>
      Gerrit-Reviewer: Go Bot <go...@golang.org>
      Gerrit-Reviewer: Ian Lance Taylor <ia...@golang.org>
      Gerrit-Reviewer: Jay Conrod <jayc...@google.com>
      Gerrit-Reviewer: Michael Matloob <mat...@golang.org>
      Gerrit-CC: Rob Pike <r...@golang.org>
      Gerrit-Attention: Jay Conrod <jayc...@google.com>
      Gerrit-Attention: Ian Lance Taylor <ia...@golang.org>
      Gerrit-Attention: Rob Pike <r...@golang.org>
      Gerrit-Comment-Date: Tue, 24 Aug 2021 07:33:15 +0000
      Gerrit-HasComments: Yes
      Gerrit-Has-Labels: No
      Comment-In-Reply-To: Rob Pike <r...@golang.org>
      Gerrit-MessageType: comment

      Rob Pike (Gerrit)

      unread,
      Aug 24, 2021, 4:07:38 AM8/24/21
      to korzhao, goph...@pubsubhelper.golang.org, Rob Pike, Michael Matloob, Jay Conrod, Go Bot, Ian Lance Taylor, golang-co...@googlegroups.com

      Attention is currently required from: Jay Conrod, Ian Lance Taylor, korzhao.

      View Change

      1 comment:

      • File src/cmd/compile/internal/staticdata/data.go:

        • Patch Set #5, Line 145: return nil, 0, fmt.Errorf("file too large (%d bytes > %d bytes)", size, cutoff)

          please put the file name here. the message is much more helpful if it says which file is the problem. the example you cite names the symbol, so it's consistent too.

      To view, visit change 341689. To unsubscribe, or for help writing mail filters, visit settings.

      Gerrit-Project: go
      Gerrit-Branch: master
      Gerrit-Change-Id: Ia1edfb6249863ab055fab68a35666bc2bdf21dcb
      Gerrit-Change-Number: 341689
      Gerrit-PatchSet: 5
      Gerrit-Owner: korzhao <korz...@gmail.com>
      Gerrit-Reviewer: Go Bot <go...@golang.org>
      Gerrit-Reviewer: Ian Lance Taylor <ia...@golang.org>
      Gerrit-Reviewer: Jay Conrod <jayc...@google.com>
      Gerrit-Reviewer: Michael Matloob <mat...@golang.org>
      Gerrit-CC: Rob Pike <r...@golang.org>
      Gerrit-Attention: Jay Conrod <jayc...@google.com>
      Gerrit-Attention: Ian Lance Taylor <ia...@golang.org>
      Gerrit-Attention: korzhao <korz...@gmail.com>
      Gerrit-Comment-Date: Tue, 24 Aug 2021 08:07:31 +0000
      Gerrit-HasComments: Yes
      Gerrit-Has-Labels: No
      Gerrit-MessageType: comment

      korzhao (Gerrit)

      unread,
      Aug 24, 2021, 4:51:21 AM8/24/21
      to goph...@pubsubhelper.golang.org, Rob Pike, Michael Matloob, Jay Conrod, Go Bot, Ian Lance Taylor, golang-co...@googlegroups.com

      Attention is currently required from: Jay Conrod, Ian Lance Taylor, Rob Pike.

      View Change

      1 comment:

      • File src/cmd/compile/internal/staticdata/data.go:

      To view, visit change 341689. To unsubscribe, or for help writing mail filters, visit settings.

      Gerrit-Project: go
      Gerrit-Branch: master
      Gerrit-Change-Id: Ia1edfb6249863ab055fab68a35666bc2bdf21dcb
      Gerrit-Change-Number: 341689
      Gerrit-PatchSet: 5
      Gerrit-Owner: korzhao <korz...@gmail.com>
      Gerrit-Reviewer: Go Bot <go...@golang.org>
      Gerrit-Reviewer: Ian Lance Taylor <ia...@golang.org>
      Gerrit-Reviewer: Jay Conrod <jayc...@google.com>
      Gerrit-Reviewer: Michael Matloob <mat...@golang.org>
      Gerrit-CC: Rob Pike <r...@golang.org>
      Gerrit-Attention: Jay Conrod <jayc...@google.com>
      Gerrit-Attention: Ian Lance Taylor <ia...@golang.org>
      Gerrit-Attention: Rob Pike <r...@golang.org>
      Gerrit-Comment-Date: Tue, 24 Aug 2021 08:51:15 +0000
      Gerrit-HasComments: Yes
      Gerrit-Has-Labels: No

      korzhao (Gerrit)

      unread,
      Aug 24, 2021, 4:51:34 AM8/24/21
      to goph...@pubsubhelper.golang.org, Rob Pike, Michael Matloob, Jay Conrod, Go Bot, Ian Lance Taylor, golang-co...@googlegroups.com

      Attention is currently required from: Jay Conrod, Ian Lance Taylor, Rob Pike.

      View Change

      1 comment:

      • File src/cmd/compile/internal/staticdata/data.go:

        • I found that the file name could already be printed. […]

          Done

      To view, visit change 341689. To unsubscribe, or for help writing mail filters, visit settings.

      Gerrit-Project: go
      Gerrit-Branch: master
      Gerrit-Change-Id: Ia1edfb6249863ab055fab68a35666bc2bdf21dcb
      Gerrit-Change-Number: 341689
      Gerrit-PatchSet: 5
      Gerrit-Owner: korzhao <korz...@gmail.com>
      Gerrit-Reviewer: Go Bot <go...@golang.org>
      Gerrit-Reviewer: Ian Lance Taylor <ia...@golang.org>
      Gerrit-Reviewer: Jay Conrod <jayc...@google.com>
      Gerrit-Reviewer: Michael Matloob <mat...@golang.org>
      Gerrit-CC: Rob Pike <r...@golang.org>
      Gerrit-Attention: Jay Conrod <jayc...@google.com>
      Gerrit-Attention: Ian Lance Taylor <ia...@golang.org>
      Gerrit-Attention: Rob Pike <r...@golang.org>
      Gerrit-Comment-Date: Tue, 24 Aug 2021 08:51:28 +0000
      Gerrit-HasComments: Yes
      Gerrit-Has-Labels: No
      Comment-In-Reply-To: Rob Pike <r...@golang.org>

      Jay Conrod (Gerrit)

      unread,
      Aug 24, 2021, 11:25:07 AM8/24/21
      to korzhao, goph...@pubsubhelper.golang.org, Rob Pike, Michael Matloob, Go Bot, Ian Lance Taylor, golang-co...@googlegroups.com

      Attention is currently required from: Ian Lance Taylor, Rob Pike, korzhao.

      Patch set 5:Run-TryBot +1

      View Change

      1 comment:

      • File src/cmd/compile/internal/staticdata/data.go:

        • Patch Set #5, Line 97: const cutoff = int64(2e9)

          Let's name this maxFileSize as Rob suggested. cutoff is not a meaningful name.

      To view, visit change 341689. To unsubscribe, or for help writing mail filters, visit settings.

      Gerrit-Project: go
      Gerrit-Branch: master
      Gerrit-Change-Id: Ia1edfb6249863ab055fab68a35666bc2bdf21dcb
      Gerrit-Change-Number: 341689
      Gerrit-PatchSet: 5
      Gerrit-Owner: korzhao <korz...@gmail.com>
      Gerrit-Reviewer: Go Bot <go...@golang.org>
      Gerrit-Reviewer: Ian Lance Taylor <ia...@golang.org>
      Gerrit-Reviewer: Jay Conrod <jayc...@google.com>
      Gerrit-Reviewer: Michael Matloob <mat...@golang.org>
      Gerrit-CC: Rob Pike <r...@golang.org>
      Gerrit-Attention: Ian Lance Taylor <ia...@golang.org>
      Gerrit-Attention: Rob Pike <r...@golang.org>
      Gerrit-Attention: korzhao <korz...@gmail.com>
      Gerrit-Comment-Date: Tue, 24 Aug 2021 15:25:03 +0000

      korzhao (Gerrit)

      unread,
      Aug 24, 2021, 11:47:50 AM8/24/21
      to goph...@pubsubhelper.golang.org, golang-co...@googlegroups.com

      Attention is currently required from: Ian Lance Taylor, Rob Pike, korzhao.

      korzhao uploaded patch set #6 to this change.

      View Change

      embed: document the maximum file size supported

      Fixes #47627

      Change-Id: Ia1edfb6249863ab055fab68a35666bc2bdf21dcb
      ---
      M src/cmd/compile/internal/staticdata/data.go
      1 file changed, 6 insertions(+), 2 deletions(-)

      To view, visit change 341689. To unsubscribe, or for help writing mail filters, visit settings.

      Gerrit-Project: go
      Gerrit-Branch: master
      Gerrit-Change-Id: Ia1edfb6249863ab055fab68a35666bc2bdf21dcb
      Gerrit-Change-Number: 341689
      Gerrit-PatchSet: 6
      Gerrit-Owner: korzhao <korz...@gmail.com>
      Gerrit-Reviewer: Go Bot <go...@golang.org>
      Gerrit-Reviewer: Ian Lance Taylor <ia...@golang.org>
      Gerrit-Reviewer: Jay Conrod <jayc...@google.com>
      Gerrit-Reviewer: Michael Matloob <mat...@golang.org>
      Gerrit-CC: Rob Pike <r...@golang.org>
      Gerrit-Attention: Ian Lance Taylor <ia...@golang.org>
      Gerrit-Attention: Rob Pike <r...@golang.org>
      Gerrit-Attention: korzhao <korz...@gmail.com>
      Gerrit-MessageType: newpatchset

      korzhao (Gerrit)

      unread,
      Aug 24, 2021, 11:47:59 AM8/24/21
      to goph...@pubsubhelper.golang.org, Go Bot, Jay Conrod, Rob Pike, Michael Matloob, Ian Lance Taylor, golang-co...@googlegroups.com

      Attention is currently required from: Jay Conrod, Ian Lance Taylor, Rob Pike.

      View Change

      1 comment:

      • File src/cmd/compile/internal/staticdata/data.go:

        • Patch Set #5, Line 97: const cutoff = int64(2e9)

          Let's name this maxFileSize as Rob suggested. cutoff is not a meaningful name.

        • Done

      To view, visit change 341689. To unsubscribe, or for help writing mail filters, visit settings.

      Gerrit-Project: go
      Gerrit-Branch: master
      Gerrit-Change-Id: Ia1edfb6249863ab055fab68a35666bc2bdf21dcb
      Gerrit-Change-Number: 341689
      Gerrit-PatchSet: 6
      Gerrit-Owner: korzhao <korz...@gmail.com>
      Gerrit-Reviewer: Go Bot <go...@golang.org>
      Gerrit-Reviewer: Ian Lance Taylor <ia...@golang.org>
      Gerrit-Reviewer: Jay Conrod <jayc...@google.com>
      Gerrit-Reviewer: Michael Matloob <mat...@golang.org>
      Gerrit-CC: Rob Pike <r...@golang.org>
      Gerrit-Attention: Jay Conrod <jayc...@google.com>
      Gerrit-Attention: Ian Lance Taylor <ia...@golang.org>
      Gerrit-Attention: Rob Pike <r...@golang.org>
      Gerrit-Comment-Date: Tue, 24 Aug 2021 15:47:55 +0000
      Gerrit-HasComments: Yes
      Gerrit-Has-Labels: No

      Jay Conrod (Gerrit)

      unread,
      Aug 24, 2021, 11:55:37 AM8/24/21
      to korzhao, goph...@pubsubhelper.golang.org, Go Bot, Rob Pike, Michael Matloob, Ian Lance Taylor, golang-co...@googlegroups.com

      Attention is currently required from: Ian Lance Taylor, Rob Pike, korzhao.

      Patch set 6:Code-Review +2

      View Change

      1 comment:

      To view, visit change 341689. To unsubscribe, or for help writing mail filters, visit settings.

      Gerrit-Project: go
      Gerrit-Branch: master
      Gerrit-Change-Id: Ia1edfb6249863ab055fab68a35666bc2bdf21dcb
      Gerrit-Change-Number: 341689
      Gerrit-PatchSet: 6
      Gerrit-Owner: korzhao <korz...@gmail.com>
      Gerrit-Reviewer: Go Bot <go...@golang.org>
      Gerrit-Reviewer: Ian Lance Taylor <ia...@golang.org>
      Gerrit-Reviewer: Jay Conrod <jayc...@google.com>
      Gerrit-Reviewer: Michael Matloob <mat...@golang.org>
      Gerrit-CC: Rob Pike <r...@golang.org>
      Gerrit-Attention: Ian Lance Taylor <ia...@golang.org>
      Gerrit-Attention: Rob Pike <r...@golang.org>
      Gerrit-Attention: korzhao <korz...@gmail.com>
      Gerrit-Comment-Date: Tue, 24 Aug 2021 15:55:33 +0000

      Jay Conrod (Gerrit)

      unread,
      Aug 24, 2021, 11:55:42 AM8/24/21
      to korzhao, goph...@pubsubhelper.golang.org, golang-...@googlegroups.com, Go Bot, Rob Pike, Michael Matloob, Ian Lance Taylor, golang-co...@googlegroups.com

      Jay Conrod submitted this change.

      View Change

      Approvals: Jay Conrod: Looks good to me, approved Michael Matloob: Trusted
      embed: document the maximum file size supported

      Fixes #47627

      Change-Id: Ia1edfb6249863ab055fab68a35666bc2bdf21dcb
      Reviewed-on: https://go-review.googlesource.com/c/go/+/341689
      Reviewed-by: Jay Conrod <jayc...@google.com>
      Trust: Michael Matloob <mat...@golang.org>

      ---
      M src/cmd/compile/internal/staticdata/data.go
      1 file changed, 6 insertions(+), 2 deletions(-)

      diff --git a/src/cmd/compile/internal/staticdata/data.go b/src/cmd/compile/internal/staticdata/data.go
      index abb0bba..f25d8d8 100644
      --- a/src/cmd/compile/internal/staticdata/data.go
      +++ b/src/cmd/compile/internal/staticdata/data.go
      @@ -92,6 +92,10 @@
      return symdata
      }

      +// maxFileSize is the maximum file size permitted by the linker
      +// (see issue #9862).
      +const maxFileSize = int64(2e9)
      +
      // fileStringSym returns a symbol for the contents and the size of file.
      // If readonly is true, the symbol shares storage with any literal string
      // or other file with the same content and is placed in a read-only section.
      @@ -133,12 +137,12 @@
      }
      return sym, size, nil
      }
      - if size > 2e9 {
      + if size > maxFileSize {
      // ggloblsym takes an int32,

      // and probably the rest of the toolchain
      // can't handle such big symbols either.
      // See golang.org/issue/9862.
      -		return nil, 0, fmt.Errorf("file too large")
      + return nil, 0, fmt.Errorf("file too large (%d bytes > %d bytes)", size, maxFileSize)

      }

      // File is too big to read and keep in memory.

      To view, visit change 341689. To unsubscribe, or for help writing mail filters, visit settings.

      Gerrit-Project: go
      Gerrit-Branch: master
      Gerrit-Change-Id: Ia1edfb6249863ab055fab68a35666bc2bdf21dcb
      Gerrit-Change-Number: 341689
      Gerrit-PatchSet: 7
      Gerrit-Owner: korzhao <korz...@gmail.com>
      Gerrit-Reviewer: Go Bot <go...@golang.org>
      Gerrit-Reviewer: Ian Lance Taylor <ia...@golang.org>
      Gerrit-Reviewer: Jay Conrod <jayc...@google.com>
      Gerrit-Reviewer: Michael Matloob <mat...@golang.org>
      Gerrit-CC: Rob Pike <r...@golang.org>
      Gerrit-MessageType: merged

      Rob Pike (Gerrit)

      unread,
      Aug 24, 2021, 5:57:01 PM8/24/21
      to Jay Conrod, korzhao, goph...@pubsubhelper.golang.org, Go Bot, Rob Pike, Michael Matloob, Ian Lance Taylor, golang-co...@googlegroups.com

      Attention is currently required from: korzhao.

      View Change

      1 comment:

      • File src/cmd/compile/internal/staticdata/data.go:

        • Patch Set #7, Line 145: return nil, 0, fmt.Errorf("file too large (%d bytes > %d bytes)", size, maxFileSize)

          you did not include the file name as i requested.

          	fmt.Errorf("%q too large (%d bytes > %d bytes)", file, size, maxFileSize)

      To view, visit change 341689. To unsubscribe, or for help writing mail filters, visit settings.

      Gerrit-Project: go
      Gerrit-Branch: master
      Gerrit-Change-Id: Ia1edfb6249863ab055fab68a35666bc2bdf21dcb
      Gerrit-Change-Number: 341689
      Gerrit-PatchSet: 7
      Gerrit-Owner: korzhao <korz...@gmail.com>
      Gerrit-Reviewer: Go Bot <go...@golang.org>
      Gerrit-Reviewer: Ian Lance Taylor <ia...@golang.org>
      Gerrit-Reviewer: Jay Conrod <jayc...@google.com>
      Gerrit-Reviewer: Michael Matloob <mat...@golang.org>
      Gerrit-CC: Rob Pike <r...@golang.org>
      Gerrit-Attention: korzhao <korz...@gmail.com>
      Gerrit-Comment-Date: Tue, 24 Aug 2021 21:56:57 +0000
      Gerrit-HasComments: Yes
      Gerrit-Has-Labels: No
      Gerrit-MessageType: comment

      Jay Conrod (Gerrit)

      unread,
      Aug 24, 2021, 6:22:21 PM8/24/21
      to korzhao, goph...@pubsubhelper.golang.org, Go Bot, Rob Pike, Michael Matloob, Ian Lance Taylor, golang-co...@googlegroups.com

      Attention is currently required from: korzhao.

      View Change

      1 comment:

      • File src/cmd/compile/internal/staticdata/data.go:

        • you did not include the file name as i requested. […]

          It looks like this error is wrapped in embed.go:127. So the output does include the file name:

            ./big.go:6:5: embed bigfile: file too large (3000000000 bytes > 2000000000 bytes)

          Did you mean for the file name to be added here and the wrapping removed there?

      To view, visit change 341689. To unsubscribe, or for help writing mail filters, visit settings.

      Gerrit-Project: go
      Gerrit-Branch: master
      Gerrit-Change-Id: Ia1edfb6249863ab055fab68a35666bc2bdf21dcb
      Gerrit-Change-Number: 341689
      Gerrit-PatchSet: 7
      Gerrit-Owner: korzhao <korz...@gmail.com>
      Gerrit-Reviewer: Go Bot <go...@golang.org>
      Gerrit-Reviewer: Ian Lance Taylor <ia...@golang.org>
      Gerrit-Reviewer: Jay Conrod <jayc...@google.com>
      Gerrit-Reviewer: Michael Matloob <mat...@golang.org>
      Gerrit-CC: Rob Pike <r...@golang.org>
      Gerrit-Attention: korzhao <korz...@gmail.com>
      Gerrit-Comment-Date: Tue, 24 Aug 2021 22:22:17 +0000
      Gerrit-HasComments: Yes
      Gerrit-Has-Labels: No

      Rob Pike (Gerrit)

      unread,
      Aug 24, 2021, 7:46:57 PM8/24/21
      to Jay Conrod, korzhao, goph...@pubsubhelper.golang.org, Go Bot, Rob Pike, Michael Matloob, Ian Lance Taylor, golang-co...@googlegroups.com

      Attention is currently required from: korzhao.

      View Change

      1 comment:

      • File src/cmd/compile/internal/staticdata/data.go:

        • It looks like this error is wrapped in embed.go:127. So the output does include the file name: […]

          as long as the file name returns to the user, i'm happy

      To view, visit change 341689. To unsubscribe, or for help writing mail filters, visit settings.

      Gerrit-Project: go
      Gerrit-Branch: master
      Gerrit-Change-Id: Ia1edfb6249863ab055fab68a35666bc2bdf21dcb
      Gerrit-Change-Number: 341689
      Gerrit-PatchSet: 7
      Gerrit-Owner: korzhao <korz...@gmail.com>
      Gerrit-Reviewer: Go Bot <go...@golang.org>
      Gerrit-Reviewer: Ian Lance Taylor <ia...@golang.org>
      Gerrit-Reviewer: Jay Conrod <jayc...@google.com>
      Gerrit-Reviewer: Michael Matloob <mat...@golang.org>
      Gerrit-CC: Rob Pike <r...@golang.org>
      Gerrit-Attention: korzhao <korz...@gmail.com>
      Gerrit-Comment-Date: Tue, 24 Aug 2021 23:46:53 +0000
      Gerrit-HasComments: Yes
      Gerrit-Has-Labels: No
      Comment-In-Reply-To: Jay Conrod <jayc...@google.com>
      Reply all
      Reply to author
      Forward
      0 new messages