Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

misc/emacs: go-mode.el does not work handle temp directories besides /tmp/ for gofmt #3782

Closed
daaku opened this issue Jun 28, 2012 · 6 comments

Comments

@daaku
Copy link

daaku commented Jun 28, 2012

This was observed in go 1.0.2 on Mac OS X 10.7.4 with Emacs 24.1. On line 822 in
go-mode.el the code expects the file to always be in /tmp/:

  http://golang.org/misc/emacs/go-mode.el#L822

The relevant part:

  (replace-regexp "^--- /tmp/gofmt[0-9]*"

On my Mac this file ends up in /var/folders/n3/h3ydzm995isdufgh63k2c0000gn/T/. If you
have a Mac environment handy you can try "echo $TMPDIR" to see your temp
directory. To fix it I changed it to:

  (replace-regexp "^--- /.*/gofmt[0-9]*"

Which is a less ideal regexp, but at least it works :)
@bradfitz
Copy link
Contributor

Comment 1:

Ah, this probably explains some of the weird errors I've been seeing lately.  go-mode.el
got very unreliable recently on a number of my machines.

@Sajmani
Copy link
Contributor

Sajmani commented Jun 29, 2012

Comment 2:

Oops.  We broke this in CL 6296060.  Will fix.

Owner changed to @Sajmani.

@gopherbot
Copy link

Comment 4 by jmeurin@google.com:

Sent http://golang.org/cl/6346050/

@Sajmani
Copy link
Contributor

Sajmani commented Jun 29, 2012

Comment 5:

This issue was closed by revision 11cafa3.

Status changed to Fixed.

@daaku
Copy link
Author

daaku commented Jun 29, 2012

Comment 6:

Thank you!

@dustin
Copy link

dustin commented Oct 25, 2012

Comment 7:

I see I missed the fixing of this one.  This looks good.  I think the exact fix was
closer to this:
        (replace-regexp (concat "^--- " temporary-file-directory "gofmt[0-9]*")
                        (concat "--- /tmp/" filename)
                        nil min (point-max)))

Sajmani pushed a commit that referenced this issue May 11, 2015
…IR is not the default.

««« backport c5f564efc620
misc/emacs: Fix the gofmt patching when the TMPDIR is not the default.

The previous code assumed the gofmt output referred to /tmp but
that's not true if TMPDIR points somewhere else (like on Macs).
Fixes #3782.

R=sameer
CC=golang-dev
https://golang.org/cl/6346050

»»»
@golang golang locked and limited conversation to collaborators Jun 24, 2016
@rsc rsc unassigned Sajmani Jun 22, 2022
This issue was closed.
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

No branches or pull requests

5 participants