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>
This commit is contained in:
Rob Findley 2021-02-04 09:58:04 -05:00 коммит произвёл Robert Findley
Родитель 553f4ba85f
Коммит fd2f9f3bd1
3 изменённых файлов: 9 добавлений и 1 удалений

Просмотреть файл

@ -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.

Просмотреть файл

@ -20,6 +20,10 @@ const src = `// Copyright 2021 The Go Authors. All rights reserved.
// 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.

Просмотреть файл

@ -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"