Skip to content

EDITOR environment variable is needed(?) #249

@rcassani

Description

@rcassani

I made the install with: go install github.com/mbrt/gmailctl/cmd/gmailctl@latest,
configured xdg-mime to use my editor, through modifying ~/.config/mimeapps.list,
and followed instructions to set up the Gmail API.

However at running gmailctl edit I get this error:

panic: errors: target must be a non-nil pointer

goroutine 1 [running]:
errors.As({0xc96180, 0xc000138ee0}, {0xb3ff60, 0x0?})
	/usr/lib/go/src/errors/wrap.go:85 +0x3f2
github.com/mbrt/gmailctl/cmd/gmailctl/cmd.spawnEditor({0xc00014aea0, 0x20})
	/home/rcassani/go/pkg/mod/github.com/mbrt/gmailctl@v0.10.2/cmd/gmailctl/cmd/edit_cmd.go:181 +0x2b3
github.com/mbrt/gmailctl/cmd/gmailctl/cmd.edit({0xc000128870, 0x27}, 0x0?)
	/home/rcassani/go/pkg/mod/github.com/mbrt/gmailctl@v0.10.2/cmd/gmailctl/cmd/edit_cmd.go:90 +0x19f
github.com/mbrt/gmailctl/cmd/gmailctl/cmd.glob..func5(0x12707e0?, {0xb68d4f?, 0x0?, 0x0?})
	/home/rcassani/go/pkg/mod/github.com/mbrt/gmailctl@v0.10.2/cmd/gmailctl/cmd/edit_cmd.go:60 +0x55
github.com/spf13/cobra.(*Command).execute(0x12707e0, {0x12b8708, 0x0, 0x0})
	/home/rcassani/go/pkg/mod/github.com/spf13/cobra@v1.4.0/command.go:860 +0x663
github.com/spf13/cobra.(*Command).ExecuteC(0x1270f60)
	/home/rcassani/go/pkg/mod/github.com/spf13/cobra@v1.4.0/command.go:974 +0x3b4
github.com/spf13/cobra.(*Command).Execute(...)
	/home/rcassani/go/pkg/mod/github.com/spf13/cobra@v1.4.0/command.go:902
github.com/mbrt/gmailctl/cmd/gmailctl/cmd.Execute()
	/home/rcassani/go/pkg/mod/github.com/mbrt/gmailctl@v0.10.2/cmd/gmailctl/cmd/root_cmd.go:26 +0x25
main.main()
	/home/rcassani/go/pkg/mod/github.com/mbrt/gmailctl@v0.10.2/cmd/gmailctl/main.go:10 +0x51

Taking a look to the code, I noticed that by setting the EDITOR variable, I can avoid that error.
Is this expected?
Does EDITOR overrides the editor specified in mimeapps.list?

Metadata

Metadata

Assignees

No one assigned

    Labels

    kind/bugSomething isn't working

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions