diff mbox series

Go patch committed: Use correct path for string/[]byte embed

Message ID CAOyqgcWeNph363vxsqscABxU3JW_6c0_euUw86P1P8RrHSJ=+w@mail.gmail.com
State New
Headers show
Series Go patch committed: Use correct path for string/[]byte embed | expand

Commit Message

Ian Lance Taylor Feb. 12, 2021, 7:18 p.m. UTC
This patch by Michael Matloob fixes the Go frontend to use the correct
path when opening an embedded file for a string or []byte type.  For
the other embed.FS case we were correctly using the Files mapping, but
for string or []byte we were not.  Bootstrapped and ran Go testsuite
on x86_64-pc-linux-gnu.  Committed to mainline.

Ian
7767de2344dca80cc95a982b048c341b72c169c2
diff mbox series

Patch

diff --git a/gcc/go/gofrontend/MERGE b/gcc/go/gofrontend/MERGE
index 905c6fe9326..3175ba0e005 100644
--- a/gcc/go/gofrontend/MERGE
+++ b/gcc/go/gofrontend/MERGE
@@ -1,4 +1,4 @@ 
-78770fd9c29037dec8b2919c0f02067915c6ad33
+a5d7c4225fbbd06b97db6fa424cc0cb5191082d4
 
 The first line of this file holds the git revision number of the last
 merge done from the gofrontend repository.
diff --git a/gcc/go/gofrontend/embed.cc b/gcc/go/gofrontend/embed.cc
index bea1003bc08..0a7df0531ec 100644
--- a/gcc/go/gofrontend/embed.cc
+++ b/gcc/go/gofrontend/embed.cc
@@ -812,8 +812,7 @@  Gogo::initializer_for_embeds(Type* type,
 	}
 
       // Each pattern in the embedcfg file maps to a list of file
-      // names.  For each file name, the embedcfg file records an
-      // absolute path.  Add those absolute paths to PATHS.
+      // names.  Add those file names to PATHS.
       for (std::vector<std::string>::const_iterator pf = pp->second.begin();
 	   pf != pp->second.end();
 	   pf++)
@@ -865,7 +864,7 @@  Gogo::initializer_for_embeds(Type* type,
 	}
 
       std::string data;
-      if (!read_file(paths[0].c_str(), loc, &data))
+      if (!read_file(this->embed_files_[paths[0]].c_str(), loc, &data))
 	return Expression::make_error(loc);
 
       Expression* e = Expression::make_string(data, loc);