Subject: Re: bug#70939: [PATCH] Add commands to run unit tests in go-ts-mode

From: Ankit Gadiya <[email-masked]>
Date: Thu, 16 May 2024 20:33:31 +0530

> > Eli, is there a convention regarding local variables?
> > In the patch we have:
> > +  (if (local-variable-p 'go-build-tags)
> > +      (format "-tags %s" go-build-tags)
> > +    ""))
> >
> > Should that local variable be prefixed with go-ts-mode, or is it fine as is?
>
> If the variable is specific to go-ts-mode, it should indeed be
> prefixed with "go-ts-".  But I don't see this variable in
> go-ts-mode.el nor in the patch (did I miss something?), and I don't
> understand why the above condition insists on using only a
> buffer-local value of the variable in the first place?  What's wrong
> with having a global value for the variable?

I'm not yet familiar with Elisp-idioms but I'll explain my idea and why I used
the variable this way.

The build tags can be unique to the specific project and sometimes even per
go package. So I thought to make it buffer specific rather than a global
variable defined in the init.el. I'm using these changes on my machine and I'm
defining the build tags in the dir-locals file. This way the variable is always
available for the mode commands to access.

But now I'm thinking maybe it makes sense to add it as defvar-local under the
go-ts-mode? Please guide me with what will be the correct way to implement it.

-- 
Ankit