Repository: incubator-htrace Updated Branches: refs/heads/master af2c084ed -> f0182729e
HTRACE-79 addendum. Fix broken build from "Unicode (UTF-8) BOM in middle of file" error from bundler.go Project: http://git-wip-us.apache.org/repos/asf/incubator-htrace/repo Commit: http://git-wip-us.apache.org/repos/asf/incubator-htrace/commit/f0182729 Tree: http://git-wip-us.apache.org/repos/asf/incubator-htrace/tree/f0182729 Diff: http://git-wip-us.apache.org/repos/asf/incubator-htrace/diff/f0182729 Branch: refs/heads/master Commit: f0182729eadcd5ae8d24ff8ecfbe6cec02c72e07 Parents: af2c084 Author: Colin P. Mccabe <[email protected]> Authored: Tue Jan 27 18:55:18 2015 -0800 Committer: Colin P. Mccabe <[email protected]> Committed: Tue Jan 27 18:55:18 2015 -0800 ---------------------------------------------------------------------- htrace-core/src/go/src/org/apache/htrace/bundler/bundler.go | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/incubator-htrace/blob/f0182729/htrace-core/src/go/src/org/apache/htrace/bundler/bundler.go ---------------------------------------------------------------------- diff --git a/htrace-core/src/go/src/org/apache/htrace/bundler/bundler.go b/htrace-core/src/go/src/org/apache/htrace/bundler/bundler.go index 982dc8f..11c3292 100644 --- a/htrace-core/src/go/src/org/apache/htrace/bundler/bundler.go +++ b/htrace-core/src/go/src/org/apache/htrace/bundler/bundler.go @@ -160,7 +160,10 @@ func createBundleFile(pkg, src, sfile, dst string) error { reader := bufio.NewReader(in) scanner := bufio.NewScanner(reader) for scanner.Scan() { - _, err := out.WriteString(strings.Replace(scanner.Text(), "`", "` + \"`\" + `", -1) + "\n") + str := strings.Replace(scanner.Text(), "`", "` + \"`\" + `", -1) + "\n" + // Avoid "Unicode (UTF-8) BOM in middle of file" error. + str = strings.Replace(str, "\uFEFF", "` + \"\\uFEFF\" + `", -1) + _, err := out.WriteString(str) if err != nil { return err } @@ -223,6 +226,6 @@ func main() { log.Fatalf("Error creating bundle file for %s in %s: %s\n", sfiles[s], *dst, err.Error()) } - log.Printf("Bundled %s as %s\n", absSrc, absSrc+SEP+sfileToDfile(sfiles[s])) + log.Printf("Bundled %s as %s\n", absSrc, *dst+SEP+sfileToDfile(sfiles[s])) } }
