internal/lsp/command: use a build tag to avoid broken generation

Modifying command.Interface can prevent re-generation by breaking the
build (because command_gen.go is no longer valid). Fix this by using a
build tag to only consider the interface during generation.

Change-Id: I025879897b0d1d98148654201a54539868e9f578
Reviewed-on: https://go-review.googlesource.com/c/tools/+/289691
Trust: Robert Findley <rfindley@google.com>
Run-TryBot: Robert Findley <rfindley@google.com>
gopls-CI: kokoro <noreply+kokoro@google.com>
TryBot-Result: Go Bot <gobot@golang.org>
Reviewed-by: Rebecca Stambler <rstambler@golang.org>
Reviewed-by: Heschi Kreinick <heschi@google.com>
diff --git a/internal/lsp/command/command_gen.go b/internal/lsp/command/command_gen.go
index 5980f35..d3dbfd5 100644
--- a/internal/lsp/command/command_gen.go
+++ b/internal/lsp/command/command_gen.go
@@ -2,6 +2,10 @@
 // Use of this source code is governed by a BSD-style
 // license that can be found in the LICENSE file.
 
+// Don't include this file during code generation, or it will break the build
+// if existing interface methods have been modified.
+// +build !generate
+
 package command
 
 // Code generated by generate.go. DO NOT EDIT.
diff --git a/internal/lsp/command/generate/generate.go b/internal/lsp/command/generate/generate.go
index d206e22..d31b437 100644
--- a/internal/lsp/command/generate/generate.go
+++ b/internal/lsp/command/generate/generate.go
@@ -20,6 +20,10 @@
 // Use of this source code is governed by a BSD-style
 // license that can be found in the LICENSE file.
 
+// Don't include this file during code generation, or it will break the build
+// if existing interface methods have been modified.
+// +build !generate
+
 package command
 
 // Code generated by generate.go. DO NOT EDIT.
diff --git a/internal/lsp/command/interface.go b/internal/lsp/command/interface.go
index cbfa1c5..4f068fa 100644
--- a/internal/lsp/command/interface.go
+++ b/internal/lsp/command/interface.go
@@ -12,7 +12,7 @@
 // also provided by this package, via code generation.
 package command
 
-//go:generate go run generate.go
+//go:generate go run -tags=generate generate.go
 
 import "golang.org/x/tools/internal/lsp/protocol"